blob: 127d9fb99cd96cab3912e620c393c7245c56888e [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Ulrich Weigand5f613df2013-05-06 16:15:19 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "SystemZSubtarget.h"
Chandler Carruth8a8cd2b2014-01-07 11:48:04 +000010#include "MCTargetDesc/SystemZMCTargetDesc.h"
Ulrich Weigand5f613df2013-05-06 16:15:19 +000011#include "llvm/IR/GlobalValue.h"
12
Chandler Carruthd174b722014-04-22 02:03:14 +000013using namespace llvm;
14
Chandler Carruthe96dd892014-04-21 22:55:11 +000015#define DEBUG_TYPE "systemz-subtarget"
16
Ulrich Weigand5f613df2013-05-06 16:15:19 +000017#define GET_SUBTARGETINFO_TARGET_DESC
18#define GET_SUBTARGETINFO_CTOR
19#include "SystemZGenSubtargetInfo.inc"
20
Jonas Paulssond5a9c2d2018-08-15 15:04:49 +000021static cl::opt<bool> UseSubRegLiveness(
22 "systemz-subreg-liveness",
23 cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
24 cl::Hidden);
25
Eric Christopher0eaa5412014-07-02 22:05:40 +000026// Pin the vtable to this file.
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000027void SystemZSubtarget::anchor() {}
28
Eric Christopher52349952014-07-01 20:19:02 +000029SystemZSubtarget &
30SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
Ulrich Weigand5f613df2013-05-06 16:15:19 +000031 std::string CPUName = CPU;
32 if (CPUName.empty())
Richard Sandifordf834ea12013-10-31 12:14:17 +000033 CPUName = "generic";
Ulrich Weigand5f613df2013-05-06 16:15:19 +000034 // Parse features string.
35 ParseSubtargetFeatures(CPUName, FS);
Eric Christopher52349952014-07-01 20:19:02 +000036 return *this;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000037}
38
Daniel Sandersa73f1fd2015-06-10 12:11:26 +000039SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
Eric Christopher52349952014-07-01 20:19:02 +000040 const std::string &FS,
41 const TargetMachine &TM)
Daniel Sanders50f17232015-09-15 16:17:27 +000042 : SystemZGenSubtargetInfo(TT, CPU, FS), HasDistinctOps(false),
Eric Christopher52349952014-07-01 20:19:02 +000043 HasLoadStoreOnCond(false), HasHighWord(false), HasFPExtension(false),
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000044 HasPopulationCount(false), HasMessageSecurityAssist3(false),
45 HasMessageSecurityAssist4(false), HasResetReferenceBitsMultiple(false),
Ulrich Weigand33a441a2017-05-10 12:42:00 +000046 HasFastSerialization(false), HasInterlockedAccess1(false),
47 HasMiscellaneousExtensions(false),
Ulrich Weigand84404f32016-11-28 14:01:51 +000048 HasExecutionHint(false), HasLoadAndTrap(false),
49 HasTransactionalExecution(false), HasProcessorAssist(false),
Ulrich Weigand03ab2e22017-06-30 20:43:40 +000050 HasDFPZonedConversion(false), HasEnhancedDAT2(false),
Ulrich Weigand84404f32016-11-28 14:01:51 +000051 HasVector(false), HasLoadStoreOnCond2(false),
Ulrich Weigand33a441a2017-05-10 12:42:00 +000052 HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false),
Ulrich Weigand3f484e62017-05-30 10:15:16 +000053 HasDFPPackedConversion(false),
Ulrich Weigand2b3482f2017-07-17 17:41:11 +000054 HasMiscellaneousExtensions2(false), HasGuardedStorage(false),
55 HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false),
56 HasVectorEnhancements1(false), HasVectorPackedDecimal(false),
57 HasInsertReferenceBitsMultiple(false),
Ulrich Weigand92c2c672016-11-11 12:46:28 +000058 TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
59 TLInfo(TM, *this), TSInfo(), FrameLowering() {}
Eric Christopher52349952014-07-01 20:19:02 +000060
Jonas Paulssond5a9c2d2018-08-15 15:04:49 +000061
62bool SystemZSubtarget::enableSubRegLiveness() const {
63 return UseSubRegLiveness;
64}
65
Ulrich Weigand5f613df2013-05-06 16:15:19 +000066bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
Ulrich Weigand5f613df2013-05-06 16:15:19 +000067 CodeModel::Model CM) const {
68 // PC32DBL accesses require the low bit to be clear. Note that a zero
69 // value selects the default alignment and is therefore OK.
70 if (GV->getAlignment() == 1)
71 return false;
72
73 // For the small model, all locally-binding symbols are in range.
74 if (CM == CodeModel::Small)
Rafael Espindola3beef8d2016-06-27 23:15:57 +000075 return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
Ulrich Weigand5f613df2013-05-06 16:15:19 +000076
77 // For Medium and above, assume that the symbol is not within the 4GB range.
78 // Taking the address of locally-defined text would be OK, but that
79 // case isn't easy to detect.
80 return false;
81}