LLVM 24.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/StringRef.h"
30#include "llvm/CodeGen/Passes.h"
32#include "llvm/IR/Attributes.h"
33#include "llvm/IR/DataLayout.h"
34#include "llvm/IR/Function.h"
37#include "llvm/Pass.h"
45#include <cassert>
46#include <memory>
47#include <optional>
48#include <string>
49
50using namespace llvm;
51
52
53static cl::opt<bool>
54 EnableBranchCoalescing("enable-ppc-branch-coalesce", cl::Hidden,
55 cl::desc("enable coalescing of duplicate branches for PPC"));
56static cl::
57opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden,
58 cl::desc("Disable CTR loops for PPC"));
59
60static cl::
61opt<bool> DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden,
62 cl::desc("Disable PPC loop instr form prep"));
63
64static cl::opt<bool>
65VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early",
66 cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"));
67
68static cl::
69opt<bool> DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden,
70 cl::desc("Disable VSX Swap Removal for PPC"));
71
72static cl::
73opt<bool> DisableMIPeephole("disable-ppc-peephole", cl::Hidden,
74 cl::desc("Disable machine peepholes for PPC"));
75
76static cl::opt<bool>
77EnableGEPOpt("ppc-gep-opt", cl::Hidden,
78 cl::desc("Enable optimizations on complex GEPs"),
79 cl::init(true));
80
81static cl::opt<bool>
82EnablePrefetch("enable-ppc-prefetching",
83 cl::desc("enable software prefetching on PPC"),
84 cl::init(false), cl::Hidden);
85
86static cl::opt<bool>
87EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps",
88 cl::desc("Add extra TOC register dependencies"),
89 cl::init(true), cl::Hidden);
90
91static cl::opt<bool>
92EnableMachineCombinerPass("ppc-machine-combiner",
93 cl::desc("Enable the machine combiner pass"),
94 cl::init(true), cl::Hidden);
95
96static cl::opt<bool>
97 ReduceCRLogical("ppc-reduce-cr-logicals",
98 cl::desc("Expand eligible cr-logical binary ops to branches"),
99 cl::init(true), cl::Hidden);
100
102 "enable-ppc-gen-scalar-mass", cl::init(false),
103 cl::desc("Enable lowering math functions to their corresponding MASS "
104 "(scalar) entries"),
105 cl::Hidden);
106
107static cl::opt<bool>
108 EnableGlobalMerge("ppc-global-merge", cl::Hidden, cl::init(false),
109 cl::desc("Enable the global merge pass"));
110
112 GlobalMergeMaxOffset("ppc-global-merge-max-offset", cl::Hidden,
113 cl::init(0x7fff),
114 cl::desc("Maximum global merge offset"));
115
151
153 const Triple &TT) {
154 std::string FullFS = std::string(FS);
155
156 // Make sure 64-bit features are available when CPUname is generic
157 if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le) {
158 if (!FullFS.empty())
159 FullFS = "+64bit," + FullFS;
160 else
161 FullFS = "+64bit";
162 }
163
164 if (OL >= CodeGenOptLevel::Default) {
165 if (!FullFS.empty())
166 FullFS = "+crbits," + FullFS;
167 else
168 FullFS = "+crbits";
169 }
170
171 if (OL != CodeGenOptLevel::None) {
172 if (!FullFS.empty())
173 FullFS = "+invariant-function-descriptors," + FullFS;
174 else
175 FullFS = "+invariant-function-descriptors";
176 }
177
178 if (TT.isOSAIX()) {
179 if (!FullFS.empty())
180 FullFS = "+aix," + FullFS;
181 else
182 FullFS = "+aix";
183 }
184
185 return FullFS;
186}
187
188static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
189 if (TT.isOSAIX())
190 return std::make_unique<TargetLoweringObjectFileXCOFF>();
191
192 return std::make_unique<PPC64LinuxTargetObjectFile>();
193}
194
196 const TargetOptions &Options) {
197 if (Options.MCOptions.getABIName().starts_with("elfv1"))
199 else if (Options.MCOptions.getABIName().starts_with("elfv2"))
201
202 assert(Options.MCOptions.getABIName().empty() &&
203 "Unknown target-abi option!");
204
205 switch (TT.getArch()) {
206 case Triple::ppc64le:
208 case Triple::ppc64:
209 if (TT.isPPC64ELFv2ABI())
211 else
213 default:
215 }
216}
217
219 std::optional<Reloc::Model> RM) {
220 if (TT.isOSAIX() && RM && *RM != Reloc::PIC_)
221 report_fatal_error("invalid relocation model, AIX only supports PIC",
222 false);
223
224 if (RM)
225 return *RM;
226
227 // Big Endian PPC and AIX default to PIC.
228 if (TT.getArch() == Triple::ppc64 || TT.isOSAIX())
229 return Reloc::PIC_;
230
231 // Rest are static by default.
232 return Reloc::Static;
233}
234
235static CodeModel::Model
236getEffectivePPCCodeModel(const Triple &TT, std::optional<CodeModel::Model> CM,
237 bool JIT) {
238 if (CM) {
239 if (*CM == CodeModel::Tiny)
240 report_fatal_error("Target does not support the tiny CodeModel", false);
241 if (*CM == CodeModel::Kernel)
242 report_fatal_error("Target does not support the kernel CodeModel", false);
243 return *CM;
244 }
245
246 if (JIT)
247 return CodeModel::Small;
248 if (TT.isOSAIX()) {
249 // Use large code model for 64-bit AIX by default.
250 if (TT.isArch64Bit())
251 return CodeModel::Large;
252 return CodeModel::Small;
253 }
254
255 assert(TT.isOSBinFormatELF() && "All remaining PPC OSes are ELF based.");
256
257 if (TT.isArch32Bit())
258 return CodeModel::Small;
259
260 assert(TT.isArch64Bit() && "Unsupported PPC architecture.");
261 return CodeModel::Medium;
262}
263
264
266 const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
267 ScheduleDAGMILive *DAG = ST.usePPCPreRASchedStrategy()
270 // add DAG Mutations here.
271 if (ST.hasStoreFusion())
272 DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
273 if (ST.hasFusion())
274 DAG->addMutation(createPowerPCMacroFusionDAGMutation());
275
276 return DAG;
277}
278
279static ScheduleDAGInstrs *
281 const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
282 ScheduleDAGMI *DAG = ST.usePPCPostRASchedStrategy()
285 // add DAG Mutations here.
286 if (ST.hasStoreFusion())
287 DAG->addMutation(createStoreClusterDAGMutation(DAG->TII, DAG->TRI));
288 if (ST.hasFusion())
289 DAG->addMutation(createPowerPCMacroFusionDAGMutation());
290 return DAG;
291}
292
293// The FeatureString here is a little subtle. We are modifying the feature
294// string with what are (currently) non-function specific overrides as it goes
295// into the CodeGenTargetMachineImpl constructor and then using the stored value
296// in the Subtarget constructor below it.
298 StringRef CPU, StringRef FS,
299 const TargetOptions &Options,
300 std::optional<Reloc::Model> RM,
301 std::optional<CodeModel::Model> CM,
302 CodeGenOptLevel OL, bool JIT)
304 TT.computeDataLayout(Options.MCOptions.ABIName),
305 TT, CPU, computeFSAdditions(FS, OL, TT), Options,
307 getEffectivePPCCodeModel(TT, CM, JIT), OL),
309 TargetABI(computeTargetABI(TT, Options)),
310 Endianness(TT.isLittleEndian() ? Endian::LITTLE : Endian::BIG) {
311 initAsmInfo();
312}
313
315
316const PPCSubtarget *
318 Attribute CPUAttr = F.getFnAttribute("target-cpu");
319 Attribute TuneAttr = F.getFnAttribute("tune-cpu");
320 Attribute FSAttr = F.getFnAttribute("target-features");
321
322 std::string CPU =
323 CPUAttr.isValid() ? CPUAttr.getValueAsString().str() : TargetCPU;
324 std::string TuneCPU =
325 TuneAttr.isValid() ? TuneAttr.getValueAsString().str() : CPU;
326 std::string FS =
327 FSAttr.isValid() ? FSAttr.getValueAsString().str() : TargetFS;
328
329 // FIXME: This is related to the code below to reset the target options,
330 // we need to know whether or not the soft float flag is set on the
331 // function before we can generate a subtarget. We also need to use
332 // it as a key for the subtarget since that can be the only difference
333 // between two functions.
334 bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
335 // If the soft float attribute is set on the function turn on the soft float
336 // subtarget feature.
337 if (SoftFloat)
338 FS += FS.empty() ? "-hard-float" : ",-hard-float";
339
340 auto &I = SubtargetMap[CPU + TuneCPU + FS];
341 if (!I) {
342 I = std::make_unique<PPCSubtarget>(
343 TargetTriple, CPU, TuneCPU,
344 // FIXME: It would be good to have the subtarget additions here
345 // not necessary. Anything that turns them on/off (overrides) ends
346 // up being put at the end of the feature string, but the defaults
347 // shouldn't require adding them. Fixing this means pulling Feature64Bit
348 // out of most of the target cpus in the .td file and making it set only
349 // as part of initialization via the TargetTriple.
351 }
352 return I.get();
353}
354
359
364
365//===----------------------------------------------------------------------===//
366// Pass Pipeline Configuration
367//===----------------------------------------------------------------------===//
368
369namespace {
370
371/// PPC Code Generator Pass Configuration Options.
372class PPCPassConfig : public TargetPassConfig {
373public:
374 PPCPassConfig(PPCTargetMachine &TM, PassManagerBase &PM)
375 : TargetPassConfig(TM, PM) {
376 // At any optimization level above -O0 we use the Machine Scheduler and not
377 // the default Post RA List Scheduler.
379 substitutePass(&PostRASchedulerID, &PostMachineSchedulerID);
380 }
381
382 PPCTargetMachine &getPPCTargetMachine() const {
384 }
385
386 void addIRPasses() override;
387 bool addPreISel() override;
388 bool addILPOpts() override;
389 bool addInstSelector() override;
390 void addMachineSSAOptimization() override;
391 void addPreRegAlloc() override;
392 void addPreSched2() override;
393 void addPreEmitPass() override;
394 void addPreEmitPass2() override;
395 // GlobalISEL
396 bool addIRTranslator() override;
397 bool addLegalizeMachineIR() override;
398 bool addRegBankSelect() override;
399 bool addGlobalInstructionSelect() override;
400};
401
402} // end anonymous namespace
403
405 return new PPCPassConfig(*this, PM);
406}
407
408void PPCPassConfig::addIRPasses() {
409 if (TM->getOptLevel() != CodeGenOptLevel::None)
410 addPass(createPPCBoolRetToIntPass());
412
413 // Lower generic MASSV routines to PowerPC subtarget-specific entries.
415
416 // Generate PowerPC target-specific entries for scalar math functions
417 // that are available in IBM MASS (scalar) library.
418 if (TM->getOptLevel() == CodeGenOptLevel::Aggressive &&
420 TM->Options.PPCGenScalarMASSEntries = EnablePPCGenScalarMASSEntries;
422 }
423
424 // If explicitly requested, add explicit data prefetch intrinsics.
425 if (EnablePrefetch.getNumOccurrences() > 0)
427
428 if (TM->getOptLevel() >= CodeGenOptLevel::Default && EnableGEPOpt) {
429 // Call SeparateConstOffsetFromGEP pass to extract constants within indices
430 // and lower a GEP with multiple indices to either arithmetic operations or
431 // multiple GEPs with single index.
433 // Call EarlyCSE pass to find and remove subexpressions in the lowered
434 // result.
435 addPass(createEarlyCSEPass());
436 // Do loop invariant code motion in case part of the lowered result is
437 // invariant.
438 addPass(createLICMPass());
439 }
440
441 if (TM->getTargetTriple().isOSAIX())
443
445}
446
447bool PPCPassConfig::addPreISel() {
448 // The GlobalMerge pass is intended to be on by default on AIX.
449 // Specifying the command line option overrides the AIX default.
452 : getOptLevel() != CodeGenOptLevel::None)
453 addPass(createGlobalMergePass(TM, GlobalMergeMaxOffset, false, false, true,
454 true));
455
456 if (!DisableInstrFormPrep && getOptLevel() != CodeGenOptLevel::None)
457 addPass(createPPCLoopInstrFormPrepPass(getPPCTargetMachine()));
458
459 if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None)
461
462 return false;
463}
464
465bool PPCPassConfig::addILPOpts() {
466 addPass(&EarlyIfConverterLegacyID);
467
469 addPass(&MachineCombinerID);
470
471 return true;
472}
473
474bool PPCPassConfig::addInstSelector() {
475 // Install an instruction selector.
476 addPass(createPPCISelDag(getPPCTargetMachine(), getOptLevel()));
477
478#ifndef NDEBUG
479 if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None)
480 addPass(createPPCCTRLoopsVerify());
481#endif
482
483 addPass(createPPCVSXWACCCopyPass());
484 return false;
485}
486
487void PPCPassConfig::addMachineSSAOptimization() {
488 // Run CTR loops pass before any cfg modification pass to prevent the
489 // canonical form of hardware loop from being destroied.
490 if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None)
491 addPass(createPPCCTRLoopsPass());
492
493 // PPCBranchCoalescingPass need to be done before machine sinking
494 // since it merges empty blocks.
495 if (EnableBranchCoalescing && getOptLevel() != CodeGenOptLevel::None)
498 // For little endian, remove where possible the vector swap instructions
499 // introduced at code generation to normalize vector element order.
500 if (TM->getTargetTriple().getArch() == Triple::ppc64le &&
503 // Reduce the number of cr-logical ops.
504 if (ReduceCRLogical && getOptLevel() != CodeGenOptLevel::None)
506 // Target-specific peephole cleanups performed after instruction
507 // selection.
508 if (!DisableMIPeephole) {
509 addPass(createPPCMIPeepholePass());
511 }
512}
513
514void PPCPassConfig::addPreRegAlloc() {
515 if (getOptLevel() != CodeGenOptLevel::None) {
519 }
520
521 // FIXME: We probably don't need to run these for -fPIE.
522 if (getPPCTargetMachine().isPositionIndependent()) {
523 // FIXME: LiveVariables should not be necessary here!
524 // PPCTLSDynamicCallPass uses LiveIntervals which previously dependent on
525 // LiveVariables. This (unnecessary) dependency has been removed now,
526 // however a stage-2 clang build fails without LiveVariables computed here.
527 addPass(&LiveVariablesID);
529 }
531 addPass(createPPCTOCRegDepsPass());
532
533 if (getOptLevel() != CodeGenOptLevel::None)
534 addPass(&MachinePipelinerID);
535}
536
537void PPCPassConfig::addPreSched2() {
538 if (getOptLevel() != CodeGenOptLevel::None)
539 addPass(&IfConverterID);
540}
541
542void PPCPassConfig::addPreEmitPass() {
544
545 if (getOptLevel() != CodeGenOptLevel::None)
546 addPass(createPPCEarlyReturnPass());
547}
548
549void PPCPassConfig::addPreEmitPass2() {
550 // Schedule the expansion of AMOs at the last possible moment, avoiding the
551 // possibility for other passes to break the requirements for forward
552 // progress in the LL/SC block.
554 // Must run branch selection immediately preceding the asm printer.
556}
557
560 return TargetTransformInfo(std::make_unique<PPCTTIImpl>(this, F));
561}
562
564 assert(Endianness != Endian::NOT_DETECTED &&
565 "Unable to determine endianness");
566 return Endianness == Endian::LITTLE;
567}
568
574
577 "Run PowerPC PreRA specific scheduler",
579
582 "Run PowerPC PostRA specific scheduler",
584
585// Global ISEL
586bool PPCPassConfig::addIRTranslator() {
587 addPass(new IRTranslatorLegacy());
588 return false;
589}
590
591bool PPCPassConfig::addLegalizeMachineIR() {
592 addPass(new LegalizerLegacy());
593 return false;
594}
595
596bool PPCPassConfig::addRegBankSelect() {
597 addPass(new RegBankSelectLegacy());
598 return false;
599}
600
601bool PPCPassConfig::addGlobalInstructionSelect() {
602 addPass(new InstructionSelectLegacy(getOptLevel()));
603 return false;
604}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > EnableGEPOpt("aarch64-enable-gep-opt", cl::Hidden, cl::desc("Enable optimizations on complex GEPs"), cl::init(false))
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
static Reloc::Model getEffectiveRelocModel()
This file contains the simple types necessary to represent the attributes associated with functions a...
cl::opt< bool > DisableMIPeephole
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_ABI
Definition Compiler.h:215
#define LLVM_EXTERNAL_VISIBILITY
Definition Compiler.h:132
static cl::opt< unsigned > GlobalMergeMaxOffset("global-merge-max-offset", cl::Hidden, cl::desc("Set maximum offset for global merge pass"), cl::init(0))
static cl::opt< bool > EnableGlobalMerge("enable-global-merge", cl::Hidden, cl::desc("Enable the global merge pass"), cl::init(true))
This file declares the IRTranslator pass.
static LVOptions Options
Definition LVOptions.cpp:25
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define T
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 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)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTarget()
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 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 cl::opt< bool > DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden, cl::desc("Disable PPC loop instr form prep"))
static std::string computeFSAdditions(StringRef FS, CodeGenOptLevel OL, const Triple &TT)
static MachineSchedRegistry PPCPreRASchedRegistry("ppc-prera", "Run PowerPC PreRA specific scheduler", createPPCMachineScheduler)
static cl::opt< unsigned > GlobalMergeMaxOffset("ppc-global-merge-max-offset", cl::Hidden, cl::init(0x7fff), cl::desc("Maximum global merge offset"))
static cl::opt< bool > DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden, cl::desc("Disable VSX Swap Removal for PPC"))
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)
static cl::opt< bool > EnableGlobalMerge("ppc-global-merge", cl::Hidden, cl::init(false), cl::desc("Enable the global merge pass"))
This file a TargetTransformInfoImplBase conforming object specific to the PPC target machine.
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
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...
Definition Attributes.h:105
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.
Definition Attributes.h:261
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
This pass is responsible for selecting generic machine instructions to target-specific instructions.
MachineSchedRegistry provides a selection of available machine instruction schedulers.
Common code between 32-bit and 64-bit PowerPC targets.
ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const override
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
const PPCSubtarget * getSubtargetImpl() const =delete
~PPCTargetMachine() override
PPCTargetMachine(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.
ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const override
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
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...
static LLVM_ABI 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.
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...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::string str() const
Get the contents as an std::string.
Definition StringRef.h:222
CodeGenOptLevel getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
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
TargetOptions Options
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:48
int getNumOccurrences() const
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
template class LLVM_TEMPLATE_ABI opt< bool >
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
ScheduleDAGMILive * createSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
FunctionPass * createPPCPreEmitPeepholePass()
Target & getThePPC64LETarget()
void initializePPCTLSDynamicCallPass(PassRegistry &)
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
void initializePPCVSXFMAMutatePass(PassRegistry &)
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
LLVM_ABI Pass * createGlobalMergePass(const TargetMachine *TM, unsigned MaximalOffset, bool OnlyOptimizeForSize=false, bool MergeExternalByDefault=false, bool MergeConstantByDefault=false, bool MergeConstAggressiveByDefault=false)
GlobalMerge - This pass merges internal (by default) globals into structs to enable reuse of a base p...
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
Target & getThePPC32Target()
FunctionPass * createPPCCTRLoopsPass()
LLVM_ABI char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
FunctionPass * createPPCTLSDynamicCallPass()
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
LLVM_ABI Pass * createLICMPass()
Definition LICM.cpp:394
FunctionPass * createPPCEarlyReturnPass()
void initializePPCPreEmitPeepholePass(PassRegistry &)
LLVM_ABI char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
FunctionPass * createPPCExpandAtomicPseudoPass()
void initializePPCTOCRegDepsPass(PassRegistry &)
void initializePPCReduceCRLogicalsPass(PassRegistry &)
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)
ModulePass * createPPCPrepareIFuncsOnAIXPass()
ScheduleDAGMI * createSchedPostRA(MachineSchedContext *C)
Create a generic scheduler with no vreg liveness or DAG mutation passes.
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
FunctionPass * createPPCVSXSwapRemovalPass()
void initializePPCAIXAsmPrinterPass(PassRegistry &)
void initializePPCCTRLoopsPass(PassRegistry &)
ModulePass * createPPCLowerMASSVEntriesPass()
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createStoreClusterDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI, bool ReorderWhileClustering=false)
If ReorderWhileClustering is set to true, no attempt will be made to reduce reordering due to store c...
LLVM_ABI FunctionPass * createLoopDataPrefetchPass()
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
void initializePPCDAGToDAGISelLegacyPass(PassRegistry &)
ModulePass * createPPCGenScalarMASSEntriesPass()
void initializePPCEarlyReturnPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
Definition CodeGen.h:149
@ Default
-O2, -Os, -Oz
Definition CodeGen.h:152
void initializePPCGenScalarMASSEntriesPass(PassRegistry &)
FunctionPass * createPPCReduceCRLogicalsPass()
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOptLevel OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG,...
void initializePPCExpandAtomicPseudoPass(PassRegistry &)
LLVM_ABI FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass
Target & getThePPC64Target()
void initializePPCVSXWACCCopyPass(PassRegistry &)
void initializePPCLinuxAsmPrinterPass(PassRegistry &)
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
void initializePPCBSelPass(PassRegistry &)
LLVM_ABI 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 PPCTargetMachin...
void initializePPCVSXSwapRemovalPass(PassRegistry &)
LLVM_ABI char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
Target & getThePPC32LETarget()
char & PPCVSXFMAMutateID
LLVM_ABI char & IfConverterID
IfConverter - This pass performs machine code if conversion.
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
FunctionPass * createPPCVSXWACCCopyPass()
LLVM_ABI char & TwoAddressInstructionPassID
TwoAddressInstruction - This pass reduces two-address instructions to use two operands.
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.
Definition Allocator.h:390
LLVM_ABI FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
void initializePPCPrepareIFuncsOnAIXPass(PassRegistry &)
FunctionPass * createPPCBranchSelectionPass()
FunctionPass * createPPCBoolRetToIntPass()
LLVM_ABI char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
LLVM_ABI FunctionPass * createHardwareLoopsLegacyPass()
Create Hardware Loop pass.
FunctionPass * createPPCMIPeepholePass()
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,...