LLVM 17.0.0git
PPCTargetMachine.cpp
Go to the documentation of this file.
1//===-- PPCTargetMachine.cpp - Define TargetMachine for PowerPC -----------===//
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// Top-level implementation for the PowerPC target.
10//
11//===----------------------------------------------------------------------===//
12
13#include "PPCTargetMachine.h"
15#include "PPC.h"
17#include "PPCMachineScheduler.h"
18#include "PPCMacroFusion.h"
19#include "PPCSubtarget.h"
20#include "PPCTargetObjectFile.h"
23#include "llvm/ADT/STLExtras.h"
24#include "llvm/ADT/StringRef.h"
33#include "llvm/CodeGen/Passes.h"
35#include "llvm/IR/Attributes.h"
36#include "llvm/IR/DataLayout.h"
37#include "llvm/IR/Function.h"
40#include "llvm/Pass.h"
47#include <cassert>
48#include <memory>
49#include <optional>
50#include <string>
51
52using namespace llvm;
53
54
55static cl::opt<bool>
56 EnableBranchCoalescing("enable-ppc-branch-coalesce", cl::Hidden,
57 cl::desc("enable coalescing of duplicate branches for PPC"));
58static cl::
59opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden,
60 cl::desc("Disable CTR loops for PPC"));
61
62static cl::
63opt<bool> DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden,
64 cl::desc("Disable PPC loop instr form prep"));
65
66static cl::opt<bool>
67VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early",
68 cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"));
69
70static cl::
71opt<bool> DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden,
72 cl::desc("Disable VSX Swap Removal for PPC"));
73
74static cl::
75opt<bool> DisableMIPeephole("disable-ppc-peephole", cl::Hidden,
76 cl::desc("Disable machine peepholes for PPC"));
77
78static cl::opt<bool>
79EnableGEPOpt("ppc-gep-opt", cl::Hidden,
80 cl::desc("Enable optimizations on complex GEPs"),
81 cl::init(true));
82
83static cl::opt<bool>
84EnablePrefetch("enable-ppc-prefetching",
85 cl::desc("enable software prefetching on PPC"),
86 cl::init(false), cl::Hidden);
87
88static cl::opt<bool>
89EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps",
90 cl::desc("Add extra TOC register dependencies"),
91 cl::init(true), cl::Hidden);
92
93static cl::opt<bool>
94EnableMachineCombinerPass("ppc-machine-combiner",
95 cl::desc("Enable the machine combiner pass"),
96 cl::init(true), cl::Hidden);
97
98static cl::opt<bool>
99 ReduceCRLogical("ppc-reduce-cr-logicals",
100 cl::desc("Expand eligible cr-logical binary ops to branches"),
101 cl::init(true), cl::Hidden);
102
104 "enable-ppc-gen-scalar-mass", cl::init(false),
105 cl::desc("Enable lowering math functions to their corresponding MASS "
106 "(scalar) entries"),
107 cl::Hidden);
108
110 // Register the targets
115
117#ifndef NDEBUG
119#endif
140}
141
142static bool isLittleEndianTriple(const Triple &T) {
143 return T.getArch() == Triple::ppc64le || T.getArch() == Triple::ppcle;
144}
145
146/// Return the datalayout string of a subtarget.
147static std::string getDataLayoutString(const Triple &T) {
148 bool is64Bit = T.getArch() == Triple::ppc64 || T.getArch() == Triple::ppc64le;
149 std::string Ret;
150
151 // Most PPC* platforms are big endian, PPC(64)LE is little endian.
153 Ret = "e";
154 else
155 Ret = "E";
156
158
159 // PPC32 has 32 bit pointers. The PS3 (OS Lv2) is a PPC64 machine with 32 bit
160 // pointers.
161 if (!is64Bit || T.getOS() == Triple::Lv2)
162 Ret += "-p:32:32";
163
164 // Note, the alignment values for f64 and i64 on ppc64 in Darwin
165 // documentation are wrong; these are correct (i.e. "what gcc does").
166 Ret += "-i64:64";
167
168 // PPC64 has 32 and 64 bit registers, PPC32 has only 32 bit ones.
169 if (is64Bit)
170 Ret += "-n32:64";
171 else
172 Ret += "-n32";
173
174 // Specify the vector alignment explicitly. For v256i1 and v512i1, the
175 // calculated alignment would be 256*alignment(i1) and 512*alignment(i1),
176 // which is 256 and 512 bytes - way over aligned.
177 if (is64Bit && (T.isOSAIX() || T.isOSLinux()))
178 Ret += "-S128-v256:256:256-v512:512:512";
179
180 return Ret;
181}
182
184 const Triple &TT) {
185 std::string FullFS = std::string(FS);
186
187 // Make sure 64-bit features are available when CPUname is generic
188 if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le) {
189 if (!FullFS.empty())
190 FullFS = "+64bit," + FullFS;
191 else
192 FullFS = "+64bit";
193 }
194
195 if (OL >= CodeGenOpt::Default) {
196 if (!FullFS.empty())
197 FullFS = "+crbits," + FullFS;
198 else
199 FullFS = "+crbits";
200 }
201
202 if (OL != CodeGenOpt::None) {
203 if (!FullFS.empty())
204 FullFS = "+invariant-function-descriptors," + FullFS;
205 else
206 FullFS = "+invariant-function-descriptors";
207 }
208
209 if (TT.isOSAIX()) {
210 if (!FullFS.empty())
211 FullFS = "+aix," + FullFS;
212 else
213 FullFS = "+aix";
214 }
215
216 return FullFS;
217}
218
219static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
220 if (TT.isOSAIX())
221 return std::make_unique<TargetLoweringObjectFileXCOFF>();
222
223 return std::make_unique<PPC64LinuxTargetObjectFile>();
224}
225
227 const TargetOptions &Options) {
228 if (Options.MCOptions.getABIName().startswith("elfv1"))
230 else if (Options.MCOptions.getABIName().startswith("elfv2"))
232
233 assert(Options.MCOptions.getABIName().empty() &&
234 "Unknown target-abi option!");
235
236 switch (TT.getArch()) {
237 case Triple::ppc64le:
239 case Triple::ppc64:
240 if (TT.isPPC64ELFv2ABI())
242 else
244 default:
246 }
247}
248
250 std::optional<Reloc::Model> RM) {
251 assert((!TT.isOSAIX() || !RM || *RM == Reloc::PIC_) &&
252 "Invalid relocation model for AIX.");
253
254 if (RM)
255 return *RM;
256
257 // Big Endian PPC and AIX default to PIC.
258 if (TT.getArch() == Triple::ppc64 || TT.isOSAIX())
259 return Reloc::PIC_;
260
261 // Rest are static by default.
262 return Reloc::Static;
263}
264
265static CodeModel::Model
266getEffectivePPCCodeModel(const Triple &TT, std::optional<CodeModel::Model> CM,
267 bool JIT) {
268 if (CM) {
269 if (*CM == CodeModel::Tiny)
270 report_fatal_error("Target does not support the tiny CodeModel", false);
271 if (*CM == CodeModel::Kernel)
272 report_fatal_error("Target does not support the kernel CodeModel", false);
273 return *CM;
274 }
275
276 if (JIT)
277 return CodeModel::Small;
278 if (TT.isOSAIX())
279 return CodeModel::Small;
280
281 assert(TT.isOSBinFormatELF() && "All remaining PPC OSes are ELF based.");
282
283 if (TT.isArch32Bit())
284 return CodeModel::Small;
285
286 assert(TT.isArch64Bit() && "Unsupported PPC architecture.");
287 return CodeModel::Medium;
288}
289
290
292 const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
293 ScheduleDAGMILive *DAG =
294 new ScheduleDAGMILive(C, ST.usePPCPreRASchedStrategy() ?
295 std::make_unique<PPCPreRASchedStrategy>(C) :
296 std::make_unique<GenericScheduler>(C));
297 // add DAG Mutations here.
298 DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI));
299 if (ST.hasStoreFusion())
300 DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
301 if (ST.hasFusion())
302 DAG->addMutation(createPowerPCMacroFusionDAGMutation());
303
304 return DAG;
305}
306
309 const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
310 ScheduleDAGMI *DAG =
311 new ScheduleDAGMI(C, ST.usePPCPostRASchedStrategy() ?
312 std::make_unique<PPCPostRASchedStrategy>(C) :
313 std::make_unique<PostGenericScheduler>(C), true);
314 // add DAG Mutations here.
315 if (ST.hasStoreFusion())
316 DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
317 if (ST.hasFusion())
318 DAG->addMutation(createPowerPCMacroFusionDAGMutation());
319 return DAG;
320}
321
322// The FeatureString here is a little subtle. We are modifying the feature
323// string with what are (currently) non-function specific overrides as it goes
324// into the LLVMTargetMachine constructor and then using the stored value in the
325// Subtarget constructor below it.
327 StringRef CPU, StringRef FS,
328 const TargetOptions &Options,
329 std::optional<Reloc::Model> RM,
330 std::optional<CodeModel::Model> CM,
331 CodeGenOpt::Level OL, bool JIT)
333 computeFSAdditions(FS, OL, TT), Options,
335 getEffectivePPCCodeModel(TT, CM, JIT), OL),
336 TLOF(createTLOF(getTargetTriple())),
337 TargetABI(computeTargetABI(TT, Options)),
338 Endianness(isLittleEndianTriple(TT) ? Endian::LITTLE : Endian::BIG) {
339 initAsmInfo();
340}
341
343
344const PPCSubtarget *
346 Attribute CPUAttr = F.getFnAttribute("target-cpu");
347 Attribute TuneAttr = F.getFnAttribute("tune-cpu");
348 Attribute FSAttr = F.getFnAttribute("target-features");
349
350 std::string CPU =
351 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
352 std::string TuneCPU =
353 TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
354 std::string FS =
355 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
356
357 // FIXME: This is related to the code below to reset the target options,
358 // we need to know whether or not the soft float flag is set on the
359 // function before we can generate a subtarget. We also need to use
360 // it as a key for the subtarget since that can be the only difference
361 // between two functions.
362 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
363 // If the soft float attribute is set on the function turn on the soft float
364 // subtarget feature.
365 if (SoftFloat)
366 FS += FS.empty() ? "-hard-float" : ",-hard-float";
367
368 auto &I = SubtargetMap[CPU + TuneCPU + FS];
369 if (!I) {
370 // This needs to be done before we create a new subtarget since any
371 // creation will depend on the TM and the code generation flags on the
372 // function that reside in TargetOptions.
374 I = std::make_unique<PPCSubtarget>(
375 TargetTriple, CPU, TuneCPU,
376 // FIXME: It would be good to have the subtarget additions here
377 // not necessary. Anything that turns them on/off (overrides) ends
378 // up being put at the end of the feature string, but the defaults
379 // shouldn't require adding them. Fixing this means pulling Feature64Bit
380 // out of most of the target cpus in the .td file and making it set only
381 // as part of initialization via the TargetTriple.
383 }
384 return I.get();
385}
386
387//===----------------------------------------------------------------------===//
388// Pass Pipeline Configuration
389//===----------------------------------------------------------------------===//
390
391namespace {
392
393/// PPC Code Generator Pass Configuration Options.
394class PPCPassConfig : public TargetPassConfig {
395public:
396 PPCPassConfig(PPCTargetMachine &TM, PassManagerBase &PM)
397 : TargetPassConfig(TM, PM) {
398 // At any optimization level above -O0 we use the Machine Scheduler and not
399 // the default Post RA List Scheduler.
400 if (TM.getOptLevel() != CodeGenOpt::None)
401 substitutePass(&PostRASchedulerID, &PostMachineSchedulerID);
402 }
403
404 PPCTargetMachine &getPPCTargetMachine() const {
405 return getTM<PPCTargetMachine>();
406 }
407
408 void addIRPasses() override;
409 bool addPreISel() override;
410 bool addILPOpts() override;
411 bool addInstSelector() override;
412 void addMachineSSAOptimization() override;
413 void addPreRegAlloc() override;
414 void addPreSched2() override;
415 void addPreEmitPass() override;
416 void addPreEmitPass2() override;
417 // GlobalISEL
418 bool addIRTranslator() override;
419 bool addLegalizeMachineIR() override;
420 bool addRegBankSelect() override;
421 bool addGlobalInstructionSelect() override;
422
424 createMachineScheduler(MachineSchedContext *C) const override {
426 }
428 createPostMachineScheduler(MachineSchedContext *C) const override {
430 }
431};
432
433} // end anonymous namespace
434
436 return new PPCPassConfig(*this, PM);
437}
438
439void PPCPassConfig::addIRPasses() {
440 if (TM->getOptLevel() != CodeGenOpt::None)
441 addPass(createPPCBoolRetToIntPass());
442 addPass(createAtomicExpandPass());
443
444 // Lower generic MASSV routines to PowerPC subtarget-specific entries.
446
447 // Generate PowerPC target-specific entries for scalar math functions
448 // that are available in IBM MASS (scalar) library.
449 if (TM->getOptLevel() == CodeGenOpt::Aggressive &&
451 TM->Options.PPCGenScalarMASSEntries = EnablePPCGenScalarMASSEntries;
453 }
454
455 // If explicitly requested, add explicit data prefetch intrinsics.
456 if (EnablePrefetch.getNumOccurrences() > 0)
458
459 if (TM->getOptLevel() >= CodeGenOpt::Default && EnableGEPOpt) {
460 // Call SeparateConstOffsetFromGEP pass to extract constants within indices
461 // and lower a GEP with multiple indices to either arithmetic operations or
462 // multiple GEPs with single index.
464 // Call EarlyCSE pass to find and remove subexpressions in the lowered
465 // result.
466 addPass(createEarlyCSEPass());
467 // Do loop invariant code motion in case part of the lowered result is
468 // invariant.
469 addPass(createLICMPass());
470 }
471
473}
474
475bool PPCPassConfig::addPreISel() {
476 if (!DisableInstrFormPrep && getOptLevel() != CodeGenOpt::None)
477 addPass(createPPCLoopInstrFormPrepPass(getPPCTargetMachine()));
478
479 if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
481
482 return false;
483}
484
485bool PPCPassConfig::addILPOpts() {
486 addPass(&EarlyIfConverterID);
487
489 addPass(&MachineCombinerID);
490
491 return true;
492}
493
494bool PPCPassConfig::addInstSelector() {
495 // Install an instruction selector.
496 addPass(createPPCISelDag(getPPCTargetMachine(), getOptLevel()));
497
498#ifndef NDEBUG
499 if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
500 addPass(createPPCCTRLoopsVerify());
501#endif
502
503 addPass(createPPCVSXCopyPass());
504 return false;
505}
506
507void PPCPassConfig::addMachineSSAOptimization() {
508 // Run CTR loops pass before any cfg modification pass to prevent the
509 // canonical form of hardware loop from being destroied.
510 if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None)
511 addPass(createPPCCTRLoopsPass());
512
513 // PPCBranchCoalescingPass need to be done before machine sinking
514 // since it merges empty blocks.
515 if (EnableBranchCoalescing && getOptLevel() != CodeGenOpt::None)
518 // For little endian, remove where possible the vector swap instructions
519 // introduced at code generation to normalize vector element order.
520 if (TM->getTargetTriple().getArch() == Triple::ppc64le &&
523 // Reduce the number of cr-logical ops.
524 if (ReduceCRLogical && getOptLevel() != CodeGenOpt::None)
526 // Target-specific peephole cleanups performed after instruction
527 // selection.
528 if (!DisableMIPeephole) {
529 addPass(createPPCMIPeepholePass());
531 }
532}
533
534void PPCPassConfig::addPreRegAlloc() {
535 if (getOptLevel() != CodeGenOpt::None) {
539 }
540
541 // FIXME: We probably don't need to run these for -fPIE.
542 if (getPPCTargetMachine().isPositionIndependent()) {
543 // FIXME: LiveVariables should not be necessary here!
544 // PPCTLSDynamicCallPass uses LiveIntervals which previously dependent on
545 // LiveVariables. This (unnecessary) dependency has been removed now,
546 // however a stage-2 clang build fails without LiveVariables computed here.
547 addPass(&LiveVariablesID);
549 }
551 addPass(createPPCTOCRegDepsPass());
552
553 if (getOptLevel() != CodeGenOpt::None)
554 addPass(&MachinePipelinerID);
555}
556
557void PPCPassConfig::addPreSched2() {
558 if (getOptLevel() != CodeGenOpt::None)
559 addPass(&IfConverterID);
560}
561
562void PPCPassConfig::addPreEmitPass() {
564 addPass(createPPCExpandISELPass());
565
566 if (getOptLevel() != CodeGenOpt::None)
567 addPass(createPPCEarlyReturnPass());
568}
569
570void PPCPassConfig::addPreEmitPass2() {
571 // Schedule the expansion of AMOs at the last possible moment, avoiding the
572 // possibility for other passes to break the requirements for forward
573 // progress in the LL/SC block.
575 // Must run branch selection immediately preceding the asm printer.
577}
578
581 return TargetTransformInfo(PPCTTIImpl(this, F));
582}
583
585 assert(Endianness != Endian::NOT_DETECTED &&
586 "Unable to determine endianness");
587 return Endianness == Endian::LITTLE;
588}
589
591 BumpPtrAllocator &Allocator, const Function &F,
592 const TargetSubtargetInfo *STI) const {
593 return PPCFunctionInfo::create<PPCFunctionInfo>(Allocator, F, STI);
594}
595
598 "Run PowerPC PreRA specific scheduler",
600
603 "Run PowerPC PostRA specific scheduler",
605
606// Global ISEL
607bool PPCPassConfig::addIRTranslator() {
608 addPass(new IRTranslator());
609 return false;
610}
611
612bool PPCPassConfig::addLegalizeMachineIR() {
613 addPass(new Legalizer());
614 return false;
615}
616
617bool PPCPassConfig::addRegBankSelect() {
618 addPass(new RegBankSelect());
619 return false;
620}
621
622bool PPCPassConfig::addGlobalInstructionSelect() {
623 addPass(new InstructionSelect(getOptLevel()));
624 return false;
625}
static cl::opt< bool > EnableGEPOpt("aarch64-enable-gep-opt", cl::Hidden, cl::desc("Enable optimizations on complex GEPs"), cl::init(false))
This file contains the simple types necessary to represent the attributes associated with functions a...
static cl::opt< bool > DisableMIPeephole("disable-bpf-peephole", cl::Hidden, cl::desc("Disable machine peepholes for BPF"))
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
This file declares the IRTranslator pass.
static LVOptions Options
Definition: LVOptions.cpp:25
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
static cl::opt< bool > VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early", cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"))
static cl::opt< bool > EnableMachineCombinerPass("ppc-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
static bool isLittleEndianTriple(const Triple &T)
static MachineSchedRegistry PPCPostRASchedRegistry("ppc-postra", "Run PowerPC PostRA specific scheduler", createPPCPostMachineScheduler)
static cl::opt< bool > DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden, cl::desc("Disable CTR loops for PPC"))
static cl::opt< bool > DisableMIPeephole("disable-ppc-peephole", cl::Hidden, cl::desc("Disable machine peepholes for PPC"))
static cl::opt< bool > EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps", cl::desc("Add extra TOC register dependencies"), cl::init(true), cl::Hidden)
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, const TargetOptions &Options)
static cl::opt< bool > EnablePrefetch("enable-ppc-prefetching", cl::desc("enable software prefetching on PPC"), cl::init(false), cl::Hidden)
static cl::opt< bool > EnablePPCGenScalarMASSEntries("enable-ppc-gen-scalar-mass", cl::init(false), cl::desc("Enable lowering math functions to their corresponding MASS " "(scalar) entries"), cl::Hidden)
static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, const Triple &TT)
static cl::opt< bool > ReduceCRLogical("ppc-reduce-cr-logicals", cl::desc("Expand eligible cr-logical binary ops to branches"), cl::init(true), cl::Hidden)
static cl::opt< bool > EnableGEPOpt("ppc-gep-opt", cl::Hidden, cl::desc("Enable optimizations on complex GEPs"), cl::init(true))
static ScheduleDAGInstrs * createPPCPostMachineScheduler(MachineSchedContext *C)
static CodeModel::Model getEffectivePPCCodeModel(const Triple &TT, std::optional< CodeModel::Model > CM, bool JIT)
static std::string getDataLayoutString(const Triple &T)
Return the datalayout string of a subtarget.
static cl::opt< bool > DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden, cl::desc("Disable PPC loop instr form prep"))
static MachineSchedRegistry PPCPreRASchedRegistry("ppc-prera", "Run PowerPC PreRA specific scheduler", createPPCMachineScheduler)
static cl::opt< bool > DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden, cl::desc("Disable VSX Swap Removal for PPC"))
static Reloc::Model getEffectiveRelocModel(const Triple &TT, std::optional< Reloc::Model > RM)
static cl::opt< bool > EnableBranchCoalescing("enable-ppc-branch-coalesce", cl::Hidden, cl::desc("enable coalescing of duplicate branches for PPC"))
static ScheduleDAGInstrs * createPPCMachineScheduler(MachineSchedContext *C)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTarget()
This file a TargetTransformInfo::Concept conforming object specific to the PPC target machine.
const char LLVMTargetMachineRef TM
Basic Register Allocator
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains some templates that are useful if you are working with the STL at all.
Target-Independent Code Generator Pass Configuration Options pass.
This pass exposes codegen information to IR-level passes.
static std::unique_ptr< TargetLoweringObjectFile > createTLOF()
static bool is64Bit(const char *name)
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:317
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:187
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:66
static const char * getManglingComponent(const Triple &T)
Definition: DataLayout.cpp:149
This pass is responsible for selecting generic machine instructions to target-specific instructions.
This class describes a target machine that is implemented with the LLVM target-independent code gener...
MachineSchedRegistry provides a selection of available machine instruction schedulers.
Common code between 32-bit and 64-bit PowerPC targets.
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
const PPCSubtarget * getSubtargetImpl() const =delete
~PPCTargetMachine() override
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:38
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
Definition: RegBankSelect.h:91
A ScheduleDAG for scheduling lists of MachineInstr.
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:222
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with.
Definition: TargetMachine.h:97
const Triple & getTargetTriple() const
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
std::string TargetFS
Definition: TargetMachine.h:99
std::string TargetCPU
Definition: TargetMachine.h:98
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...
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.
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.
Definition: Triple.h:44
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.
Definition: CallingConv.h:34
Level
Code generation optimization level.
Definition: CodeGen.h:57
@ Default
-O2, -Os
Definition: CodeGen.h:60
@ Aggressive
-O3
Definition: CodeGen.h:61
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:445
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionPass * createPPCPreEmitPeepholePass()
Target & getThePPC64LETarget()
void initializePPCTLSDynamicCallPass(PassRegistry &)
char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
void initializePPCVSXFMAMutatePass(PassRegistry &)
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
FunctionPass * createAtomicExpandPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
Target & getThePPC32Target()
std::unique_ptr< ScheduleDAGMutation > createStoreClusterDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
FunctionPass * createPPCCTRLoopsPass()
Definition: PPCCTRLoops.cpp:93
char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
FunctionPass * createPPCTLSDynamicCallPass()
char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
Pass * createLICMPass()
Definition: LICM.cpp:359
FunctionPass * createPPCEarlyReturnPass()
void initializePPCPreEmitPeepholePass(PassRegistry &)
FunctionPass * createPPCExpandAtomicPseudoPass()
void initializePPCTOCRegDepsPass(PassRegistry &)
void initializePPCReduceCRLogicalsPass(PassRegistry &)
void initializePPCDAGToDAGISelPass(PassRegistry &)
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG,...
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
void initializePPCVSXCopyPass(PassRegistry &)
FunctionPass * createPPCVSXCopyPass()
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
FunctionPass * createPPCVSXSwapRemovalPass()
void initializePPCCTRLoopsPass(PassRegistry &)
ModulePass * createPPCLowerMASSVEntriesPass()
FunctionPass * createLoopDataPrefetchPass()
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:145
ModulePass * createPPCGenScalarMASSEntriesPass()
void initializePPCEarlyReturnPass(PassRegistry &)
void initializePPCGenScalarMASSEntriesPass(PassRegistry &)
FunctionPass * createPPCReduceCRLogicalsPass()
void initializePPCExpandAtomicPseudoPass(PassRegistry &)
FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
Target & getThePPC64Target()
void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Definition: GlobalISel.cpp:17
void initializePPCBSelPass(PassRegistry &)
char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
FunctionPass * createPPCTOCRegDepsPass()
FunctionPass * createPPCCTRLoopsVerify()
void initializePPCBranchCoalescingPass(PassRegistry &)
void initializePPCBoolRetToIntPass(PassRegistry &)
void initializePPCMIPeepholePass(PassRegistry &)
std::unique_ptr< ScheduleDAGMutation > createPowerPCMacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createPowerPCMacroFusionDAGMutation()); to PPCPassConfig::...
void initializePPCVSXSwapRemovalPass(PassRegistry &)
char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
Target & getThePPC32LETarget()
char & PPCVSXFMAMutateID
char & IfConverterID
IfConverter - This pass performs machine code if conversion.
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
FunctionPass * createPPCExpandISELPass()
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1793
std::unique_ptr< ScheduleDAGMutation > createCopyConstrainDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
FunctionPass * createPPCBranchSelectionPass()
FunctionPass * createPPCBoolRetToIntPass()
char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
FunctionPass * createHardwareLoopsLegacyPass()
Create Hardware Loop pass.
FunctionPass * createPPCMIPeepholePass()
void initializePPCExpandISELPass(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,...