LLVM  10.0.0
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"
16 #include "PPCMachineScheduler.h"
17 #include "PPCSubtarget.h"
18 #include "PPCTargetObjectFile.h"
19 #include "PPCTargetTransformInfo.h"
21 #include "llvm/ADT/Optional.h"
22 #include "llvm/ADT/STLExtras.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/ADT/Triple.h"
26 #include "llvm/CodeGen/Passes.h"
29 #include "llvm/IR/Attributes.h"
30 #include "llvm/IR/DataLayout.h"
31 #include "llvm/IR/Function.h"
32 #include "llvm/Pass.h"
33 #include "llvm/Support/CodeGen.h"
38 #include "llvm/Transforms/Scalar.h"
39 #include <cassert>
40 #include <memory>
41 #include <string>
42 
43 using namespace llvm;
44 
45 
46 static cl::opt<bool>
47  EnableBranchCoalescing("enable-ppc-branch-coalesce", cl::Hidden,
48  cl::desc("enable coalescing of duplicate branches for PPC"));
49 static cl::
50 opt<bool> DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden,
51  cl::desc("Disable CTR loops for PPC"));
52 
53 static cl::
54 opt<bool> DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden,
55  cl::desc("Disable PPC loop instr form prep"));
56 
57 static cl::opt<bool>
58 VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early",
59  cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"));
60 
61 static cl::
62 opt<bool> DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden,
63  cl::desc("Disable VSX Swap Removal for PPC"));
64 
65 static cl::
66 opt<bool> DisableQPXLoadSplat("disable-ppc-qpx-load-splat", cl::Hidden,
67  cl::desc("Disable QPX load splat simplification"));
68 
69 static cl::
70 opt<bool> DisableMIPeephole("disable-ppc-peephole", cl::Hidden,
71  cl::desc("Disable machine peepholes for PPC"));
72 
73 static cl::opt<bool>
74 EnableGEPOpt("ppc-gep-opt", cl::Hidden,
75  cl::desc("Enable optimizations on complex GEPs"),
76  cl::init(true));
77 
78 static cl::opt<bool>
79 EnablePrefetch("enable-ppc-prefetching",
80  cl::desc("enable software prefetching on PPC"),
81  cl::init(false), cl::Hidden);
82 
83 static cl::opt<bool>
84 EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps",
85  cl::desc("Add extra TOC register dependencies"),
86  cl::init(true), cl::Hidden);
87 
88 static cl::opt<bool>
89 EnableMachineCombinerPass("ppc-machine-combiner",
90  cl::desc("Enable the machine combiner pass"),
91  cl::init(true), cl::Hidden);
92 
93 static cl::opt<bool>
94  ReduceCRLogical("ppc-reduce-cr-logicals",
95  cl::desc("Expand eligible cr-logical binary ops to branches"),
96  cl::init(true), cl::Hidden);
98  // Register the targets
102 
104 #ifndef NDEBUG
106 #endif
123 }
124 
125 /// Return the datalayout string of a subtarget.
126 static std::string getDataLayoutString(const Triple &T) {
127  bool is64Bit = T.getArch() == Triple::ppc64 || T.getArch() == Triple::ppc64le;
128  std::string Ret;
129 
130  // Most PPC* platforms are big endian, PPC64LE is little endian.
131  if (T.getArch() == Triple::ppc64le)
132  Ret = "e";
133  else
134  Ret = "E";
135 
137 
138  // PPC32 has 32 bit pointers. The PS3 (OS Lv2) is a PPC64 machine with 32 bit
139  // pointers.
140  if (!is64Bit || T.getOS() == Triple::Lv2)
141  Ret += "-p:32:32";
142 
143  // Note, the alignment values for f64 and i64 on ppc64 in Darwin
144  // documentation are wrong; these are correct (i.e. "what gcc does").
145  if (is64Bit || !T.isOSDarwin())
146  Ret += "-i64:64";
147  else
148  Ret += "-f64:32:64";
149 
150  // PPC64 has 32 and 64 bit registers, PPC32 has only 32 bit ones.
151  if (is64Bit)
152  Ret += "-n32:64";
153  else
154  Ret += "-n32";
155 
156  return Ret;
157 }
158 
160  const Triple &TT) {
161  std::string FullFS = FS;
162 
163  // Make sure 64-bit features are available when CPUname is generic
164  if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le) {
165  if (!FullFS.empty())
166  FullFS = "+64bit," + FullFS;
167  else
168  FullFS = "+64bit";
169  }
170 
171  if (OL >= CodeGenOpt::Default) {
172  if (!FullFS.empty())
173  FullFS = "+crbits," + FullFS;
174  else
175  FullFS = "+crbits";
176  }
177 
178  if (OL != CodeGenOpt::None) {
179  if (!FullFS.empty())
180  FullFS = "+invariant-function-descriptors," + FullFS;
181  else
182  FullFS = "+invariant-function-descriptors";
183  }
184 
185  return FullFS;
186 }
187 
188 static std::unique_ptr<TargetLoweringObjectFile> createTLOF(const Triple &TT) {
189  if (TT.isOSDarwin())
190  return std::make_unique<TargetLoweringObjectFileMachO>();
191 
192  if (TT.isOSAIX())
193  return std::make_unique<TargetLoweringObjectFileXCOFF>();
194 
195  return std::make_unique<PPC64LinuxTargetObjectFile>();
196 }
197 
199  const TargetOptions &Options) {
200  if (TT.isOSDarwin())
201  report_fatal_error("Darwin is no longer supported for PowerPC");
202 
203  if (Options.MCOptions.getABIName().startswith("elfv1"))
205  else if (Options.MCOptions.getABIName().startswith("elfv2"))
207 
208  assert(Options.MCOptions.getABIName().empty() &&
209  "Unknown target-abi option!");
210 
211  if (TT.isMacOSX())
213 
214  switch (TT.getArch()) {
215  case Triple::ppc64le:
217  case Triple::ppc64:
219  default:
221  }
222 }
223 
226  if (RM.hasValue())
227  return *RM;
228 
229  // Darwin defaults to dynamic-no-pic.
230  if (TT.isOSDarwin())
231  return Reloc::DynamicNoPIC;
232 
233  // Big Endian PPC is PIC by default.
234  if (TT.getArch() == Triple::ppc64)
235  return Reloc::PIC_;
236 
237  // Rest are static by default.
238  return Reloc::Static;
239 }
240 
243  bool JIT) {
244  if (CM) {
245  if (*CM == CodeModel::Tiny)
246  report_fatal_error("Target does not support the tiny CodeModel", false);
247  if (*CM == CodeModel::Kernel)
248  report_fatal_error("Target does not support the kernel CodeModel", false);
249  return *CM;
250  }
251 
252  if (JIT)
253  return CodeModel::Small;
254  if (TT.isOSAIX())
255  return CodeModel::Small;
256 
257  assert(TT.isOSBinFormatELF() && "All remaining PPC OSes are ELF based.");
258 
259  if (TT.isArch32Bit())
260  return CodeModel::Small;
261 
262  assert(TT.isArch64Bit() && "Unsupported PPC architecture.");
263  return CodeModel::Medium;
264 }
265 
266 
268  const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
269  ScheduleDAGMILive *DAG =
271  std::make_unique<PPCPreRASchedStrategy>(C) :
272  std::make_unique<GenericScheduler>(C));
273  // add DAG Mutations here.
274  DAG->addMutation(createCopyConstrainDAGMutation(DAG->TII, DAG->TRI));
275  return DAG;
276 }
277 
280  const PPCSubtarget &ST = C->MF->getSubtarget<PPCSubtarget>();
281  ScheduleDAGMI *DAG =
283  std::make_unique<PPCPostRASchedStrategy>(C) :
284  std::make_unique<PostGenericScheduler>(C), true);
285  // add DAG Mutations here.
286  return DAG;
287 }
288 
289 // The FeatureString here is a little subtle. We are modifying the feature
290 // string with what are (currently) non-function specific overrides as it goes
291 // into the LLVMTargetMachine constructor and then using the stored value in the
292 // Subtarget constructor below it.
294  StringRef CPU, StringRef FS,
295  const TargetOptions &Options,
298  CodeGenOpt::Level OL, bool JIT)
299  : LLVMTargetMachine(T, getDataLayoutString(TT), TT, CPU,
300  computeFSAdditions(FS, OL, TT), Options,
301  getEffectiveRelocModel(TT, RM),
302  getEffectivePPCCodeModel(TT, CM, JIT), OL),
303  TLOF(createTLOF(getTargetTriple())),
304  TargetABI(computeTargetABI(TT, Options)) {
305  initAsmInfo();
306 }
307 
309 
310 const PPCSubtarget *
312  Attribute CPUAttr = F.getFnAttribute("target-cpu");
313  Attribute FSAttr = F.getFnAttribute("target-features");
314 
315  std::string CPU = !CPUAttr.hasAttribute(Attribute::None)
316  ? CPUAttr.getValueAsString().str()
317  : TargetCPU;
318  std::string FS = !FSAttr.hasAttribute(Attribute::None)
319  ? FSAttr.getValueAsString().str()
320  : TargetFS;
321 
322  // FIXME: This is related to the code below to reset the target options,
323  // we need to know whether or not the soft float flag is set on the
324  // function before we can generate a subtarget. We also need to use
325  // it as a key for the subtarget since that can be the only difference
326  // between two functions.
327  bool SoftFloat =
328  F.getFnAttribute("use-soft-float").getValueAsString() == "true";
329  // If the soft float attribute is set on the function turn on the soft float
330  // subtarget feature.
331  if (SoftFloat)
332  FS += FS.empty() ? "-hard-float" : ",-hard-float";
333 
334  auto &I = SubtargetMap[CPU + FS];
335  if (!I) {
336  // This needs to be done before we create a new subtarget since any
337  // creation will depend on the TM and the code generation flags on the
338  // function that reside in TargetOptions.
340  I = std::make_unique<PPCSubtarget>(
341  TargetTriple, CPU,
342  // FIXME: It would be good to have the subtarget additions here
343  // not necessary. Anything that turns them on/off (overrides) ends
344  // up being put at the end of the feature string, but the defaults
345  // shouldn't require adding them. Fixing this means pulling Feature64Bit
346  // out of most of the target cpus in the .td file and making it set only
347  // as part of initialization via the TargetTriple.
349  }
350  return I.get();
351 }
352 
353 //===----------------------------------------------------------------------===//
354 // Pass Pipeline Configuration
355 //===----------------------------------------------------------------------===//
356 
357 namespace {
358 
359 /// PPC Code Generator Pass Configuration Options.
360 class PPCPassConfig : public TargetPassConfig {
361 public:
362  PPCPassConfig(PPCTargetMachine &TM, PassManagerBase &PM)
363  : TargetPassConfig(TM, PM) {
364  // At any optimization level above -O0 we use the Machine Scheduler and not
365  // the default Post RA List Scheduler.
366  if (TM.getOptLevel() != CodeGenOpt::None)
367  substitutePass(&PostRASchedulerID, &PostMachineSchedulerID);
368  }
369 
370  PPCTargetMachine &getPPCTargetMachine() const {
371  return getTM<PPCTargetMachine>();
372  }
373 
374  void addIRPasses() override;
375  bool addPreISel() override;
376  bool addILPOpts() override;
377  bool addInstSelector() override;
378  void addMachineSSAOptimization() override;
379  void addPreRegAlloc() override;
380  void addPreSched2() override;
381  void addPreEmitPass() override;
383  createMachineScheduler(MachineSchedContext *C) const override {
384  return createPPCMachineScheduler(C);
385  }
387  createPostMachineScheduler(MachineSchedContext *C) const override {
389  }
390 };
391 
392 } // end anonymous namespace
393 
395  return new PPCPassConfig(*this, PM);
396 }
397 
398 void PPCPassConfig::addIRPasses() {
399  if (TM->getOptLevel() != CodeGenOpt::None)
400  addPass(createPPCBoolRetToIntPass());
401  addPass(createAtomicExpandPass());
402 
403  // Lower generic MASSV routines to PowerPC subtarget-specific entries.
405 
406  // For the BG/Q (or if explicitly requested), add explicit data prefetch
407  // intrinsics.
408  bool UsePrefetching = TM->getTargetTriple().getVendor() == Triple::BGQ &&
410  if (EnablePrefetch.getNumOccurrences() > 0)
411  UsePrefetching = EnablePrefetch;
412  if (UsePrefetching)
413  addPass(createLoopDataPrefetchPass());
414 
415  if (TM->getOptLevel() >= CodeGenOpt::Default && EnableGEPOpt) {
416  // Call SeparateConstOffsetFromGEP pass to extract constants within indices
417  // and lower a GEP with multiple indices to either arithmetic operations or
418  // multiple GEPs with single index.
420  // Call EarlyCSE pass to find and remove subexpressions in the lowered
421  // result.
422  addPass(createEarlyCSEPass());
423  // Do loop invariant code motion in case part of the lowered result is
424  // invariant.
425  addPass(createLICMPass());
426  }
427 
429 }
430 
431 bool PPCPassConfig::addPreISel() {
433  addPass(createPPCLoopInstrFormPrepPass(getPPCTargetMachine()));
434 
436  addPass(createHardwareLoopsPass());
437 
438  return false;
439 }
440 
441 bool PPCPassConfig::addILPOpts() {
442  addPass(&EarlyIfConverterID);
443 
445  addPass(&MachineCombinerID);
446 
447  return true;
448 }
449 
450 bool PPCPassConfig::addInstSelector() {
451  // Install an instruction selector.
452  addPass(createPPCISelDag(getPPCTargetMachine(), getOptLevel()));
453 
454 #ifndef NDEBUG
456  addPass(createPPCCTRLoopsVerify());
457 #endif
458 
459  addPass(createPPCVSXCopyPass());
460  return false;
461 }
462 
463 void PPCPassConfig::addMachineSSAOptimization() {
464  // PPCBranchCoalescingPass need to be done before machine sinking
465  // since it merges empty blocks.
469  // For little endian, remove where possible the vector swap instructions
470  // introduced at code generation to normalize vector element order.
471  if (TM->getTargetTriple().getArch() == Triple::ppc64le &&
473  addPass(createPPCVSXSwapRemovalPass());
474  // Reduce the number of cr-logical ops.
477  // Target-specific peephole cleanups performed after instruction
478  // selection.
479  if (!DisableMIPeephole) {
480  addPass(createPPCMIPeepholePass());
482  }
483 }
484 
485 void PPCPassConfig::addPreRegAlloc() {
486  if (getOptLevel() != CodeGenOpt::None) {
490  }
491 
492  // FIXME: We probably don't need to run these for -fPIE.
493  if (getPPCTargetMachine().isPositionIndependent()) {
494  // FIXME: LiveVariables should not be necessary here!
495  // PPCTLSDynamicCallPass uses LiveIntervals which previously dependent on
496  // LiveVariables. This (unnecessary) dependency has been removed now,
497  // however a stage-2 clang build fails without LiveVariables computed here.
498  addPass(&LiveVariablesID, false);
499  addPass(createPPCTLSDynamicCallPass());
500  }
502  addPass(createPPCTOCRegDepsPass());
503 
504  if (getOptLevel() != CodeGenOpt::None)
505  addPass(&MachinePipelinerID);
506 }
507 
508 void PPCPassConfig::addPreSched2() {
509  if (getOptLevel() != CodeGenOpt::None) {
510  addPass(&IfConverterID);
511 
512  // This optimization must happen after anything that might do store-to-load
513  // forwarding. Here we're after RA (and, thus, when spills are inserted)
514  // but before post-RA scheduling.
515  if (!DisableQPXLoadSplat)
516  addPass(createPPCQPXLoadSplatPass());
517  }
518 }
519 
520 void PPCPassConfig::addPreEmitPass() {
521  addPass(createPPCPreEmitPeepholePass());
522  addPass(createPPCExpandISELPass());
523 
524  if (getOptLevel() != CodeGenOpt::None)
525  addPass(createPPCEarlyReturnPass(), false);
526  // Must run branch selection immediately preceding the asm printer.
527  addPass(createPPCBranchSelectionPass(), false);
528 }
529 
532  return TargetTransformInfo(PPCTTIImpl(this, F));
533 }
534 
536 PPCPreRASchedRegistry("ppc-prera",
537  "Run PowerPC PreRA specific scheduler",
539 
541 PPCPostRASchedRegistry("ppc-postra",
542  "Run PowerPC PostRA specific scheduler",
void initializePPCTOCRegDepsPass(PassRegistry &)
void initializePPCVSXCopyPass(PassRegistry &)
uint64_t CallInst * C
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (macOS, iOS, tvOS or watchOS).
Definition: Triple.h:482
static MachineSchedRegistry PPCPreRASchedRegistry("ppc-prera", "Run PowerPC PreRA specific scheduler", createPPCMachineScheduler)
char & MachineCombinerID
This pass performs instruction combining using trace metrics to estimate critical-path and resource d...
void initializePPCLoopInstrFormPrepPass(PassRegistry &)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:239
MCTargetOptions MCOptions
Machine level options.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
Definition: Triple.h:454
FunctionPass * createPPCVSXSwapRemovalPass()
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
void initializePPCCTRLoopsVerifyPass(PassRegistry &)
bool isOSBinFormatELF() const
Tests whether the OS uses the ELF binary format.
Definition: Triple.h:624
Triple TargetTriple
Triple string, CPU name, and target feature strings the TargetMachine instance is created with...
Definition: TargetMachine.h:84
void initializePPCTLSDynamicCallPass(PassRegistry &)
OSType getOS() const
getOS - Get the parsed operating system type of this triple.
Definition: Triple.h:306
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:277
static cl::opt< bool > DisableQPXLoadSplat("disable-ppc-qpx-load-splat", cl::Hidden, cl::desc("Disable QPX load splat simplification"))
void initializePPCQPXLoadSplatPass(PassRegistry &)
Target & getThePPC32Target()
static cl::opt< bool > EnableMachineCombinerPass("ppc-machine-combiner", cl::desc("Enable the machine combiner pass"), cl::init(true), cl::Hidden)
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
char & EarlyIfConverterID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions...
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
void initializePPCMIPeepholePass(PassRegistry &)
F(f)
char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, const Triple &TT)
MachineSchedRegistry provides a selection of available machine instruction schedulers.
char & PPCVSXFMAMutateID
static CodeModel::Model getEffectivePPCCodeModel(const Triple &TT, Optional< CodeModel::Model > CM, bool JIT)
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form...
ScheduleDAGMI is an implementation of ScheduleDAGInstrs that simply schedules machine instructions ac...
static const char * getManglingComponent(const Triple &T)
Definition: DataLayout.cpp:151
LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTarget()
FunctionPass * createPPCTLSDynamicCallPass()
static cl::opt< bool > DisableVSXSwapRemoval("disable-ppc-vsx-swap-removal", cl::Hidden, cl::desc("Disable VSX Swap Removal for PPC"))
ScheduleDAGMILive is an implementation of ScheduleDAGInstrs that schedules machine instructions while...
FunctionPass * createLoopDataPrefetchPass()
FunctionPass * createHardwareLoopsPass()
Create Hardware Loop pass.
static cl::opt< bool > ReduceCRLogical("ppc-reduce-cr-logicals", cl::desc("Expand eligible cr-logical binary ops to branches"), cl::init(true), cl::Hidden)
void resetTargetOptions(const Function &F) const
Reset the target options based on the function&#39;s attributes.
FunctionPass * createPPCTOCRegDepsPass()
void initializePPCBSelPass(PassRegistry &)
ModulePass * createPPCLowerMASSVEntriesPass()
This file a TargetTransformInfo::Concept conforming object specific to the PPC target machine...
static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, const TargetOptions &Options)
This file contains the simple types necessary to represent the attributes associated with functions a...
No attributes have been set.
Definition: Attributes.h:72
void initializePPCReduceCRLogicalsPass(PassRegistry &)
void initializePPCBranchCoalescingPass(PassRegistry &)
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:147
Target-Independent Code Generator Pass Configuration Options.
FunctionPass * createPPCReduceCRLogicalsPass()
RegisterTargetMachine - Helper template for registering a target machine implementation, for use in the target machine initialization function.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:297
bool isArch32Bit() const
Test whether the architecture is 32-bit.
Definition: Triple.cpp:1302
FunctionPass * createPPCBranchCoalescingPass()
createPPCBranchCoalescingPass - returns an instance of the Branch Coalescing Pass ...
static MachineSchedRegistry PPCPostRASchedRegistry("ppc-postra", "Run PowerPC PostRA specific scheduler", createPPCPostMachineScheduler)
FunctionPass * createPPCCTRLoopsVerify()
char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
static ScheduleDAGInstrs * createPPCMachineScheduler(MachineSchedContext *C)
FunctionPass * createPPCBoolRetToIntPass()
Target & getThePPC64Target()
void initializePPCVSXSwapRemovalPass(PassRegistry &)
FunctionPass * createPPCBranchSelectionPass()
char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
void initializePPCBoolRetToIntPass(PassRegistry &)
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:435
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:235
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const PPCSubtarget * getSubtargetImpl() const =delete
CodeGenOpt::Level getOptLevel() const
Returns the optimization level: None, Less, Default, or Aggressive.
FunctionPass * createPPCEarlyReturnPass()
static cl::opt< bool > VSXFMAMutateEarly("schedule-ppc-vsx-fma-mutation-early", cl::Hidden, cl::desc("Schedule VSX FMA instruction mutation early"))
~PPCTargetMachine() override
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
static cl::opt< bool > DisableMIPeephole("disable-ppc-peephole", cl::Hidden, cl::desc("Disable machine peepholes for PPC"))
void initializePPCVSXFMAMutatePass(PassRegistry &)
Pass * createLICMPass()
Definition: LICM.cpp:316
This class describes a target machine that is implemented with the LLVM target-independent code gener...
const Triple & getTargetTriple() const
Common code between 32-bit and 64-bit PowerPC targets.
static cl::opt< bool > EnablePrefetch("enable-ppc-prefetching", cl::desc("enable software prefetching on PPC"), cl::init(false), cl::Hidden)
void initializePPCEarlyReturnPass(PassRegistry &)
FunctionPass * createPPCVSXCopyPass()
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
bool isOSAIX() const
Tests whether the OS is AIX.
Definition: Triple.h:619
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
char & PostRASchedulerID
createPostRAScheduler - This pass performs post register allocation scheduling.
void initializePPCExpandISELPass(PassRegistry &)
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
static ScheduleDAGInstrs * createPPCPostMachineScheduler(MachineSchedContext *C)
char & MachinePipelinerID
This pass performs software pipelining on machine instructions.
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:130
std::unique_ptr< ScheduleDAGMutation > createCopyConstrainDAGMutation(const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
static cl::opt< bool > EnableGEPOpt("ppc-gep-opt", cl::Hidden, cl::desc("Enable optimizations on complex GEPs"), cl::init(true))
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
void initializePPCLowerMASSVEntriesPass(PassRegistry &)
FunctionPass * createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM)
Target - Wrapper for Target specific information.
static cl::opt< bool > DisableInstrFormPrep("disable-ppc-instr-form-prep", cl::Hidden, cl::desc("Disable PPC loop instr form prep"))
Target & getThePPC64LETarget()
std::string TargetCPU
Definition: TargetMachine.h:85
static cl::opt< bool > DisableCTRLoops("disable-ppc-ctrloops", cl::Hidden, cl::desc("Disable CTR loops for PPC"))
A ScheduleDAG for scheduling lists of MachineInstr.
bool hasValue() const
Definition: Optional.h:259
void initializePPCPreEmitPeepholePass(PassRegistry &)
StringRef getABIName() const
getABIName - If this returns a non-empty string this represents the textual name of the ABI that we w...
FunctionPass * createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL)
createPPCISelDag - This pass converts a legalized DAG into a PowerPC-specific DAG, ready for instruction scheduling.
char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
FunctionPass * createPPCQPXLoadSplatPass()
StringRef getValueAsString() const
Return the attribute&#39;s value as a string.
Definition: Attributes.cpp:220
bool isArch64Bit() const
Test whether the architecture is 64-bit.
Definition: Triple.cpp:1298
bool isPositionIndependent() const
char & IfConverterID
IfConverter - This pass performs machine code if conversion.
MachineSchedContext provides enough context from the MachineScheduler pass for the target to instanti...
#define I(x, y, z)
Definition: MD5.cpp:58
static cl::opt< bool > EnableExtraTOCRegDeps("enable-ppc-extra-toc-reg-deps", cl::desc("Add extra TOC register dependencies"), cl::init(true), cl::Hidden)
std::string TargetFS
Definition: TargetMachine.h:86
static cl::opt< bool > EnableBranchCoalescing("enable-ppc-branch-coalesce", cl::Hidden, cl::desc("enable coalescing of duplicate branches for PPC"))
FunctionPass * createPPCMIPeepholePass()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool usePPCPostRASchedStrategy() const
Definition: PPCSubtarget.h:285
FunctionPass * createPPCPreEmitPeepholePass()
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Definition: Function.h:333
static std::string getDataLayoutString(const Triple &T)
Return the datalayout string of a subtarget.
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1449
bool usePPCPreRASchedStrategy() const
Definition: PPCSubtarget.h:284
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:38
This pass exposes codegen information to IR-level passes.
FunctionPass * createAtomicExpandPass()
static bool is64Bit(const char *name)
FunctionPass * createPPCExpandISELPass()
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.