LLVM  13.0.0git
SystemZSubtarget.cpp
Go to the documentation of this file.
1 //===-- SystemZSubtarget.cpp - SystemZ subtarget information --------------===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "SystemZSubtarget.h"
11 #include "llvm/IR/GlobalValue.h"
13 
14 using namespace llvm;
15 
16 #define DEBUG_TYPE "systemz-subtarget"
17 
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "SystemZGenSubtargetInfo.inc"
21 
23  "systemz-subreg-liveness",
24  cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"),
25  cl::Hidden);
26 
27 // Pin the vtable to this file.
28 void SystemZSubtarget::anchor() {}
29 
31 SystemZSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS) {
32  StringRef CPUName = CPU;
33  if (CPUName.empty())
34  CPUName = "generic";
35  // Parse features string.
36  ParseSubtargetFeatures(CPUName, /*TuneCPU*/ CPUName, FS);
37 
38  // -msoft-float implies -mno-vx.
39  if (HasSoftFloat)
40  HasVector = false;
41 
42  // -mno-vx implicitly disables all vector-related features.
43  if (!HasVector) {
44  HasVectorEnhancements1 = false;
45  HasVectorEnhancements2 = false;
46  HasVectorPackedDecimal = false;
48  }
49 
50  return *this;
51 }
52 
53 SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,
54  const std::string &FS,
55  const TargetMachine &TM)
56  : SystemZGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS),
57  HasDistinctOps(false), HasLoadStoreOnCond(false), HasHighWord(false),
58  HasFPExtension(false), HasPopulationCount(false),
59  HasMessageSecurityAssist3(false), HasMessageSecurityAssist4(false),
60  HasResetReferenceBitsMultiple(false), HasFastSerialization(false),
61  HasInterlockedAccess1(false), HasMiscellaneousExtensions(false),
62  HasExecutionHint(false), HasLoadAndTrap(false),
63  HasTransactionalExecution(false), HasProcessorAssist(false),
64  HasDFPZonedConversion(false), HasEnhancedDAT2(false),
65  HasVector(false), HasLoadStoreOnCond2(false),
66  HasLoadAndZeroRightmostByte(false), HasMessageSecurityAssist5(false),
67  HasDFPPackedConversion(false),
68  HasMiscellaneousExtensions2(false), HasGuardedStorage(false),
69  HasMessageSecurityAssist7(false), HasMessageSecurityAssist8(false),
70  HasVectorEnhancements1(false), HasVectorPackedDecimal(false),
71  HasInsertReferenceBitsMultiple(false),
72  HasMiscellaneousExtensions3(false), HasMessageSecurityAssist9(false),
73  HasVectorEnhancements2(false), HasVectorPackedDecimalEnhancement(false),
74  HasEnhancedSort(false), HasDeflateConversion(false), HasSoftFloat(false),
75  TargetTriple(TT), InstrInfo(initializeSubtargetDependencies(CPU, FS)),
76  TLInfo(TM, *this), TSInfo(), FrameLowering() {}
77 
78 
80  return UseSubRegLiveness;
81 }
82 
84  CodeModel::Model CM) const {
85  // PC32DBL accesses require the low bit to be clear.
86  //
87  // FIXME: Explicitly check for functions: the datalayout is currently
88  // missing information about function pointers.
89  const DataLayout &DL = GV->getParent()->getDataLayout();
90  if (GV->getPointerAlignment(DL) == 1 && !GV->getValueType()->isFunctionTy())
91  return false;
92 
93  // For the small model, all locally-binding symbols are in range.
94  if (CM == CodeModel::Small)
95  return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
96 
97  // For Medium and above, assume that the symbol is not within the 4GB range.
98  // Taking the address of locally-defined text would be OK, but that
99  // case isn't easy to detect.
100  return false;
101 }
llvm::SystemZSubtarget::isPC32DBLSymbol
bool isPC32DBLSymbol(const GlobalValue *GV, CodeModel::Model CM) const
Definition: SystemZSubtarget.cpp:83
llvm
Definition: AllocatorList.h:23
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:156
llvm::Value::getPointerAlignment
Align getPointerAlignment(const DataLayout &DL) const
Returns an alignment of the pointer value.
Definition: Value.cpp:867
llvm::SystemZISD::TM
@ TM
Definition: SystemZISelLowering.h:65
llvm::SystemZSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:112
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
llvm::SystemZSubtarget::HasVectorEnhancements1
bool HasVectorEnhancements1
Definition: SystemZSubtarget.h:62
SystemZMCTargetDesc.h
GlobalValue.h
TargetMachine.h
llvm::X86AS::FS
@ FS
Definition: X86.h:183
false
Definition: StackSlotColoring.cpp:142
llvm::CodeModel::Small
@ Small
Definition: CodeGen.h:28
llvm::SystemZSubtarget::HasVectorEnhancements2
bool HasVectorEnhancements2
Definition: SystemZSubtarget.h:67
llvm::Type::isFunctionTy
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition: Type.h:220
llvm::CodeModel::Model
Model
Definition: CodeGen.h:28
llvm::cl::opt< bool >
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:572
llvm::SystemZSubtarget::HasVector
bool HasVector
Definition: SystemZSubtarget.h:53
SystemZGenSubtargetInfo
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::SystemZSubtarget
Definition: SystemZSubtarget.h:33
SystemZSubtarget.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::TargetMachine::shouldAssumeDSOLocal
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const
Definition: TargetMachine.cpp:94
UseSubRegLiveness
static cl::opt< bool > UseSubRegLiveness("systemz-subreg-liveness", cl::desc("Enable subregister liveness tracking for SystemZ (experimental)"), cl::Hidden)
llvm::TargetLoweringBase::getTargetMachine
const TargetMachine & getTargetMachine() const
Definition: TargetLowering.h:335
llvm::SystemZSubtarget::enableSubRegLiveness
bool enableSubRegLiveness() const override
Definition: SystemZSubtarget.cpp:79
llvm::SystemZSubtarget::HasSoftFloat
bool HasSoftFloat
Definition: SystemZSubtarget.h:71
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition: Module.cpp:397
llvm::GlobalValue::getValueType
Type * getValueType() const
Definition: GlobalValue.h:273
llvm::SystemZSubtarget::HasVectorPackedDecimal
bool HasVectorPackedDecimal
Definition: SystemZSubtarget.h:63
llvm::cl::desc
Definition: CommandLine.h:411
llvm::SystemZSubtarget::HasVectorPackedDecimalEnhancement
bool HasVectorPackedDecimalEnhancement
Definition: SystemZSubtarget.h:68
llvm::SystemZSubtarget::SystemZSubtarget
SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
Definition: SystemZSubtarget.cpp:53