LLVM: lib/Target/SystemZ/SystemZTargetMachine.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
27#include
28#include
29#include
30
31using namespace llvm;
32
34 "systemz-machine-combiner",
35 cl::desc("Enable the machine combiner pass"),
37
38
40
51}
52
54 std::string Ret;
55
56
57 Ret += "E";
58
59
61
62
63 if (TT.isOSzOS()) {
64 if (TT.isArch64Bit()) {
65
66 Ret += "-p1:32:32";
67 }
68 }
69
70
71
72
73 Ret += "-i1:8:16-i8:8:16";
74
75
76 Ret += "-i64:64";
77
78
79 Ret += "-f128:64";
80
81
82
83 Ret += "-v128:64";
84
85
86 Ret += "-a:8:16";
87
88
89 Ret += "-n32:64";
90
91 return Ret;
92}
93
94static std::unique_ptr createTLOF(const Triple &TT) {
95 if (TT.isOSzOS())
96 return std::make_unique();
97
98
99
100 return std::make_unique();
101}
102
104
105
108 return *RM;
109}
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
143 if (CM) {
145 report_fatal_error("Target does not support the tiny CodeModel", false);
147 report_fatal_error("Target does not support the kernel CodeModel", false);
148 return *CM;
149 }
150 if (JIT)
153}
154
158 std::optionalReloc::Model RM,
159 std::optionalCodeModel::Model CM,
165 OL),
166 TLOF(createTLOF(getTargetTriple())) {
168}
169
171
174 Attribute CPUAttr = F.getFnAttribute("target-cpu");
175 Attribute TuneAttr = F.getFnAttribute("tune-cpu");
176 Attribute FSAttr = F.getFnAttribute("target-features");
177
178 std::string CPU =
180 std::string TuneCPU =
182 std::string FS =
184
185
186
187
188 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
189 if (SoftFloat)
190 FS += FS.empty() ? "+soft-float" : ",+soft-float";
191 bool BackChain = F.hasFnAttribute("backchain");
192 if (BackChain)
193 FS += FS.empty() ? "+backchain" : ",+backchain";
194
195 auto &I = SubtargetMap[CPU + TuneCPU + FS];
196 if () {
197
198
199
201 I = std::make_unique(TargetTriple, CPU, TuneCPU, FS,
202 *this);
203 }
204
205 return I.get();
206}
207
208namespace {
209
210
212public:
215
217 return getTM();
218 }
219
223 std::make_unique(C),
224 true);
225 }
226
227 void addIRPasses() override;
228 bool addInstSelector() override;
229 bool addILPOpts() override;
230 void addPreRegAlloc() override;
231 void addPostRewrite() override;
232 void addPostRegAlloc() override;
233 void addPreSched2() override;
234 void addPreEmitPass() override;
235};
236
237}
238
239void SystemZPassConfig::addIRPasses() {
243 }
244
246
248}
249
250bool SystemZPassConfig::addInstSelector() {
252
255
256 return false;
257}
258
259bool SystemZPassConfig::addILPOpts() {
261
264
265 return true;
266}
267
268void SystemZPassConfig::addPreRegAlloc() {
270}
271
272void SystemZPassConfig::addPostRewrite() {
274}
275
276void SystemZPassConfig::addPostRegAlloc() {
277
278
281}
282
283void SystemZPassConfig::addPreSched2() {
286}
287
288void SystemZPassConfig::addPreEmitPass() {
289
290
291
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
321
322
323
324
327}
328
330 return new SystemZPassConfig(*this, PM);
331}
332
336}
337
341 return SystemZMachineFunctionInfo::create(
343}
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static std::string computeDataLayout()
static cl::opt< bool > EnableMachineCombinerPass("ppc-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
static CodeModel::Model getEffectiveSystemZCodeModel(std::optional< CodeModel::Model > CM, Reloc::Model RM, bool JIT)
static cl::opt< bool > EnableMachineCombinerPass("systemz-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTarget()
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
Target-Independent Code Generator Pass Configuration Options pass.
This pass exposes codegen information to IR-level passes.
static std::unique_ptr< TargetLoweringObjectFile > createTLOF()
StringRef getValueAsString() const
Return the attribute's value as a string.
bool isValid() const
Return true if the attribute is any kind of attribute.
Allocate memory in an ever growing pool, as if by bump-pointer.
implements a set of functionality in the TargetMachine class for targets that make use of the indepen...
static const char * getManglingComponent(const Triple &T)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
A ScheduleDAG for scheduling lists of MachineInstr.
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
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)
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
~SystemZTargetMachine() override
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
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)
char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
void initializeSystemZLongBranchPass(PassRegistry &)
void initializeSystemZShortenInstPass(PassRegistry &)
char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
void initializeSystemZDAGToDAGISelLegacyPass(PassRegistry &)
FunctionPass * createSystemZTDCPass()
FunctionPass * createLoopDataPrefetchPass()
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
FunctionPass * createSystemZShortenInstPass(SystemZTargetMachine &TM)
void initializeSystemZPostRewritePass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
void initializeSystemZTDCPassPass(PassRegistry &)
FunctionPass * createSystemZLDCleanupPass(SystemZTargetMachine &TM)
FunctionPass * createSystemZPostRewritePass(SystemZTargetMachine &TM)
char & IfConverterID
IfConverter - This pass performs machine code if conversion.
FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
void initializeSystemZLDCleanupPass(PassRegistry &)
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
RegisterTargetMachine - Helper template for registering a target machine implementation,...