64 const auto Arch = TT.getArch();
71 return "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-"
72 "v256:256-v512:512-v1024:1024-n8:16:32:64-G1";
74 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
75 "v512:512-v1024:1024-n8:16:32:64-G10";
76 if (TT.getVendor() == Triple::VendorType::AMD &&
77 TT.getOS() == Triple::OSType::AMDHSA)
78 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
79 "v512:512-v1024:1024-n32:64-S32-G1-P4-A0";
80 return "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-"
81 "v512:512-v1024:1024-n8:16:32:64-G1";
96 std::optional<Reloc::Model> RM,
97 std::optional<CodeModel::Model> CM,
103 Subtarget(TT, CPU.str(), FS.str(), *this) {
112#define GET_PASS_REGISTRY "SPIRVPassRegistry.def"
124 return getTM<SPIRVTargetMachine>();
126 void addMachineSSAOptimization()
override;
127 void addIRPasses()
override;
128 void addISelPrepare()
override;
130 bool addIRTranslator()
override;
131 void addPreLegalizeMachineIR()
override;
132 bool addLegalizeMachineIR()
override;
133 bool addRegBankSelect()
override;
134 bool addGlobalInstructionSelect()
override;
136 FunctionPass *createTargetRegisterAllocator(
bool)
override;
137 void addFastRegAlloc()
override {}
138 void addOptimizedRegAlloc()
override {}
140 void addPostRegAlloc()
override;
141 void addPreEmitPass()
override;
150FunctionPass *SPIRVPassConfig::createTargetRegisterAllocator(
bool) {
155void SPIRVPassConfig::addMachineSSAOptimization() {
160void SPIRVPassConfig::addPostRegAlloc() {
186 return new SPIRVPassConfig(*
this, PM);
189void SPIRVPassConfig::addIRPasses() {
192 if (TM.getSubtargetImpl()->isShader()) {
228void SPIRVPassConfig::addISelPrepare() {
231 if (
TM.getSubtargetImpl()->isLogicalSPIRV())
236bool SPIRVPassConfig::addIRTranslator() {
241void SPIRVPassConfig::addPreLegalizeMachineIR() {
247bool SPIRVPassConfig::addLegalizeMachineIR() {
254bool SPIRVPassConfig::addRegBankSelect() {
260 "spv-emit-nonsemantic-debug-info",
261 cl::desc(
"Emit SPIR-V NonSemantic.Shader.DebugInfo.100 instructions"),
264void SPIRVPassConfig::addPreEmitPass() {
282bool SPIRVPassConfig::addGlobalInstructionSelect() {
283 addPass(
new SPIRVInstructionSelect());
#define LLVM_EXTERNAL_VISIBILITY
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This file declares the IRTranslator pass.
static std::string computeDataLayout()
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSPIRVTarget()
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
static cl::opt< bool > SPVEnableNonSemanticDI("spv-emit-nonsemantic-debug-info", cl::desc("Emit SPIR-V NonSemantic.Shader.DebugInfo.100 instructions"), cl::Optional, cl::init(false))
Target-Independent Code Generator Pass Configuration Options pass.
implements a set of functionality in the TargetMachine class for targets that make use of the indepen...
FunctionPass class - This class is used to implement most global optimizations.
This pass is responsible for selecting generic machine instructions to target-specific instructions.
MachineFunctionProperties getRequiredProperties() const override
Properties which a MachineFunction may have at a given point in time.
This class provides access to building LLVM's passes.
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...
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline.
SPIRVTargetMachine(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.
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
~SPIRVTargetObjectFile() override
StringRef - Represent a constant reference to a string, i.e.
void setFastISel(bool Enable)
void setRequiresStructuredCFG(bool Value)
void setGlobalISel(bool Enable)
void setO0WantsFastISel(bool Enable)
Target-Independent Code Generator Pass Configuration Options.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
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.
virtual void addISelPrepare()
Add common passes that perform LLVM IR to IR transforms in preparation for instruction selection.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Interfaces for registering analysis passes, producing common pass manager configurations,...
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
void initializeSPIRVEmitIntrinsicsPass(PassRegistry &)
FunctionPass * createSPIRVStructurizerPass()
LLVM_ABI FunctionPass * createPromoteMemoryToRegisterPass()
MachineFunctionPass * createSPIRVEmitNonSemanticDIPass(SPIRVTargetMachine *TM)
Target & getTheSPIRV32Target()
ModulePass * createSPIRVEmitIntrinsicsPass(SPIRVTargetMachine *TM)
void initializeSPIRVPrepareFunctionsPass(PassRegistry &)
LLVM_ABI FunctionPass * createRegToMemWrapperPass()
FunctionPass * createSPIRVPreLegalizerPass()
LLVM_ABI char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
LLVM_ABI char & RemoveLoadsIntoFakeUsesID
RemoveLoadsIntoFakeUses pass.
void initializeSPIRVMergeRegionExitTargetsPass(PassRegistry &)
FunctionPass * createSPIRVStripConvergenceIntrinsicsPass()
void initializeSPIRVPreLegalizerCombinerPass(PassRegistry &)
LLVM_ABI char & LiveDebugValuesID
LiveDebugValues pass.
void initializeSPIRVLegalizePointerCastPass(PassRegistry &)
FunctionPass * createSPIRVPreLegalizerCombiner()
void initializeSPIRVModuleAnalysisPass(PassRegistry &)
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
FunctionPass * createSPIRVPostLegalizerPass()
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
LLVM_ABI char & ShrinkWrapID
ShrinkWrap pass. Look for the best place to insert save and restore.
LLVM_ABI char & MachineLateInstrsCleanupID
MachineLateInstrsCleanup - This pass removes redundant identical instructions after register allocati...
void initializeSPIRVRegularizerPass(PassRegistry &)
LLVM_ABI char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
LLVM_ABI char & FuncletLayoutID
This pass lays out funclets contiguously.
LLVM_ABI char & PostRAMachineSinkingID
This pass perform post-ra machine sink for COPY instructions.
CodeGenOptLevel
Code generation optimization level.
Target & getTheSPIRV64Target()
void initializeSPIRVPostLegalizerPass(PassRegistry &)
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
Target & getTheSPIRVLogicalTarget()
void initializeSPIRVAsmPrinterPass(PassRegistry &)
FunctionPass * createSPIRVRegularizerPass()
void initializeSPIRVStructurizerPass(PassRegistry &)
void initializeSPIRVEmitNonSemanticDIPass(PassRegistry &)
FunctionPass * createSPIRVMergeRegionExitTargetsPass()
LLVM_ABI FunctionPass * createInferAddressSpacesPass(unsigned AddressSpace=~0u)
void initializeSPIRVPreLegalizerPass(PassRegistry &)
void initializeSPIRVConvergenceRegionAnalysisWrapperPassPass(PassRegistry &)
LLVM_ABI char & MachineBlockPlacementID
MachineBlockPlacement - This pass places basic blocks based on branch probabilities.
LLVM_ABI char & BranchFolderPassID
BranchFolding - This pass performs machine code CFG based optimizations to delete branches to branche...
ModulePass * createSPIRVPrepareFunctionsPass(const SPIRVTargetMachine &TM)
FunctionPass * createSPIRVLegalizePointerCastPass(SPIRVTargetMachine *TM)
LLVM_ABI Pass * createLoopSimplifyPass()
LLVM_ABI char & MachineCopyPropagationID
MachineCopyPropagation - This pass performs copy propagation on machine instructions.
void initializeSPIRVStripConvergentIntrinsicsPass(PassRegistry &)
ModulePass * createSPIRVLegalizeImplicitBindingPass()
Implement std::hash so that hash_code can be used in STL containers.
RegisterTargetMachine - Helper template for registering a target machine implementation,...