LLVM: lib/Target/SystemZ/SystemZTargetMachine.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
28#include
29#include
30#include
31
32using namespace llvm;
33
35 "systemz-machine-combiner",
36 cl::desc("Enable the machine combiner pass"),
38
39
56
57static std::unique_ptr createTLOF(const Triple &TT) {
58 if (TT.isOSzOS())
59 return std::make_unique();
60
61
62
63 return std::make_unique();
64}
65
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
106 if (CM) {
108 report_fatal_error("Target does not support the tiny CodeModel", false);
110 report_fatal_error("Target does not support the kernel CodeModel", false);
111 return *CM;
112 }
113 if (JIT)
116}
117
121 std::optionalReloc::Model RM,
122 std::optionalCodeModel::Model CM,
125 T, TT.computeDataLayout(), TT, CPU, FS, Options,
128 OL),
131}
132
134
137 Attribute CPUAttr = F.getFnAttribute("target-cpu");
138 Attribute TuneAttr = F.getFnAttribute("tune-cpu");
139 Attribute FSAttr = F.getFnAttribute("target-features");
140
141 std::string CPU =
143 std::string TuneCPU =
145 std::string FS =
147
148
149
150
151 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
152 if (SoftFloat)
153 FS += FS.empty() ? "+soft-float" : ",+soft-float";
154 bool BackChain = F.hasFnAttribute("backchain");
155 if (BackChain)
156 FS += FS.empty() ? "+backchain" : ",+backchain";
157
158 auto &I = SubtargetMap[CPU + TuneCPU + FS];
159 if () {
160
161
162
164 I = std::make_unique(TargetTriple, CPU, TuneCPU, FS,
165 *this);
166 }
167
168 return I.get();
169}
170
175
176namespace {
177
178
180public:
183
186 }
187
188 void addIRPasses() override;
189 bool addInstSelector() override;
190 bool addILPOpts() override;
191 void addPreRegAlloc() override;
192 void addPostRewrite() override;
193 void addPostRegAlloc() override;
194 void addPreSched2() override;
195 void addPreEmitPass() override;
196};
197
198}
199
200void SystemZPassConfig::addIRPasses() {
204 }
205
207
209}
210
211bool SystemZPassConfig::addInstSelector() {
213
216
217 return false;
218}
219
220bool SystemZPassConfig::addILPOpts() {
222
225
226 return true;
227}
228
229void SystemZPassConfig::addPreRegAlloc() {
231}
232
233void SystemZPassConfig::addPostRewrite() {
235}
236
237void SystemZPassConfig::addPostRegAlloc() {
238
239
242}
243
244void SystemZPassConfig::addPreSched2() {
247}
248
249void SystemZPassConfig::addPreEmitPass() {
250
251
252
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
282
283
284
285
288}
289
291 return new SystemZPassConfig(*this, PM);
292}
293
298
304}
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
static Reloc::Model getEffectiveRelocModel()
#define LLVM_EXTERNAL_VISIBILITY
static cl::opt< bool > EnableMachineCombinerPass("ppc-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
static CodeModel::Model getEffectiveSystemZCodeModel(std::optional< CodeModel::Model > CM, Reloc::Model RM, bool JIT)
Definition SystemZTargetMachine.cpp:104
static cl::opt< bool > EnableMachineCombinerPass("systemz-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTarget()
Definition SystemZTargetMachine.cpp:41
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Target-Independent Code Generator Pass Configuration Options pass.
This pass exposes codegen information to IR-level passes.
static std::unique_ptr< TargetLoweringObjectFile > createTLOF()
Functions, function parameters, and return types can have attributes to indicate how they should be t...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A ScheduleDAG for scheduling lists of MachineInstr.
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
const SystemZSubtarget * getSubtargetImpl() const =delete
SystemZTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOptLevel OL, bool JIT)
Definition SystemZTargetMachine.cpp:118
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
Definition SystemZTargetMachine.cpp:295
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
Definition SystemZTargetMachine.cpp:299
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition SystemZTargetMachine.cpp:290
ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const override
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
Definition SystemZTargetMachine.cpp:172
~SystemZTargetMachine() override
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
const Triple & getTargetTriple() const
std::unique_ptr< const MCSubtargetInfo > STI
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
Target-Independent Code Generator Pass Configuration Options.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
TargetSubtargetInfo - Generic base class for all target subtargets.
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
@ C
The default llvm calling convention, compatible with C.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
Target & getTheSystemZTarget()
void initializeSystemZElimComparePass(PassRegistry &)
FunctionPass * createSystemZLongBranchPass(SystemZTargetMachine &TM)
FunctionPass * createSystemZISelDag(SystemZTargetMachine &TM, CodeGenOptLevel OptLevel)
FunctionPass * createSystemZCopyPhysRegsPass(SystemZTargetMachine &TM)
FunctionPass * createSystemZElimComparePass(SystemZTargetMachine &TM)
void initializeSystemZCopyPhysRegsPass(PassRegistry &)
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
void initializeSystemZLongBranchPass(PassRegistry &)
void initializeSystemZShortenInstPass(PassRegistry &)
LLVM_ABI char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
LLVM_ABI char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
void initializeSystemZDAGToDAGISelLegacyPass(PassRegistry &)
ScheduleDAGMI * createSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
FunctionPass * createSystemZTDCPass()
LLVM_ABI FunctionPass * createLoopDataPrefetchPass()
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
FunctionPass * createSystemZShortenInstPass(SystemZTargetMachine &TM)
void initializeSystemZPostRewritePass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
void initializeSystemZTDCPassPass(PassRegistry &)
FunctionPass * createSystemZLDCleanupPass(SystemZTargetMachine &TM)
void initializeSystemZAsmPrinterPass(PassRegistry &)
FunctionPass * createSystemZPostRewritePass(SystemZTargetMachine &TM)
LLVM_ABI char & IfConverterID
IfConverter - This pass performs machine code if conversion.
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
void initializeSystemZLDCleanupPass(PassRegistry &)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
RegisterTargetMachine - Helper template for registering a target machine implementation,...