LLVM  14.0.0git
NVPTXTargetMachine.cpp
Go to the documentation of this file.
1 //===-- NVPTXTargetMachine.cpp - Define TargetMachine for NVPTX -----------===//
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 NVPTX target.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "NVPTXTargetMachine.h"
14 #include "NVPTX.h"
15 #include "NVPTXAllocaHoisting.h"
16 #include "NVPTXAtomicLower.h"
17 #include "NVPTXLowerAggrCopies.h"
18 #include "NVPTXTargetObjectFile.h"
21 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/ADT/Triple.h"
24 #include "llvm/CodeGen/Passes.h"
27 #include "llvm/Pass.h"
34 #include "llvm/Transforms/Scalar.h"
37 #include <cassert>
38 #include <string>
39 
40 using namespace llvm;
41 
42 // LSV is still relatively new; this switch lets us turn it off in case we
43 // encounter (or suspect) a bug.
44 static cl::opt<bool>
45  DisableLoadStoreVectorizer("disable-nvptx-load-store-vectorizer",
46  cl::desc("Disable load/store vectorizer"),
47  cl::init(false), cl::Hidden);
48 
49 // TODO: Remove this flag when we are confident with no regressions.
51  "disable-nvptx-require-structured-cfg",
52  cl::desc("Transitional flag to turn off NVPTX's requirement on preserving "
53  "structured CFG. The requirement should be disabled only when "
54  "unexpected regressions happen."),
55  cl::init(false), cl::Hidden);
56 
58  "nvptx-short-ptr",
59  cl::desc(
60  "Use 32-bit pointers for accessing const/local/shared address spaces."),
61  cl::init(false), cl::Hidden);
62 
63 namespace llvm {
64 
75 
76 } // end namespace llvm
77 
79  // Register the target.
82 
83  // FIXME: This pass is really intended to be invoked during IR optimization,
84  // but it's very NVPTX-specific.
96 }
97 
98 static std::string computeDataLayout(bool is64Bit, bool UseShortPointers) {
99  std::string Ret = "e";
100 
101  if (!is64Bit)
102  Ret += "-p:32:32";
103  else if (UseShortPointers)
104  Ret += "-p3:32:32-p4:32:32-p5:32:32";
105 
106  Ret += "-i64:64-i128:128-v16:16-v32:32-n16:32:64";
107 
108  return Ret;
109 }
110 
112  StringRef CPU, StringRef FS,
113  const TargetOptions &Options,
116  CodeGenOpt::Level OL, bool is64bit)
117  // The pic relocation model is used regardless of what the client has
118  // specified, as it is the only relocation model currently supported.
120  CPU, FS, Options, Reloc::PIC_,
121  getEffectiveCodeModel(CM, CodeModel::Small), OL),
122  is64bit(is64bit), UseShortPointers(UseShortPointersOpt),
123  TLOF(std::make_unique<NVPTXTargetObjectFile>()),
124  Subtarget(TT, std::string(CPU), std::string(FS), *this) {
125  if (TT.getOS() == Triple::NVCL)
126  drvInterface = NVPTX::NVCL;
127  else
128  drvInterface = NVPTX::CUDA;
131  initAsmInfo();
132 }
133 
135 
136 void NVPTXTargetMachine32::anchor() {}
137 
139  StringRef CPU, StringRef FS,
140  const TargetOptions &Options,
143  CodeGenOpt::Level OL, bool JIT)
144  : NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, false) {}
145 
146 void NVPTXTargetMachine64::anchor() {}
147 
149  StringRef CPU, StringRef FS,
150  const TargetOptions &Options,
153  CodeGenOpt::Level OL, bool JIT)
154  : NVPTXTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, true) {}
155 
156 namespace {
157 
158 class NVPTXPassConfig : public TargetPassConfig {
159 public:
160  NVPTXPassConfig(NVPTXTargetMachine &TM, PassManagerBase &PM)
161  : TargetPassConfig(TM, PM) {}
162 
163  NVPTXTargetMachine &getNVPTXTargetMachine() const {
164  return getTM<NVPTXTargetMachine>();
165  }
166 
167  void addIRPasses() override;
168  bool addInstSelector() override;
169  void addPreRegAlloc() override;
170  void addPostRegAlloc() override;
171  void addMachineSSAOptimization() override;
172 
173  FunctionPass *createTargetRegisterAllocator(bool) override;
174  void addFastRegAlloc() override;
175  void addOptimizedRegAlloc() override;
176 
177  bool addRegAssignAndRewriteFast() override {
178  llvm_unreachable("should not be used");
179  }
180 
181  bool addRegAssignAndRewriteOptimized() override {
182  llvm_unreachable("should not be used");
183  }
184 
185 private:
186  // If the opt level is aggressive, add GVN; otherwise, add EarlyCSE. This
187  // function is only called in opt mode.
188  void addEarlyCSEOrGVNPass();
189 
190  // Add passes that propagate special memory spaces.
191  void addAddressSpaceInferencePasses();
192 
193  // Add passes that perform straight-line scalar optimizations.
194  void addStraightLineScalarOptimizationPasses();
195 };
196 
197 } // end anonymous namespace
198 
200  return new NVPTXPassConfig(*this, PM);
201 }
202 
204  Builder.addExtension(
206  [&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
207  PM.add(createNVVMReflectPass(Subtarget.getSmVersion()));
208  PM.add(createNVVMIntrRangePass(Subtarget.getSmVersion()));
209  });
210 }
211 
216  if (PassName == "nvvm-reflect") {
217  PM.addPass(NVVMReflectPass());
218  return true;
219  }
220  if (PassName == "nvvm-intr-range") {
222  return true;
223  }
224  return false;
225  });
226 
230  FPM.addPass(NVVMReflectPass(Subtarget.getSmVersion()));
231  // FIXME: NVVMIntrRangePass is causing numerical discrepancies,
232  // investigate and re-enable.
233  // FPM.addPass(NVVMIntrRangePass(Subtarget.getSmVersion()));
235  });
236 }
237 
240  return TargetTransformInfo(NVPTXTTIImpl(this, F));
241 }
242 
243 void NVPTXPassConfig::addEarlyCSEOrGVNPass() {
244  if (getOptLevel() == CodeGenOpt::Aggressive)
245  addPass(createGVNPass());
246  else
247  addPass(createEarlyCSEPass());
248 }
249 
250 void NVPTXPassConfig::addAddressSpaceInferencePasses() {
251  // NVPTXLowerArgs emits alloca for byval parameters which can often
252  // be eliminated by SROA.
253  addPass(createSROAPass());
254  addPass(createNVPTXLowerAllocaPass());
255  addPass(createInferAddressSpacesPass());
256  addPass(createNVPTXAtomicLowerPass());
257 }
258 
259 void NVPTXPassConfig::addStraightLineScalarOptimizationPasses() {
262  // ReassociateGEPs exposes more opportunites for SLSR. See
263  // the example in reassociate-geps-and-slsr.ll.
265  // SeparateConstOffsetFromGEP and SLSR creates common expressions which GVN or
266  // EarlyCSE can reuse. GVN generates significantly better code than EarlyCSE
267  // for some of our benchmarks.
268  addEarlyCSEOrGVNPass();
269  // Run NaryReassociate after EarlyCSE/GVN to be more effective.
270  addPass(createNaryReassociatePass());
271  // NaryReassociate on GEPs creates redundant common expressions, so run
272  // EarlyCSE after it.
273  addPass(createEarlyCSEPass());
274 }
275 
276 void NVPTXPassConfig::addIRPasses() {
277  // The following passes are known to not play well with virtual regs hanging
278  // around after register allocation (which in our case, is *all* registers).
279  // We explicitly disable them here. We do, however, need some functionality
280  // of the PrologEpilogCodeInserter pass, so we emulate that behavior in the
281  // NVPTXPrologEpilog pass (see NVPTXPrologEpilogPass.cpp).
282  disablePass(&PrologEpilogCodeInserterID);
283  disablePass(&MachineCopyPropagationID);
284  disablePass(&TailDuplicateID);
285  disablePass(&StackMapLivenessID);
286  disablePass(&LiveDebugValuesID);
287  disablePass(&PostRAMachineSinkingID);
288  disablePass(&PostRASchedulerID);
289  disablePass(&FuncletLayoutID);
290  disablePass(&PatchableFunctionID);
291  disablePass(&ShrinkWrapID);
292 
293  // NVVMReflectPass is added in addEarlyAsPossiblePasses, so hopefully running
294  // it here does nothing. But since we need it for correctness when lowering
295  // to NVPTX, run it here too, in case whoever built our pass pipeline didn't
296  // call addEarlyAsPossiblePasses.
297  const NVPTXSubtarget &ST = *getTM<NVPTXTargetMachine>().getSubtargetImpl();
298  addPass(createNVVMReflectPass(ST.getSmVersion()));
299 
300  if (getOptLevel() != CodeGenOpt::None)
303  addPass(createGenericToNVVMPass());
304 
305  // NVPTXLowerArgs is required for correctness and should be run right
306  // before the address space inference passes.
307  addPass(createNVPTXLowerArgsPass(&getNVPTXTargetMachine()));
308  if (getOptLevel() != CodeGenOpt::None) {
309  addAddressSpaceInferencePasses();
310  addStraightLineScalarOptimizationPasses();
311  }
312 
313  // === LSR and other generic IR passes ===
315  // EarlyCSE is not always strong enough to clean up what LSR produces. For
316  // example, GVN can combine
317  //
318  // %0 = add %a, %b
319  // %1 = add %b, %a
320  //
321  // and
322  //
323  // %0 = shl nsw %a, 2
324  // %1 = shl %a, 2
325  //
326  // but EarlyCSE can do neither of them.
327  if (getOptLevel() != CodeGenOpt::None) {
328  addEarlyCSEOrGVNPass();
331  }
332 }
333 
334 bool NVPTXPassConfig::addInstSelector() {
335  const NVPTXSubtarget &ST = *getTM<NVPTXTargetMachine>().getSubtargetImpl();
336 
337  addPass(createLowerAggrCopies());
338  addPass(createAllocaHoisting());
339  addPass(createNVPTXISelDag(getNVPTXTargetMachine(), getOptLevel()));
340 
341  if (!ST.hasImageHandles())
343 
344  return false;
345 }
346 
347 void NVPTXPassConfig::addPreRegAlloc() {
348  // Remove Proxy Register pseudo instructions used to keep `callseq_end` alive.
350 }
351 
352 void NVPTXPassConfig::addPostRegAlloc() {
353  addPass(createNVPTXPrologEpilogPass(), false);
354  if (getOptLevel() != CodeGenOpt::None) {
355  // NVPTXPrologEpilogPass calculates frame object offset and replace frame
356  // index with VRFrame register. NVPTXPeephole need to be run after that and
357  // will replace VRFrame with VRFrameLocal when possible.
358  addPass(createNVPTXPeephole());
359  }
360 }
361 
362 FunctionPass *NVPTXPassConfig::createTargetRegisterAllocator(bool) {
363  return nullptr; // No reg alloc
364 }
365 
366 void NVPTXPassConfig::addFastRegAlloc() {
367  addPass(&PHIEliminationID);
368  addPass(&TwoAddressInstructionPassID);
369 }
370 
371 void NVPTXPassConfig::addOptimizedRegAlloc() {
372  addPass(&ProcessImplicitDefsID);
373  addPass(&LiveVariablesID);
374  addPass(&MachineLoopInfoID);
375  addPass(&PHIEliminationID);
376 
377  addPass(&TwoAddressInstructionPassID);
378  addPass(&RegisterCoalescerID);
379 
380  // PreRA instruction scheduling.
381  if (addPass(&MachineSchedulerID))
382  printAndVerify("After Machine Scheduling");
383 
384 
385  addPass(&StackSlotColoringID);
386 
387  // FIXME: Needs physical registers
388  //addPass(&MachineLICMID);
389 
390  printAndVerify("After StackSlotColoring");
391 }
392 
393 void NVPTXPassConfig::addMachineSSAOptimization() {
394  // Pre-ra tail duplication.
395  if (addPass(&EarlyTailDuplicateID))
396  printAndVerify("After Pre-RegAlloc TailDuplicate");
397 
398  // Optimize PHIs before DCE: removing dead PHI cycles may make more
399  // instructions dead.
400  addPass(&OptimizePHIsID);
401 
402  // This pass merges large allocas. StackSlotColoring is a different pass
403  // which merges spill slots.
404  addPass(&StackColoringID);
405 
406  // If the target requests it, assign local variables to stack slots relative
407  // to one another and simplify frame index references where possible.
408  addPass(&LocalStackSlotAllocationID);
409 
410  // With optimization, dead code should already be eliminated. However
411  // there is one known exception: lowered code for arguments that are only
412  // used by tail calls, where the tail calls reuse the incoming stack
413  // arguments directly (see t11 in test/CodeGen/X86/sibcall.ll).
415  printAndVerify("After codegen DCE pass");
416 
417  // Allow targets to insert passes that improve instruction level parallelism,
418  // like if-conversion. Such passes will typically need dominator trees and
419  // loop info, just like LICM and CSE below.
420  if (addILPOpts())
421  printAndVerify("After ILP optimizations");
422 
423  addPass(&EarlyMachineLICMID);
424  addPass(&MachineCSEID);
425 
426  addPass(&MachineSinkingID);
427  printAndVerify("After Machine LICM, CSE and Sinking passes");
428 
429  addPass(&PeepholeOptimizerID);
430  printAndVerify("After codegen peephole optimization pass");
431 }
llvm::OptimizePHIsID
char & OptimizePHIsID
OptimizePHIs - This pass optimizes machine instruction PHIs to take advantage of opportunities create...
Definition: OptimizePHIs.cpp:69
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
PassBuilder.h
llvm::createSeparateConstOffsetFromGEPPass
FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
Definition: SeparateConstOffsetFromGEP.cpp:499
llvm::NVPTXTargetMachine::~NVPTXTargetMachine
~NVPTXTargetMachine() override
llvm::PeepholeOptimizerID
char & PeepholeOptimizerID
PeepholeOptimizer - This pass performs peephole optimizations - like extension and comparison elimina...
Definition: PeepholeOptimizer.cpp:443
llvm::PassBuilder::registerPipelineStartEPCallback
void registerPipelineStartEPCallback(const std::function< void(ModulePassManager &, OptimizationLevel)> &C)
Register a callback for a default optimizer pipeline extension point.
Definition: PassBuilder.h:442
llvm::TargetOptions
Definition: TargetOptions.h:124
Scalar.h
T
llvm::Function
Definition: Function.h:61
Pass.h
llvm::PHIEliminationID
char & PHIEliminationID
PHIElimination - This pass eliminates machine instruction PHI nodes by inserting copy instructions.
Definition: PHIElimination.cpp:129
is64Bit
static bool is64Bit(const char *name)
Definition: X86Disassembler.cpp:1023
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::initializeNVPTXAllocaHoistingPass
void initializeNVPTXAllocaHoistingPass(PassRegistry &)
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:168
llvm::NVPTXTargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: NVPTXTargetMachine.cpp:239
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::NVPTXSubtarget::getSmVersion
unsigned int getSmVersion() const
Definition: NVPTXSubtarget.h:80
llvm::createEarlyCSEPass
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1729
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::createNVPTXReplaceImageHandlesPass
MachineFunctionPass * createNVPTXReplaceImageHandlesPass()
Definition: NVPTXReplaceImageHandles.cpp:189
llvm::NVPTXTargetMachine32::NVPTXTargetMachine32
NVPTXTargetMachine32(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)
Definition: NVPTXTargetMachine.cpp:138
UseShortPointersOpt
static cl::opt< bool > UseShortPointersOpt("nvptx-short-ptr", cl::desc("Use 32-bit pointers for accessing const/local/shared address spaces."), cl::init(false), cl::Hidden)
llvm::initializeNVPTXProxyRegErasurePass
void initializeNVPTXProxyRegErasurePass(PassRegistry &)
llvm::LocalStackSlotAllocationID
char & LocalStackSlotAllocationID
LocalStackSlotAllocation - This pass assigns local frame indices to stack slots relative to one anoth...
Definition: LocalStackSlotAllocation.cpp:109
llvm::Optional< Reloc::Model >
llvm::createGVNPass
FunctionPass * createGVNPass(bool NoMemDepAnalysis=false)
Create a legacy GVN pass.
Definition: GVN.cpp:3115
llvm::createNVPTXLowerArgsPass
FunctionPass * createNVPTXLowerArgsPass(const NVPTXTargetMachine *TM)
Definition: NVPTXLowerArgs.cpp:379
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
STLExtras.h
llvm::StackSlotColoringID
char & StackSlotColoringID
StackSlotColoring - This pass performs stack slot coloring.
Definition: StackSlotColoring.cpp:132
llvm::initializeNVPTXAtomicLowerPass
void initializeNVPTXAtomicLowerPass(PassRegistry &)
llvm::MachineCopyPropagationID
char & MachineCopyPropagationID
MachineCopyPropagation - This pass performs copy propagation on machine instructions.
Definition: MachineCopyPropagation.cpp:308
NVPTXTargetTransformInfo.h
LegacyPassManager.h
llvm::TwoAddressInstructionPassID
char & TwoAddressInstructionPassID
TwoAddressInstruction - This pass reduces two-address instructions to use two operands.
Definition: TwoAddressInstructionPass.cpp:192
PassManagerBuilder.h
llvm::createNVPTXAssignValidGlobalNamesPass
ModulePass * createNVPTXAssignValidGlobalNamesPass()
Definition: NVPTXAssignValidGlobalNames.cpp:87
llvm::NVPTXTargetMachine
NVPTXTargetMachine.
Definition: NVPTXTargetMachine.h:24
computeDataLayout
static std::string computeDataLayout(bool is64Bit, bool UseShortPointers)
Definition: NVPTXTargetMachine.cpp:98
F
#define F(x, y, z)
Definition: MD5.cpp:56
NVPTX.h
NVPTXTargetInfo.h
CommandLine.h
llvm::initializeNVPTXLowerAllocaPass
void initializeNVPTXLowerAllocaPass(PassRegistry &)
llvm::LiveDebugValuesID
char & LiveDebugValuesID
LiveDebugValues pass.
Definition: LiveDebugValues.cpp:88
llvm::createInferAddressSpacesPass
FunctionPass * createInferAddressSpacesPass(unsigned AddressSpace=~0u)
Definition: InferAddressSpaces.cpp:1208
TargetMachine.h
llvm::PassRegistry::getPassRegistry
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Definition: PassRegistry.cpp:31
llvm::NVVMIntrRangePass
Definition: NVPTX.h:51
llvm::PrologEpilogCodeInserterID
char & PrologEpilogCodeInserterID
PrologEpilogCodeInserter - This pass inserts prolog and epilog code, and eliminates abstract frame re...
Definition: PrologEpilogInserter.cpp:139
llvm::createNaryReassociatePass
FunctionPass * createNaryReassociatePass()
Definition: NaryReassociate.cpp:165
llvm::initializeNVPTXLowerAggrCopiesPass
void initializeNVPTXLowerAggrCopiesPass(PassRegistry &)
llvm::FuncletLayoutID
char & FuncletLayoutID
This pass lays out funclets contiguously.
Definition: FuncletLayout.cpp:39
Y
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
llvm::PassBuilder
This class provides access to building LLVM's passes.
Definition: PassBuilder.h:84
llvm::createLowerAggrCopies
FunctionPass * createLowerAggrCopies()
NVPTXAtomicLower.h
false
Definition: StackSlotColoring.cpp:142
llvm::RegisterCoalescerID
char & RegisterCoalescerID
RegisterCoalescer - This pass merges live ranges to eliminate copies.
Definition: RegisterCoalescer.cpp:410
llvm::NVPTXTargetMachine::registerPassBuilderCallbacks
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline with New Pass Manager (similar to adjustPassManager for ...
Definition: NVPTXTargetMachine.cpp:212
llvm::CodeModel::Small
@ Small
Definition: CodeGen.h:28
llvm::createModuleToFunctionPassAdaptor
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
Definition: PassManager.h:1221
llvm::RegisterTargetMachine
RegisterTargetMachine - Helper template for registering a target machine implementation,...
Definition: TargetRegistry.h:1275
llvm::PassRegistry
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
Definition: PassRegistry.h:38
llvm::createNVPTXPrologEpilogPass
MachineFunctionPass * createNVPTXPrologEpilogPass()
Definition: NVPTXPrologEpilogPass.cpp:44
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::NVPTXTargetMachine::createPassConfig
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition: NVPTXTargetMachine.cpp:199
GVN.h
llvm::createLoadStoreVectorizerPass
Pass * createLoadStoreVectorizerPass()
Create a legacy pass manager instance of the LoadStoreVectorizer pass.
llvm::StackMapLivenessID
char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
Definition: StackMapLivenessAnalysis.cpp:86
llvm::createSpeculativeExecutionPass
FunctionPass * createSpeculativeExecutionPass()
Definition: SpeculativeExecution.cpp:325
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
llvm::createNVVMIntrRangePass
FunctionPass * createNVVMIntrRangePass(unsigned int SmVersion)
Definition: NVVMIntrRange.cpp:51
llvm::NVPTX::NVCL
@ NVCL
Definition: NVPTX.h:71
llvm::getTheNVPTXTarget64
Target & getTheNVPTXTarget64()
Definition: NVPTXTargetInfo.cpp:17
llvm::legacy::PassManagerBase::add
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
llvm::PassManagerBuilder
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
Definition: PassManagerBuilder.h:59
llvm::EarlyTailDuplicateID
char & EarlyTailDuplicateID
Duplicate blocks with unconditional branches into tails of their predecessors.
Definition: TailDuplication.cpp:77
llvm::NVPTXSubtarget
Definition: NVPTXSubtarget.h:31
PB
PassBuilder PB(Machine, PassOpts->PTO, None, &PIC)
Passes.h
llvm::NVPTXTTIImpl
Definition: NVPTXTargetTransformInfo.h:27
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::MachineLoopInfoID
char & MachineLoopInfoID
MachineLoopInfo - This pass is a loop analysis pass.
Definition: MachineLoopInfo.cpp:43
llvm::cl::opt< bool >
llvm::StackColoringID
char & StackColoringID
StackSlotColoring - This pass performs stack coloring and merging.
Definition: StackColoring.cpp:551
llvm::NVPTXTargetMachine::NVPTXTargetMachine
NVPTXTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OP, bool is64bit)
Definition: NVPTXTargetMachine.cpp:111
llvm::TargetMachine::setRequiresStructuredCFG
void setRequiresStructuredCFG(bool Value)
Definition: TargetMachine.h:219
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:524
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
llvm::MachineSinkingID
char & MachineSinkingID
MachineSinking - This pass performs sinking on machine instructions.
Definition: MachineSink.cpp:256
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::Triple::NVCL
@ NVCL
Definition: Triple.h:189
llvm::createNVVMReflectPass
FunctionPass * createNVVMReflectPass(unsigned int SmVersion)
Definition: NVVMReflect.cpp:64
NVPTXAllocaHoisting.h
llvm::TargetPassConfig::addIRPasses
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
Definition: TargetPassConfig.cpp:850
llvm::createNVPTXAtomicLowerPass
FunctionPass * createNVPTXAtomicLowerPass()
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::LiveVariablesID
char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
Definition: LiveVariables.cpp:45
TargetPassConfig.h
llvm::NVPTXTargetObjectFile
Definition: NVPTXTargetObjectFile.h:18
llvm::MachineCSEID
char & MachineCSEID
MachineCSE - This pass performs global CSE on machine instructions.
Definition: MachineCSE.cpp:153
NVPTXLowerAggrCopies.h
llvm::ProcessImplicitDefsID
char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
Definition: ProcessImplicitDefs.cpp:52
llvm::PassBuilder::registerPipelineParsingCallback
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
Definition: PassBuilder.h:497
llvm::CodeGenOpt::Aggressive
@ Aggressive
Definition: CodeGen.h:56
llvm::PatchableFunctionID
char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
Definition: PatchableFunction.cpp:96
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
Triple.h
llvm::CodeGenOpt::None
@ None
Definition: CodeGen.h:53
llvm::createNVPTXISelDag
FunctionPass * createNVPTXISelDag(NVPTXTargetMachine &TM, llvm::CodeGenOpt::Level OptLevel)
createNVPTXISelDag - This pass converts a legalized DAG into a NVPTX-specific DAG,...
Definition: NVPTXISelDAGToDAG.cpp:33
TargetOptions.h
llvm::AArch64::RM
@ RM
Definition: AArch64ISelLowering.h:472
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::Reloc::PIC_
@ PIC_
Definition: CodeGen.h:22
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::ShrinkWrapID
char & ShrinkWrapID
ShrinkWrap pass. Look for the best place to insert save and restore.
Definition: ShrinkWrap.cpp:250
llvm::PICLevel::Level
Level
Definition: CodeGen.h:33
llvm::initializeNVVMReflectPass
void initializeNVVMReflectPass(PassRegistry &)
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::getEffectiveCodeModel
CodeModel::Model getEffectiveCodeModel(Optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
Definition: TargetMachine.h:481
llvm::LLVMTargetMachine::initAsmInfo
void initAsmInfo()
Definition: LLVMTargetMachine.cpp:41
DisableLoadStoreVectorizer
static cl::opt< bool > DisableLoadStoreVectorizer("disable-nvptx-load-store-vectorizer", cl::desc("Disable load/store vectorizer"), cl::init(false), cl::Hidden)
llvm::initializeGenericToNVVMPass
void initializeGenericToNVVMPass(PassRegistry &)
llvm::PassManager< Function >
llvm::NVPTXTargetMachine64::NVPTXTargetMachine64
NVPTXTargetMachine64(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)
Definition: NVPTXTargetMachine.cpp:148
std
Definition: BitVector.h:838
llvm::NVPTX::CUDA
@ CUDA
Definition: NVPTX.h:72
llvm::NVVMReflectPass
Definition: NVPTX.h:60
llvm::X86AS::FS
@ FS
Definition: X86.h:188
NVPTXTargetMachine.h
llvm::OptimizationLevel
Definition: OptimizationLevel.h:22
llvm::TailDuplicateID
char & TailDuplicateID
TailDuplicate - Duplicate blocks with unconditional branches into tails of their predecessors.
Definition: TailDuplication.cpp:76
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:393
llvm::DeadMachineInstructionElimID
char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
Definition: DeadMachineInstructionElim.cpp:57
llvm::createNVPTXImageOptimizerPass
FunctionPass * createNVPTXImageOptimizerPass()
Definition: NVPTXImageOptimizer.cpp:177
llvm::MachineSchedulerID
char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
Definition: MachineScheduler.cpp:210
DisableRequireStructuredCFG
static cl::opt< bool > DisableRequireStructuredCFG("disable-nvptx-require-structured-cfg", cl::desc("Transitional flag to turn off NVPTX's requirement on preserving " "structured CFG. The requirement should be disabled only when " "unexpected regressions happen."), cl::init(false), cl::Hidden)
llvm::createGenericToNVVMPass
ModulePass * createGenericToNVVMPass()
Definition: NVPTXGenericToNVVM.cpp:64
llvm::PassManagerBuilder::EP_EarlyAsPossible
@ EP_EarlyAsPossible
EP_EarlyAsPossible - This extension point allows adding passes before any other transformations,...
Definition: PassManagerBuilder.h:72
llvm::PostRASchedulerID
char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
Definition: PostRASchedulerList.cpp:199
LLVMInitializeNVPTXTarget
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTarget()
Definition: NVPTXTargetMachine.cpp:78
llvm::createStraightLineStrengthReducePass
FunctionPass * createStraightLineStrengthReducePass()
Definition: StraightLineStrengthReduce.cpp:269
NVPTXTargetObjectFile.h
TargetTransformInfo.h
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
llvm::initializeNVPTXLowerArgsPass
void initializeNVPTXLowerArgsPass(PassRegistry &)
Vectorize.h
llvm::createNVPTXProxyRegErasurePass
MachineFunctionPass * createNVPTXProxyRegErasurePass()
Definition: NVPTXProxyRegErasure.cpp:119
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::createNVPTXPeephole
MachineFunctionPass * createNVPTXPeephole()
Definition: NVPTXPeephole.cpp:156
llvm::EarlyMachineLICMID
char & EarlyMachineLICMID
This pass performs loop invariant code motion on machine instructions.
Definition: MachineLICM.cpp:298
llvm::NVPTXTargetMachine::adjustPassManager
void adjustPassManager(PassManagerBuilder &) override
Allow the target to modify the pass manager, e.g.
Definition: NVPTXTargetMachine.cpp:203
llvm::PostRAMachineSinkingID
char & PostRAMachineSinkingID
This pass perform post-ra machine sink for COPY instructions.
Definition: MachineSink.cpp:1561
llvm::cl::desc
Definition: CommandLine.h:414
llvm::PassManager::addPass
std::enable_if_t<!std::is_same< PassT, PassManager >::value > addPass(PassT &&Pass)
Definition: PassManager.h:552
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1815
llvm::createNVPTXLowerAllocaPass
FunctionPass * createNVPTXLowerAllocaPass()
Definition: NVPTXLowerAlloca.cpp:118
TargetRegistry.h
llvm::createSROAPass
FunctionPass * createSROAPass()
Definition: SROA.cpp:4802
llvm::initializeNVPTXAssignValidGlobalNamesPass
void initializeNVPTXAssignValidGlobalNamesPass(PassRegistry &)
PassName
static const char PassName[]
Definition: X86LowerAMXIntrinsics.cpp:669
llvm::initializeNVVMIntrRangePass
void initializeNVVMIntrRangePass(PassRegistry &)
SpecialSubKind::string
@ string
llvm::createAllocaHoisting
FunctionPass * createAllocaHoisting()
llvm::getTheNVPTXTarget32
Target & getTheNVPTXTarget32()
Definition: NVPTXTargetInfo.cpp:13