94#include "llvm/IR/IntrinsicsAMDGPU.h"
139class AMDGPUCodeGenPassBuilder
141 using Base = CodeGenPassBuilder<AMDGPUCodeGenPassBuilder, GCNTargetMachine>;
144 AMDGPUCodeGenPassBuilder(GCNTargetMachine &TM,
145 const CGPassBuilderOption &Opts,
146 PassInstrumentationCallbacks *
PIC);
148 void addIRPasses(PassManagerWrapper &PMW)
const;
149 void addCodeGenPrepare(PassManagerWrapper &PMW)
const;
150 void addPreISel(PassManagerWrapper &PMW)
const;
151 void addILPOpts(PassManagerWrapper &PMWM)
const;
152 void addAsmPrinterBegin(PassManagerWrapper &PMW)
const;
153 void addAsmPrinter(PassManagerWrapper &PMW)
const;
154 void addAsmPrinterEnd(PassManagerWrapper &PMW)
const;
155 Error addInstSelector(PassManagerWrapper &PMW)
const;
156 void addPreRewrite(PassManagerWrapper &PMW)
const;
157 void addMachineSSAOptimization(PassManagerWrapper &PMW)
const;
158 void addPostRegAlloc(PassManagerWrapper &PMW)
const;
159 void addPreEmitPass(PassManagerWrapper &PMWM)
const;
160 void addPreEmitRegAlloc(PassManagerWrapper &PMW)
const;
161 Error addRegAssignmentFast(PassManagerWrapper &PMW)
const;
162 Error addRegAssignmentOptimized(PassManagerWrapper &PMW)
const;
163 void addPreRegAlloc(PassManagerWrapper &PMW)
const;
164 Error addFastRegAlloc(PassManagerWrapper &PMW)
const;
165 Error addOptimizedRegAlloc(PassManagerWrapper &PMW)
const;
166 void addPreSched2(PassManagerWrapper &PMW)
const;
167 void addPostBBSections(PassManagerWrapper &PMW)
const;
170 Error validateRegAllocOptions()
const;
178 void addEarlyCSEOrGVNPass(PassManagerWrapper &PMW)
const;
179 void addStraightLineScalarOptimizationPasses(PassManagerWrapper &PMW)
const;
184 SGPRRegisterRegAlloc(
const char *
N,
const char *
D, FunctionPassCtor
C)
185 : RegisterRegAllocBase(
N,
D,
C) {}
190 VGPRRegisterRegAlloc(
const char *
N,
const char *
D, FunctionPassCtor
C)
191 : RegisterRegAllocBase(
N,
D,
C) {}
196 WWMRegisterRegAlloc(
const char *
N,
const char *
D, FunctionPassCtor
C)
197 : RegisterRegAllocBase(
N,
D,
C) {}
233static SGPRRegisterRegAlloc
234defaultSGPRRegAlloc(
"default",
235 "pick SGPR register allocator based on -O option",
238static cl::opt<SGPRRegisterRegAlloc::FunctionPassCtor,
false,
241 cl::desc(
"Register allocator to use for SGPRs"));
243static cl::opt<VGPRRegisterRegAlloc::FunctionPassCtor,
false,
246 cl::desc(
"Register allocator to use for VGPRs"));
248static cl::opt<WWMRegisterRegAlloc::FunctionPassCtor,
false,
252 cl::desc(
"Register allocator to use for WWM registers"));
257 cl::desc(
"Register allocator for SGPRs (new pass manager)"));
261 cl::desc(
"Register allocator for VGPRs (new pass manager)"));
265 cl::desc(
"Register allocator for WWM registers (new pass manager)"));
272 Twine(
"unsupported register allocator '") +
280Error AMDGPUCodeGenPassBuilder::validateRegAllocOptions()
const {
282 if (Opt.RegAlloc != RegAllocType::Unset) {
284 "-regalloc-npm not supported for amdgcn. Use -sgpr-regalloc-npm, "
285 "-vgpr-regalloc-npm, and -wwm-regalloc-npm",
290 if (SGPRRegAlloc.getNumOccurrences() > 0 ||
291 VGPRRegAlloc.getNumOccurrences() > 0 ||
292 WWMRegAlloc.getNumOccurrences() > 0) {
294 "-sgpr-regalloc, -vgpr-regalloc, and -wwm-regalloc are legacy PM "
295 "options. Use -sgpr-regalloc-npm, -vgpr-regalloc-npm, and "
296 "-wwm-regalloc-npm with the new pass manager",
301 if (
auto Err = checkRegAllocSupported(SGPRRegAllocNPM,
"SGPR"))
303 if (
auto Err = checkRegAllocSupported(WWMRegAllocNPM,
"WWM"))
305 if (
auto Err = checkRegAllocSupported(VGPRRegAllocNPM,
"VGPR"))
311static void initializeDefaultSGPRRegisterAllocatorOnce() {
312 RegisterRegAlloc::FunctionPassCtor Ctor = SGPRRegisterRegAlloc::getDefault();
316 SGPRRegisterRegAlloc::setDefault(SGPRRegAlloc);
320static void initializeDefaultVGPRRegisterAllocatorOnce() {
321 RegisterRegAlloc::FunctionPassCtor Ctor = VGPRRegisterRegAlloc::getDefault();
325 VGPRRegisterRegAlloc::setDefault(VGPRRegAlloc);
329static void initializeDefaultWWMRegisterAllocatorOnce() {
330 RegisterRegAlloc::FunctionPassCtor Ctor = WWMRegisterRegAlloc::getDefault();
334 WWMRegisterRegAlloc::setDefault(WWMRegAlloc);
338static FunctionPass *createBasicSGPRRegisterAllocator() {
342static FunctionPass *createGreedySGPRRegisterAllocator() {
346static FunctionPass *createFastSGPRRegisterAllocator() {
350static FunctionPass *createBasicVGPRRegisterAllocator() {
354static FunctionPass *createGreedyVGPRRegisterAllocator() {
358static FunctionPass *createFastVGPRRegisterAllocator() {
362static FunctionPass *createBasicWWMRegisterAllocator() {
366static FunctionPass *createGreedyWWMRegisterAllocator() {
370static FunctionPass *createFastWWMRegisterAllocator() {
374static SGPRRegisterRegAlloc basicRegAllocSGPR(
375 "basic",
"basic register allocator", createBasicSGPRRegisterAllocator);
376static SGPRRegisterRegAlloc greedyRegAllocSGPR(
377 "greedy",
"greedy register allocator", createGreedySGPRRegisterAllocator);
379static SGPRRegisterRegAlloc fastRegAllocSGPR(
380 "fast",
"fast register allocator", createFastSGPRRegisterAllocator);
383static VGPRRegisterRegAlloc basicRegAllocVGPR(
384 "basic",
"basic register allocator", createBasicVGPRRegisterAllocator);
385static VGPRRegisterRegAlloc greedyRegAllocVGPR(
386 "greedy",
"greedy register allocator", createGreedyVGPRRegisterAllocator);
388static VGPRRegisterRegAlloc fastRegAllocVGPR(
389 "fast",
"fast register allocator", createFastVGPRRegisterAllocator);
390static WWMRegisterRegAlloc basicRegAllocWWMReg(
"basic",
391 "basic register allocator",
392 createBasicWWMRegisterAllocator);
393static WWMRegisterRegAlloc
394 greedyRegAllocWWMReg(
"greedy",
"greedy register allocator",
395 createGreedyWWMRegisterAllocator);
396static WWMRegisterRegAlloc fastRegAllocWWMReg(
"fast",
"fast register allocator",
397 createFastWWMRegisterAllocator);
400 return Phase == ThinOrFullLTOPhase::FullLTOPreLink ||
401 Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
407 cl::desc(
"Run early if-conversion"),
412 cl::desc(
"Run pre-RA exec mask optimizations"),
417 cl::desc(
"Lower GPU ctor / dtors to globals on the device."),
422 "amdgpu-load-store-vectorizer",
423 cl::desc(
"Enable load store vectorizer"),
429 "amdgpu-scalarize-global-loads",
430 cl::desc(
"Enable global load scalarization"),
436 "amdgpu-internalize-symbols",
437 cl::desc(
"Enable elimination of non-kernel functions and unused globals"),
443 "amdgpu-early-inline-all",
444 cl::desc(
"Inline all functions early"),
449 "amdgpu-enable-remove-incompatible-functions",
cl::Hidden,
450 cl::desc(
"Enable removal of functions when they"
451 "use features not supported by the target GPU"),
455 "amdgpu-sdwa-peephole",
460 "amdgpu-dpp-combine",
466 cl::desc(
"Enable AMDGPU Alias Analysis"),
471 "amdgpu-simplify-libcall",
472 cl::desc(
"Enable amdgpu library simplifications"),
477 "amdgpu-ir-lower-kernel-arguments",
478 cl::desc(
"Lower kernel argument loads in IR pass"),
483 "amdgpu-reassign-regs",
484 cl::desc(
"Enable register reassign optimizations on gfx10+"),
489 "amdgpu-opt-vgpr-liverange",
490 cl::desc(
"Enable VGPR liverange optimizations for if-else structure"),
494 "amdgpu-atomic-optimizer-strategy",
495 cl::desc(
"Select DPP or Iterative strategy for scan"),
500 "Use Iterative approach for scan"),
505 "amdgpu-mode-register",
506 cl::desc(
"Enable mode register pass"),
513 cl::desc(
"Enable s_delay_alu insertion"),
519 cl::desc(
"Enable VOPD, dual issue of VALU in wave32"),
526 cl::desc(
"Enable machine DCE inside regalloc"));
533 "amdgpu-scalar-ir-passes",
534 cl::desc(
"Enable scalar IR passes"),
539 "amdgpu-enable-lower-exec-sync",
545 cl::desc(
"Enable lowering of lds to global memory pass "
546 "and asan instrument resulting IR."),
550 "amdgpu-enable-lower-module-lds",
cl::desc(
"Enable lower module lds pass"),
555 "amdgpu-enable-pre-ra-optimizations",
560 "amdgpu-enable-promote-kernel-arguments",
561 cl::desc(
"Enable promotion of flat kernel pointer arguments to global"),
565 "amdgpu-enable-image-intrinsic-optimizer",
571 cl::desc(
"Enable loop data prefetch on AMDGPU"),
576 cl::desc(
"Select custom AMDGPU scheduling strategy."),
583 Attribute SchedStrategyAttr =
F.getFnAttribute(
"amdgpu-sched-strategy");
584 if (SchedStrategyAttr.
isValid())
596 if (ST.hasGFX1250Insts())
600 F,
"'amdgpu-sched-strategy'='coexec' is only supported for gfx1250",
606 F.getFnAttribute(
"amdgpu-post-sched-strategy");
607 return PostSchedStrategyAttr.
isValid() &&
612 "amdgpu-enable-rewrite-partial-reg-uses",
617 "amdgpu-enable-hipstdpar",
618 cl::desc(
"Enable HIP Standard Parallelism Offload support"),
cl::init(
false),
623 cl::desc(
"Enable AMDGPUAttributorPass"),
627 "new-reg-bank-select",
628 cl::desc(
"Run amdgpu-regbankselect and amdgpu-regbanklegalize instead of "
633 "amdgpu-link-time-closed-world",
634 cl::desc(
"Whether has closed-world assumption at link time"),
638 "amdgpu-enable-uniform-intrinsic-combine",
639 cl::desc(
"Enable/Disable the Uniform Intrinsic Combine Pass"),
733 return std::make_unique<AMDGPUTargetObjectFile>();
740static ScheduleDAGInstrs *
746 if (ST.shouldClusterStores())
756static ScheduleDAGInstrs *
764static ScheduleDAGInstrs *
768 C, std::make_unique<GCNMaxMemoryClauseSchedStrategy>(
C));
770 if (ST.shouldClusterStores())
778static ScheduleDAGInstrs *
784 if (ST.shouldClusterStores())
797static ScheduleDAGInstrs *
802 if (ST.shouldClusterStores())
809static MachineSchedRegistry
815 "Run GCN scheduler to maximize occupancy",
823 "gcn-max-memory-clause",
"Run GCN scheduler to maximize memory clause",
827 "gcn-iterative-max-occupancy-experimental",
828 "Run GCN scheduler to maximize occupancy (experimental)",
832 "gcn-iterative-minreg",
833 "Run GCN iterative scheduler for minimal register usage (experimental)",
838 "Run GCN iterative scheduler for ILP scheduling (experimental)",
862 std::optional<Reloc::Model>
RM,
863 std::optional<CodeModel::Model> CM,
885 Attribute GPUAttr =
F.getFnAttribute(
"target-cpu");
890 Attribute FSAttr =
F.getFnAttribute(
"target-features");
901 if (ST.shouldClusterStores())
909 return F->isDeclaration() ||
F->getName().starts_with(
"__asan_") ||
910 F->getName().starts_with(
"__sanitizer_") ||
940 while (!Params.
empty()) {
942 std::tie(ParamName, Params) = Params.
split(
';');
943 if (ParamName ==
"closed-world") {
944 Result.IsClosedWorld =
true;
947 formatv(
"invalid AMDGPUAttributor pass parameter '{0}' ", ParamName)
957#define GET_PASS_REGISTRY "AMDGPUPassRegistry.def"
960 PB.registerPipelineParsingCallback(
963 if (Name ==
"amdgpu-attributor-cgscc" &&
getTargetTriple().isAMDGCN()) {
971 PB.registerScalarOptimizerLateEPCallback(
979 PB.registerVectorizerEndEPCallback(
987 PB.registerPipelineEarlySimplificationEPCallback(
1015 PB.registerPeepholeEPCallback(
1028 PB.registerCGSCCOptimizerLateEPCallback(
1074 PB.registerFullLinkTimeOptimizationLastEPCallback(
1120 PB.registerRegClassFilterParsingCallback(
1122 if (FilterName ==
"sgpr")
1123 return onlyAllocateSGPRs;
1124 if (FilterName ==
"vgpr")
1125 return onlyAllocateVGPRs;
1126 if (FilterName ==
"wwm")
1127 return onlyAllocateWWMRegs;
1133 unsigned DestAS)
const {
1142 !Arg->hasByRefAttr())
1152 const auto *Ptr = LD->getPointerOperand();
1162std::pair<const Value *, unsigned>
1165 switch (
II->getIntrinsicID()) {
1166 case Intrinsic::amdgcn_is_shared:
1168 case Intrinsic::amdgcn_is_private:
1173 return std::pair(
nullptr, -1);
1180 const_cast<Value *
>(V),
1186 return std::pair(
nullptr, -1);
1206 Module &M,
unsigned NumParts,
1207 function_ref<
void(std::unique_ptr<Module> MPart)> ModuleCallback) {
1218 PB.registerModuleAnalyses(
MAM);
1219 PB.registerFunctionAnalyses(
FAM);
1235 std::optional<Reloc::Model>
RM,
1236 std::optional<CodeModel::Model> CM,
1248 auto &
I = SubtargetMap[SubtargetKey];
1254 I = std::make_unique<GCNSubtarget>(
TargetTriple, GPU, FS, *
this);
1272 AMDGPUCodeGenPassBuilder CGPB(*
this, Opts,
PIC);
1273 return CGPB.buildPipeline(MPM,
MAM, Out, DwoOut, FileType, Ctx);
1279 if (ST.enableSIScheduler())
1284 if (SchedStrategy ==
"max-ilp")
1287 if (SchedStrategy ==
"max-memory-clause")
1290 if (SchedStrategy ==
"iterative-ilp")
1293 if (SchedStrategy ==
"iterative-minreg")
1296 if (SchedStrategy ==
"iterative-maxocc")
1299 if (SchedStrategy ==
"coexec") {
1317 if (ST.shouldClusterStores())
1350 bool addPreISel()
override;
1351 void addMachineSSAOptimization()
override;
1352 bool addILPOpts()
override;
1353 bool addInstSelector()
override;
1354 bool addIRTranslator()
override;
1355 void addPreLegalizeMachineIR()
override;
1356 bool addLegalizeMachineIR()
override;
1357 void addPreRegBankSelect()
override;
1358 bool addRegBankSelect()
override;
1359 void addPreGlobalInstructionSelect()
override;
1360 bool addGlobalInstructionSelect()
override;
1361 void addPreRegAlloc()
override;
1362 void addFastRegAlloc()
override;
1363 void addOptimizedRegAlloc()
override;
1365 FunctionPass *createSGPRAllocPass(
bool Optimized);
1366 FunctionPass *createVGPRAllocPass(
bool Optimized);
1367 FunctionPass *createWWMRegAllocPass(
bool Optimized);
1368 FunctionPass *createRegAllocPass(
bool Optimized)
override;
1370 bool addRegAssignAndRewriteFast()
override;
1371 bool addRegAssignAndRewriteOptimized()
override;
1373 bool addPreRewrite()
override;
1374 void addPostRegAlloc()
override;
1375 void addPreSched2()
override;
1376 void addPreEmitPass()
override;
1377 void addPostBBSections()
override;
1428 if (
TM.getTargetTriple().isAMDGCN())
1434 if (
TM.getTargetTriple().isAMDGCN() &&
1470 if ((
TM.getTargetTriple().isAMDGCN()) &&
1493 if (
TM.getTargetTriple().isAMDGCN()) {
1523 if (
TM->getTargetTriple().isAMDGCN() &&
1535 if (
TM->getTargetTriple().isAMDGCN()) {
1574bool GCNPassConfig::addPreISel() {
1609void GCNPassConfig::addMachineSSAOptimization() {
1633bool GCNPassConfig::addILPOpts() {
1641bool GCNPassConfig::addInstSelector() {
1648bool GCNPassConfig::addIRTranslator() {
1653void GCNPassConfig::addPreLegalizeMachineIR() {
1659bool GCNPassConfig::addLegalizeMachineIR() {
1664void GCNPassConfig::addPreRegBankSelect() {
1670bool GCNPassConfig::addRegBankSelect() {
1680void GCNPassConfig::addPreGlobalInstructionSelect() {
1685bool GCNPassConfig::addGlobalInstructionSelect() {
1690void GCNPassConfig::addFastRegAlloc() {
1704void GCNPassConfig::addPreRegAlloc() {
1709void GCNPassConfig::addOptimizedRegAlloc() {
1746bool GCNPassConfig::addPreRewrite() {
1754FunctionPass *GCNPassConfig::createSGPRAllocPass(
bool Optimized) {
1757 initializeDefaultSGPRRegisterAllocatorOnce);
1769FunctionPass *GCNPassConfig::createVGPRAllocPass(
bool Optimized) {
1772 initializeDefaultVGPRRegisterAllocatorOnce);
1779 return createGreedyVGPRRegisterAllocator();
1781 return createFastVGPRRegisterAllocator();
1784FunctionPass *GCNPassConfig::createWWMRegAllocPass(
bool Optimized) {
1787 initializeDefaultWWMRegisterAllocatorOnce);
1794 return createGreedyWWMRegisterAllocator();
1796 return createFastWWMRegisterAllocator();
1799FunctionPass *GCNPassConfig::createRegAllocPass(
bool Optimized) {
1804 "-regalloc not supported with amdgcn. Use -sgpr-regalloc, -wwm-regalloc, "
1805 "and -vgpr-regalloc";
1807bool GCNPassConfig::addRegAssignAndRewriteFast() {
1808 if (!usingDefaultRegAlloc())
1813 addPass(createSGPRAllocPass(
false));
1822 addPass(createWWMRegAllocPass(
false));
1828 addPass(createVGPRAllocPass(
false));
1833bool GCNPassConfig::addRegAssignAndRewriteOptimized() {
1834 if (!usingDefaultRegAlloc())
1839 addPass(createSGPRAllocPass(
true));
1859 addPass(createWWMRegAllocPass(
true));
1865 addPass(createVGPRAllocPass(
true));
1875void GCNPassConfig::addPostRegAlloc() {
1882void GCNPassConfig::addPreSched2() {
1888void GCNPassConfig::addPreEmitPass() {
1924void GCNPassConfig::addPostBBSections() {
1931 return new GCNPassConfig(*
this, PM);
1970 if (MFI->Occupancy == 0) {
1972 MFI->Occupancy = ST.getOccupancyWithWorkGroupSizes(MF).second;
1978 SourceRange =
RegName.SourceRange;
1991 if (parseOptionalRegister(YamlMFI.
VGPRForAGPRCopy, MFI->VGPRForAGPRCopy))
1994 if (parseOptionalRegister(YamlMFI.
SGPRForEXECCopy, MFI->SGPRForEXECCopy))
1998 MFI->LongBranchReservedReg))
2007 "incorrect register class for field",
RegName.Value,
2009 SourceRange =
RegName.SourceRange;
2013 if (parseRegister(YamlMFI.
ScratchRSrcReg, MFI->ScratchRSrcReg) ||
2018 if (MFI->ScratchRSrcReg != AMDGPU::PRIVATE_RSRC_REG &&
2019 !AMDGPU::SGPR_128RegClass.contains(MFI->ScratchRSrcReg)) {
2023 if (MFI->FrameOffsetReg != AMDGPU::FP_REG &&
2024 !AMDGPU::SGPR_32RegClass.contains(MFI->FrameOffsetReg)) {
2028 if (MFI->StackPtrOffsetReg != AMDGPU::SP_REG &&
2029 !AMDGPU::SGPR_32RegClass.contains(MFI->StackPtrOffsetReg)) {
2035 if (parseRegister(YamlReg, ParsedReg))
2042 MFI->
setFlag(Info->VReg, Info->Flags);
2044 for (
const auto &[
_, Info] : PFS.
VRegInfos) {
2045 MFI->
setFlag(Info->VReg, Info->Flags);
2050 if (parseRegister(YamlRegStr, ParsedReg))
2052 MFI->SpillPhysVGPRs.push_back(ParsedReg);
2055 auto parseAndCheckArgument = [&](
const std::optional<yaml::SIArgument> &
A,
2058 unsigned SystemSGPRs) {
2063 if (
A->IsRegister) {
2066 SourceRange =
A->RegisterName.SourceRange;
2069 if (!RC.contains(Reg))
2070 return diagnoseRegisterClass(
A->RegisterName);
2078 MFI->NumUserSGPRs += UserSGPRs;
2079 MFI->NumSystemSGPRs += SystemSGPRs;
2084 (parseAndCheckArgument(YamlMFI.
ArgInfo->PrivateSegmentBuffer,
2085 AMDGPU::SGPR_128RegClass,
2087 parseAndCheckArgument(YamlMFI.
ArgInfo->DispatchPtr,
2088 AMDGPU::SReg_64RegClass, MFI->ArgInfo.
DispatchPtr,
2090 parseAndCheckArgument(YamlMFI.
ArgInfo->QueuePtr, AMDGPU::SReg_64RegClass,
2092 parseAndCheckArgument(YamlMFI.
ArgInfo->KernargSegmentPtr,
2093 AMDGPU::SReg_64RegClass,
2095 parseAndCheckArgument(YamlMFI.
ArgInfo->DispatchID,
2096 AMDGPU::SReg_64RegClass, MFI->ArgInfo.
DispatchID,
2098 parseAndCheckArgument(YamlMFI.
ArgInfo->FlatScratchInit,
2099 AMDGPU::SReg_64RegClass,
2101 parseAndCheckArgument(YamlMFI.
ArgInfo->PrivateSegmentSize,
2102 AMDGPU::SGPR_32RegClass,
2104 parseAndCheckArgument(YamlMFI.
ArgInfo->LDSKernelId,
2105 AMDGPU::SGPR_32RegClass,
2107 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkGroupIDX,
2110 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkGroupIDY,
2113 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkGroupIDZ,
2116 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkGroupInfo,
2117 AMDGPU::SGPR_32RegClass,
2119 parseAndCheckArgument(YamlMFI.
ArgInfo->PrivateSegmentWaveByteOffset,
2120 AMDGPU::SGPR_32RegClass,
2122 parseAndCheckArgument(YamlMFI.
ArgInfo->ImplicitArgPtr,
2123 AMDGPU::SReg_64RegClass,
2125 parseAndCheckArgument(YamlMFI.
ArgInfo->ImplicitBufferPtr,
2126 AMDGPU::SReg_64RegClass,
2128 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkItemIDX,
2129 AMDGPU::VGPR_32RegClass,
2131 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkItemIDY,
2132 AMDGPU::VGPR_32RegClass,
2134 parseAndCheckArgument(YamlMFI.
ArgInfo->WorkItemIDZ,
2135 AMDGPU::VGPR_32RegClass,
2141 if (YamlMFI.
ArgInfo && YamlMFI.
ArgInfo->FirstKernArgPreloadReg) {
2144 if (!
A.IsRegister) {
2155 "firstKernArgPreloadReg must be a register, not a stack location",
"",
2158 SourceRange =
Range;
2164 SourceRange =
A.RegisterName.SourceRange;
2168 if (!AMDGPU::SGPR_32RegClass.
contains(Reg))
2169 return diagnoseRegisterClass(
A.RegisterName);
2175 if (ST.hasFeature(AMDGPU::FeatureDX10ClampAndIEEEMode)) {
2205AMDGPUCodeGenPassBuilder::AMDGPUCodeGenPassBuilder(
2209 Opt.MISchedPostRA =
true;
2210 Opt.RequiresCodeGenSCCOrder =
true;
2220 flushFPMsToMPM(PMW);
2224 flushFPMsToMPM(PMW);
2226 if (TM.getTargetTriple().isAMDGCN())
2239 flushFPMsToMPM(PMW);
2268 addStraightLineScalarOptimizationPasses(PMW);
2284 Base::addIRPasses(PMW);
2299 addEarlyCSEOrGVNPass(PMW);
2302void AMDGPUCodeGenPassBuilder::addCodeGenPrepare(
2305 flushFPMsToMPM(PMW);
2312 Base::addCodeGenPrepare(PMW);
2324 flushFPMsToMPM(PMW);
2326 flushFPMsToMPM(PMW);
2327 requireCGSCCOrder(PMW);
2368 flushFPMsToMPM(PMW);
2382 Base::addILPOpts(PMW);
2385void AMDGPUCodeGenPassBuilder::addAsmPrinterBegin(
2413void AMDGPUCodeGenPassBuilder::addMachineSSAOptimization(
2415 Base::addMachineSSAOptimization(PMW);
2437 return Base::addFastRegAlloc(PMW);
2440Error AMDGPUCodeGenPassBuilder::addRegAssignmentFast(
2442 if (
auto Err = validateRegAllocOptions())
2449 addMachineFunctionPass(RAGreedyPass({onlyAllocateSGPRs,
"sgpr"}), PMW);
2451 addMachineFunctionPass(
RegAllocFastPass({onlyAllocateSGPRs,
"sgpr",
false}),
2462 addMachineFunctionPass(RAGreedyPass({onlyAllocateWWMRegs,
"wwm"}), PMW);
2464 addMachineFunctionPass(
2472 addMachineFunctionPass(RAGreedyPass({onlyAllocateVGPRs,
"vgpr"}), PMW);
2474 addMachineFunctionPass(
RegAllocFastPass({onlyAllocateVGPRs,
"vgpr"}), PMW);
2479Error AMDGPUCodeGenPassBuilder::addOptimizedRegAlloc(
2489 insertPass<RequireAnalysisPass<LiveVariablesAnalysis, MachineFunction>>(
2515 return Base::addOptimizedRegAlloc(PMW);
2523Error AMDGPUCodeGenPassBuilder::addRegAssignmentOptimized(
2525 if (
auto Err = validateRegAllocOptions())
2532 addMachineFunctionPass(
RegAllocFastPass({onlyAllocateSGPRs,
"sgpr",
false}),
2535 addMachineFunctionPass(RAGreedyPass({onlyAllocateSGPRs,
"sgpr"}), PMW);
2556 addMachineFunctionPass(
2559 addMachineFunctionPass(RAGreedyPass({onlyAllocateWWMRegs,
"wwm"}), PMW);
2566 addMachineFunctionPass(
RegAllocFastPass({onlyAllocateVGPRs,
"vgpr"}), PMW);
2568 addMachineFunctionPass(RAGreedyPass({onlyAllocateVGPRs,
"vgpr"}), PMW);
2581 Base::addPostRegAlloc(PMW);
2590void AMDGPUCodeGenPassBuilder::addPostBBSections(
2637bool AMDGPUCodeGenPassBuilder::isPassEnabled(
const cl::opt<bool> &Opt,
2641 if (TM.getOptLevel() < Level)
2646void AMDGPUCodeGenPassBuilder::addEarlyCSEOrGVNPass(
2649 addFunctionPass(
GVNPass(), PMW);
2654void AMDGPUCodeGenPassBuilder::addStraightLineScalarOptimizationPasses(
2667 addEarlyCSEOrGVNPass(PMW);
aarch64 falkor hwpf fix Falkor HW Prefetch Fix Late Phase
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > EnableEarlyIfConversion("aarch64-enable-early-ifcvt", cl::Hidden, cl::desc("Run early if-conversion"), cl::init(true))
static std::unique_ptr< TargetLoweringObjectFile > createTLOF(const Triple &TT)
This is the AMGPU address space based alias analysis pass.
Coexecution-focused scheduling strategy for AMDGPU.
Defines an instruction selector for the AMDGPU target.
Analyzes if a function potentially memory bound and if a kernel kernel may benefit from limiting numb...
Analyzes how many registers and other resources are used by functions.
static cl::opt< bool > EnableDCEInRA("amdgpu-dce-in-ra", cl::init(true), cl::Hidden, cl::desc("Enable machine DCE inside regalloc"))
static cl::opt< bool, true > EnableLowerModuleLDS("amdgpu-enable-lower-module-lds", cl::desc("Enable lower module lds pass"), cl::location(AMDGPUTargetMachine::EnableLowerModuleLDS), cl::init(true), cl::Hidden)
static MachineSchedRegistry GCNMaxMemoryClauseSchedRegistry("gcn-max-memory-clause", "Run GCN scheduler to maximize memory clause", createGCNMaxMemoryClauseMachineScheduler)
static Reloc::Model getEffectiveRelocModel()
static cl::opt< bool > EnableUniformIntrinsicCombine("amdgpu-enable-uniform-intrinsic-combine", cl::desc("Enable/Disable the Uniform Intrinsic Combine Pass"), cl::init(true), cl::Hidden)
static MachineSchedRegistry SISchedRegistry("si", "Run SI's custom scheduler", createSIMachineScheduler)
static ScheduleDAGInstrs * createIterativeILPMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EarlyInlineAll("amdgpu-early-inline-all", cl::desc("Inline all functions early"), cl::init(false), cl::Hidden)
static cl::opt< bool > EnableSwLowerLDS("amdgpu-enable-sw-lower-lds", cl::desc("Enable lowering of lds to global memory pass " "and asan instrument resulting IR."), cl::init(true), cl::Hidden)
static cl::opt< bool > EnableLowerKernelArguments("amdgpu-ir-lower-kernel-arguments", cl::desc("Lower kernel argument loads in IR pass"), cl::init(true), cl::Hidden)
static ScheduleDAGInstrs * createGCNMaxILPMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EnableSDWAPeephole("amdgpu-sdwa-peephole", cl::desc("Enable SDWA peepholer"), cl::init(true))
static MachineSchedRegistry GCNMinRegSchedRegistry("gcn-iterative-minreg", "Run GCN iterative scheduler for minimal register usage (experimental)", createMinRegScheduler)
static void diagnoseUnsupportedCoExecSchedulerSelection(const Function &F, const GCNSubtarget &ST)
static cl::opt< bool > EnableImageIntrinsicOptimizer("amdgpu-enable-image-intrinsic-optimizer", cl::desc("Enable image intrinsic optimizer pass"), cl::init(true), cl::Hidden)
static cl::opt< bool > HasClosedWorldAssumption("amdgpu-link-time-closed-world", cl::desc("Whether has closed-world assumption at link time"), cl::init(false), cl::Hidden)
static bool useNoopPostScheduler(const Function &F)
static ScheduleDAGInstrs * createGCNMaxMemoryClauseMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EnableSIModeRegisterPass("amdgpu-mode-register", cl::desc("Enable mode register pass"), cl::init(true), cl::Hidden)
static cl::opt< std::string > AMDGPUSchedStrategy("amdgpu-sched-strategy", cl::desc("Select custom AMDGPU scheduling strategy."), cl::Hidden, cl::init(""))
static cl::opt< bool > EnableDPPCombine("amdgpu-dpp-combine", cl::desc("Enable DPP combiner"), cl::init(true))
static MachineSchedRegistry IterativeGCNMaxOccupancySchedRegistry("gcn-iterative-max-occupancy-experimental", "Run GCN scheduler to maximize occupancy (experimental)", createIterativeGCNMaxOccupancyMachineScheduler)
static cl::opt< bool > EnableSetWavePriority("amdgpu-set-wave-priority", cl::desc("Adjust wave priority"), cl::init(false), cl::Hidden)
static cl::opt< bool > LowerCtorDtor("amdgpu-lower-global-ctor-dtor", cl::desc("Lower GPU ctor / dtors to globals on the device."), cl::init(true), cl::Hidden)
static cl::opt< bool > OptExecMaskPreRA("amdgpu-opt-exec-mask-pre-ra", cl::Hidden, cl::desc("Run pre-RA exec mask optimizations"), cl::init(true))
static cl::opt< bool > EnablePromoteKernelArguments("amdgpu-enable-promote-kernel-arguments", cl::desc("Enable promotion of flat kernel pointer arguments to global"), cl::Hidden, cl::init(true))
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget()
static cl::opt< bool > EnableRewritePartialRegUses("amdgpu-enable-rewrite-partial-reg-uses", cl::desc("Enable rewrite partial reg uses pass"), cl::init(true), cl::Hidden)
static cl::opt< bool > EnableLibCallSimplify("amdgpu-simplify-libcall", cl::desc("Enable amdgpu library simplifications"), cl::init(true), cl::Hidden)
static MachineSchedRegistry GCNMaxILPSchedRegistry("gcn-max-ilp", "Run GCN scheduler to maximize ilp", createGCNMaxILPMachineScheduler)
static cl::opt< bool > InternalizeSymbols("amdgpu-internalize-symbols", cl::desc("Enable elimination of non-kernel functions and unused globals"), cl::init(false), cl::Hidden)
static cl::opt< bool > EnableAMDGPUAttributor("amdgpu-attributor-enable", cl::desc("Enable AMDGPUAttributorPass"), cl::init(true), cl::Hidden)
static LLVM_READNONE StringRef getGPUOrDefault(const Triple &TT, StringRef GPU)
Expected< AMDGPUAttributorOptions > parseAMDGPUAttributorPassOptions(StringRef Params)
static cl::opt< bool > EnableAMDGPUAliasAnalysis("enable-amdgpu-aa", cl::Hidden, cl::desc("Enable AMDGPU Alias Analysis"), cl::init(true))
static Expected< ScanOptions > parseAMDGPUAtomicOptimizerStrategy(StringRef Params)
static ScheduleDAGInstrs * createMinRegScheduler(MachineSchedContext *C)
static cl::opt< bool > EnableHipStdPar("amdgpu-enable-hipstdpar", cl::desc("Enable HIP Standard Parallelism Offload support"), cl::init(false), cl::Hidden)
static cl::opt< bool > EnableInsertDelayAlu("amdgpu-enable-delay-alu", cl::desc("Enable s_delay_alu insertion"), cl::init(true), cl::Hidden)
static ScheduleDAGInstrs * createIterativeGCNMaxOccupancyMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EnableLoadStoreVectorizer("amdgpu-load-store-vectorizer", cl::desc("Enable load store vectorizer"), cl::init(true), cl::Hidden)
static bool mustPreserveGV(const GlobalValue &GV)
Predicate for Internalize pass.
static cl::opt< bool > EnableLoopPrefetch("amdgpu-loop-prefetch", cl::desc("Enable loop data prefetch on AMDGPU"), cl::Hidden, cl::init(false))
static cl::opt< bool > NewRegBankSelect("new-reg-bank-select", cl::desc("Run amdgpu-regbankselect and amdgpu-regbanklegalize instead of " "regbankselect"), cl::init(false), cl::Hidden)
static cl::opt< bool > RemoveIncompatibleFunctions("amdgpu-enable-remove-incompatible-functions", cl::Hidden, cl::desc("Enable removal of functions when they" "use features not supported by the target GPU"), cl::init(true))
static cl::opt< bool > EnableScalarIRPasses("amdgpu-scalar-ir-passes", cl::desc("Enable scalar IR passes"), cl::init(true), cl::Hidden)
static cl::opt< bool > EnableRegReassign("amdgpu-reassign-regs", cl::desc("Enable register reassign optimizations on gfx10+"), cl::init(true), cl::Hidden)
static cl::opt< bool > OptVGPRLiveRange("amdgpu-opt-vgpr-liverange", cl::desc("Enable VGPR liverange optimizations for if-else structure"), cl::init(true), cl::Hidden)
static ScheduleDAGInstrs * createSIMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EnablePreRAOptimizations("amdgpu-enable-pre-ra-optimizations", cl::desc("Enable Pre-RA optimizations pass"), cl::init(true), cl::Hidden)
static cl::opt< ScanOptions > AMDGPUAtomicOptimizerStrategy("amdgpu-atomic-optimizer-strategy", cl::desc("Select DPP or Iterative strategy for scan"), cl::init(ScanOptions::Iterative), cl::values(clEnumValN(ScanOptions::DPP, "DPP", "Use DPP operations for scan"), clEnumValN(ScanOptions::Iterative, "Iterative", "Use Iterative approach for scan"), clEnumValN(ScanOptions::None, "None", "Disable atomic optimizer")))
static cl::opt< bool > EnableVOPD("amdgpu-enable-vopd", cl::desc("Enable VOPD, dual issue of VALU in wave32"), cl::init(true), cl::Hidden)
static ScheduleDAGInstrs * createGCNMaxOccupancyMachineScheduler(MachineSchedContext *C)
static cl::opt< bool > EnableLowerExecSync("amdgpu-enable-lower-exec-sync", cl::desc("Enable lowering of execution synchronization."), cl::init(true), cl::Hidden)
static MachineSchedRegistry GCNILPSchedRegistry("gcn-iterative-ilp", "Run GCN iterative scheduler for ILP scheduling (experimental)", createIterativeILPMachineScheduler)
static cl::opt< bool > ScalarizeGlobal("amdgpu-scalarize-global-loads", cl::desc("Enable global load scalarization"), cl::init(true), cl::Hidden)
static const char RegAllocOptNotSupportedMessage[]
static MachineSchedRegistry GCNMaxOccupancySchedRegistry("gcn-max-occupancy", "Run GCN scheduler to maximize occupancy", createGCNMaxOccupancyMachineScheduler)
The AMDGPU TargetMachine interface definition for hw codegen targets.
This file declares the AMDGPU-specific subclass of TargetLoweringObjectFile.
Provides passes to inlining "always_inline" functions.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
This header provides classes for managing passes over SCCs of the call graph.
Provides analysis for continuously CSEing during GISel passes.
Interfaces for producing common pass manager configurations.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
#define LLVM_EXTERNAL_VISIBILITY
This file provides the interface for a simple, fast CSE pass.
This file defines the class GCNIterativeScheduler, which uses an iterative approach to find a best sc...
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This file declares the IRTranslator pass.
This header defines various interfaces for pass management in LLVM.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
Register const TargetRegisterInfo * TRI
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
uint64_t IntrinsicInst * II
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassInstrumentationCallbacks PIC
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isLTOPreLink(ThinOrFullLTOPhase Phase)
The AMDGPU TargetMachine interface definition for hw codegen targets.
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
const GCNTargetMachine & getTM(const GCNSubtarget *STI)
SI Machine Scheduler interface.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static FunctionPass * useDefaultRegisterAllocator()
-regalloc=... command line option.
static cl::opt< cl::boolOrDefault > EnableGlobalISelOption("global-isel", cl::Hidden, cl::desc("Enable the \"global\" instruction selector"))
Target-Independent Code Generator Pass Configuration Options pass.
static std::unique_ptr< TargetLoweringObjectFile > createTLOF()
A manager for alias analyses.
void registerFunctionAnalysis()
Register a specific AA result.
void addAAResult(AAResultT &AAResult)
Register a specific AA result.
Legacy wrapper pass to provide the AMDGPUAAResult object.
Analysis pass providing a never-invalidated alias analysis result.
Lower llvm.global_ctors and llvm.global_dtors to special kernels.
AMDGPUTargetMachine & getAMDGPUTargetMachine() const
std::unique_ptr< CSEConfigBase > getCSEConfig() const override
Returns the CSEConfig object to use for the current optimization level.
bool isPassEnabled(const cl::opt< bool > &Opt, CodeGenOptLevel Level=CodeGenOptLevel::Default) const
Check if a pass is enabled given Opt option.
bool addPreISel() override
Methods with trivial inline returns are convenient points in the common codegen pass pipeline where t...
bool addInstSelector() override
addInstSelector - This method should install an instruction selector pass, which converts from LLVM c...
bool addGCPasses() override
addGCPasses - Add late codegen passes that analyze code for garbage collection.
void addStraightLineScalarOptimizationPasses()
AMDGPUPassConfig(TargetMachine &TM, PassManagerBase &PM)
void addIRPasses() override
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
void addEarlyCSEOrGVNPass()
void addCodeGenPrepare() override
Add pass to prepare the LLVM IR for code generation.
Splits the module M into N linkable partitions.
std::unique_ptr< TargetLoweringObjectFile > TLOF
unsigned getAddressSpaceForPseudoSourceKind(unsigned Kind) const override
getAddressSpaceForPseudoSourceKind - Given the kind of memory (e.g.
const TargetSubtargetInfo * getSubtargetImpl() const
void registerDefaultAliasAnalyses(AAManager &) override
Allow the target to register alias analyses with the AAManager for use with the new pass manager.
~AMDGPUTargetMachine() override
std::pair< const Value *, unsigned > getPredicatedAddrSpace(const Value *V) const override
If the specified predicate checks whether a generic pointer falls within a specified address space,...
StringRef getFeatureString(const Function &F) const
ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const override
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
static bool EnableFunctionCalls
AMDGPUTargetMachine(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 isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast between SrcAS and DestAS is a noop.
void registerPassBuilderCallbacks(PassBuilder &PB) override
Allow the target to modify the pass pipeline.
static bool EnableLowerModuleLDS
StringRef getGPUName(const Function &F) const
unsigned getAssumedAddrSpace(const Value *V) const override
If the specified generic pointer could be assumed as a pointer to a specific address space,...
bool splitModule(Module &M, unsigned NumParts, function_ref< void(std::unique_ptr< Module > MPart)> ModuleCallback) override
Entry point for module splitting.
Inlines functions marked as "always_inline".
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Functions, function parameters, and return types can have attributes to indicate how they should be t...
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.
This class provides access to building LLVM's passes.
CodeGenTargetMachineImpl(const Target &T, StringRef DataLayoutString, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOptLevel OL)
LLVM_ABI void removeDeadConstantUsers() const
If there are any dead constant users dangling off of this constant, remove them.
Diagnostic information for unsupported feature in backend.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
FunctionPass class - This class is used to implement most global optimizations.
LowerIntrinsics - This pass rewrites calls to the llvm.gcread or llvm.gcwrite intrinsics,...
@ SCHEDULE_LEGACYMAXOCCUPANCY
const SIRegisterInfo * getRegisterInfo() const override
TargetTransformInfo getTargetTransformInfo(const Function &F) const override
Get a TargetTransformInfo implementation for the target.
ScheduleDAGInstrs * createPostMachineScheduler(MachineSchedContext *C) const override
Similar to createMachineScheduler but used when postRA machine scheduling is enabled.
ScheduleDAGInstrs * createMachineScheduler(MachineSchedContext *C) const override
Create an instance of ScheduleDAGInstrs to be run within the standard MachineScheduler pass for this ...
void registerMachineRegisterInfoCallback(MachineFunction &MF) const override
bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange) const override
Parse out the target's MachineFunctionInfo from the YAML reprsentation.
yaml::MachineFunctionInfo * convertFuncInfoToYAML(const MachineFunction &MF) const override
Allocate and initialize an instance of the YAML representation of the MachineFunctionInfo.
yaml::MachineFunctionInfo * createDefaultFuncInfoYAML() const override
Allocate and return a default initialized instance of the YAML representation for the MachineFunction...
Error buildCodeGenPipeline(ModulePassManager &MPM, ModuleAnalysisManager &MAM, raw_pwrite_stream &Out, raw_pwrite_stream *DwoOut, CodeGenFileType FileType, const CGPassBuilderOption &Opts, MCContext &Ctx, PassInstrumentationCallbacks *PIC) override
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
GCNTargetMachine(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)
MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override
Create the target's instance of MachineFunctionInfo.
The core GVN pass object.
Pass to remove unused function declarations.
This pass is responsible for selecting generic machine instructions to target-specific instructions.
A pass that internalizes all functions and variables other than those that must be preserved accordin...
Converts loops into loop-closed SSA form.
Performs Loop Invariant Code Motion Pass.
This pass implements the localization mechanism described at the top of this file.
An optimization pass inserting data prefetches in loops.
Context object for machine code objects.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
void addDelegate(Delegate *delegate)
const MachineFunction & getMF() const
MachineSchedRegistry provides a selection of available machine instruction schedulers.
This interface provides simple read-only access to a block of memory, and provides simple methods for...
virtual StringRef getBufferIdentifier() const
Return an identifier for this buffer, typically the filename it was read from.
const char * getBufferStart() const
A Module instance is used to store all the information related to an LLVM module.
static LLVM_ABI const OptimizationLevel O0
Disable as many optimizations as possible.
static LLVM_ABI const OptimizationLevel O1
Optimize quickly without destroying debuggability.
This class provides access to building LLVM's passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
PreservedAnalyses run(IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs)
Run all of the passes in this manager over the given unit of IR.
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...
Pass interface - Implemented by all 'passes'.
@ ExternalSymbolCallEntry
This pass implements the reg bank selector pass used in the GlobalISel pipeline.
RegisterPassParser class - Handle the addition of new machine passes.
RegisterRegAllocBase class - Track the registration of register allocators.
FunctionPass *(*)() FunctionPassCtor
Wrapper class representing virtual and physical registers.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
bool initializeBaseYamlFields(const yaml::SIMachineFunctionInfo &YamlMFI, const MachineFunction &MF, PerFunctionMIParsingState &PFS, SMDiagnostic &Error, SMRange &SourceRange)
void setFlag(Register Reg, uint8_t Flag)
bool checkFlag(Register Reg, uint8_t Flag) const
void reserveWWMRegister(Register Reg)
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
Represents a range in source code.
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...
void addMutation(std::unique_ptr< ScheduleDAGMutation > Mutation)
Add a postprocessing step to the DAG builder.
const TargetInstrInfo * TII
Target instruction information.
const TargetRegisterInfo * TRI
Target processor register info.
Move instructions into successor blocks when possible.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
void append(StringRef RHS)
Append from a StringRef.
unsigned getMainFileID() const
const MemoryBuffer * getMemoryBuffer(unsigned i) const
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
constexpr bool empty() const
empty - Check if the string is empty.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
A switch()-like statement whose cases are string literals.
StringSwitch & Cases(std::initializer_list< StringLiteral > CaseStrings, T Value)
Primary interface to the complete machine description for the target machine.
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
const MCSubtargetInfo * getMCSubtargetInfo() const
StringRef getTargetFeatureString() const
StringRef getTargetCPU() const
std::unique_ptr< const MCSubtargetInfo > STI
void resetTargetOptions(const Function &F) const
Reset the target options based on the function's attributes.
std::unique_ptr< const MCRegisterInfo > MRI
Target-Independent Code Generator Pass Configuration Options.
virtual void addCodeGenPrepare()
Add pass to prepare the LLVM IR for code generation.
virtual bool addILPOpts()
Add passes that optimize instruction level parallelism for out-of-order targets.
virtual void addPostRegAlloc()
This method may be implemented by targets that want to run passes after register allocation pass pipe...
CodeGenOptLevel getOptLevel() const
virtual void addOptimizedRegAlloc()
addOptimizedRegAlloc - Add passes related to register allocation.
virtual void addIRPasses()
Add common target configurable passes that perform LLVM IR to IR transforms following machine indepen...
virtual void addFastRegAlloc()
addFastRegAlloc - Add the minimum set of target-independent passes that are required for fast registe...
virtual void addMachineSSAOptimization()
addMachineSSAOptimization - Add standard passes that optimize machine instructions in SSA form.
void disablePass(AnalysisID PassID)
Allow the target to disable a specific standard pass by default.
AnalysisID addPass(AnalysisID PassID)
Utilities for targets to add passes to the pass manager.
TargetPassConfig(TargetMachine &TM, PassManagerBase &PM)
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
TargetSubtargetInfo - Generic base class for all target subtargets.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
int getNumOccurrences() const
An efficient, type-erasing, non-owning reference to a callable.
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
An abstract base class for streams implementations that also support a pwrite operation.
Interfaces for registering analysis passes, producing common pass manager configurations,...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ LOCAL_ADDRESS
Address space for local memory.
@ CONSTANT_ADDRESS
Address space for constant memory (VTX2).
@ FLAT_ADDRESS
Address space for flat memory.
@ GLOBAL_ADDRESS
Address space for global memory (RAT0, VTX0).
@ PRIVATE_ADDRESS
Address space for private memory.
StringRef getSchedStrategy(const Function &F)
bool isFlatGlobalAddrSpace(unsigned AS)
LLVM_READNONE constexpr bool isModuleEntryFunctionCC(CallingConv::ID CC)
LLVM_READNONE constexpr bool isEntryFunctionCC(CallingConv::ID CC)
@ C
The default llvm calling convention, compatible with C.
BinaryOp_match< SrcTy, SpecificConstantMatch, TargetOpcode::G_XOR, true > m_Not(const SrcTy &&Src)
Matches a register not-ed by a G_XOR.
BinaryOp_match< LHS, RHS, Instruction::And, true > m_c_And(const LHS &L, const RHS &R)
Matches an And with LHS and RHS in either order.
bool match(Val *V, const Pattern &P)
IntrinsicID_match m_Intrinsic()
Match intrinsic calls like this: m_Intrinsic<Intrinsic::fabs>(m_Value(X))
auto m_Value()
Match an arbitrary value and ignore it.
deferredval_ty< Value > m_Deferred(Value *const &V)
Like m_Specific(), but works if the specific value to match is determined as part of the same match()...
template class LLVM_TEMPLATE_ABI opt< bool >
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
initializer< Ty > init(const Ty &Val)
LocationClass< Ty > location(Ty &L)
This is an optimization pass for GlobalISel generic memory operations.
ScheduleDAGMILive * createSchedLive(MachineSchedContext *C)
Create the standard converging machine scheduler.
LLVM_ABI FunctionPass * createFlattenCFGPass()
std::unique_ptr< ScheduleDAGMutation > createAMDGPUBarrierLatencyDAGMutation(MachineFunction *MF)
LLVM_ABI FunctionPass * createFastRegisterAllocator()
FastRegisterAllocation Pass - This pass register allocates as fast as possible.
LLVM_ABI char & EarlyMachineLICMID
This pass performs loop invariant code motion on machine instructions.
ImmutablePass * createAMDGPUAAWrapperPass()
LLVM_ABI char & PostRAHazardRecognizerID
PostRAHazardRecognizer - This pass runs the post-ra hazard recognizer.
std::function< bool(const TargetRegisterInfo &TRI, const MachineRegisterInfo &MRI, const Register Reg)> RegAllocFilterFunc
Filter function for register classes during regalloc.
FunctionPass * createAMDGPUSetWavePriorityPass()
LLVM_ABI Pass * createLCSSAPass()
void initializeAMDGPUMarkLastScratchLoadLegacyPass(PassRegistry &)
void initializeAMDGPUInsertDelayAluLegacyPass(PassRegistry &)
void initializeSIOptimizeExecMaskingPreRALegacyPass(PassRegistry &)
char & GCNPreRAOptimizationsID
LLVM_ABI char & GCLoweringID
GCLowering Pass - Used by gc.root to perform its default lowering operations.
void initializeSIInsertHardClausesLegacyPass(PassRegistry &)
ModulePass * createExpandVariadicsPass(ExpandVariadicsMode)
FunctionPass * createSIAnnotateControlFlowLegacyPass()
Create the annotation pass.
FunctionPass * createSIModeRegisterPass()
void initializeGCNPreRAOptimizationsLegacyPass(PassRegistry &)
void initializeSILowerWWMCopiesLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createGreedyRegisterAllocator()
Greedy register allocation pass - This pass implements a global register allocator for optimized buil...
void initializeAMDGPUAAWrapperPassPass(PassRegistry &)
void initializeSIShrinkInstructionsLegacyPass(PassRegistry &)
ModulePass * createAMDGPULowerBufferFatPointersPass()
void initializeR600ClauseMergePassPass(PassRegistry &)
ModulePass * createAMDGPUCtorDtorLoweringLegacyPass()
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
ModulePass * createAMDGPUSwLowerLDSLegacyPass(const AMDGPUTargetMachine *TM=nullptr)
void initializeGCNRewritePartialRegUsesLegacyPass(llvm::PassRegistry &)
void initializeAMDGPURewriteUndefForPHILegacyPass(PassRegistry &)
char & GCNRewritePartialRegUsesID
void initializeAMDGPUSwLowerLDSLegacyPass(PassRegistry &)
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
void initializeAMDGPULowerVGPREncodingLegacyPass(PassRegistry &)
char & AMDGPUWaitSGPRHazardsLegacyID
void initializeSILowerSGPRSpillsLegacyPass(PassRegistry &)
LLVM_ABI Pass * createLoadStoreVectorizerPass()
Create a legacy pass manager instance of the LoadStoreVectorizer pass.
std::unique_ptr< ScheduleDAGMutation > createIGroupLPDAGMutation(AMDGPU::SchedulingPhase Phase)
Phase specifes whether or not this is a reentry into the IGroupLPDAGMutation.
void initializeAMDGPUDAGToDAGISelLegacyPass(PassRegistry &)
FunctionPass * createAMDGPURegBankCombiner(bool IsOptNone)
LLVM_ABI FunctionPass * createNaryReassociatePass()
char & AMDGPUReserveWWMRegsLegacyID
void initializeAMDGPUWaitSGPRHazardsLegacyPass(PassRegistry &)
LLVM_ABI char & PatchableFunctionID
This pass implements the "patchable-function" attribute.
char & SIOptimizeExecMaskingLegacyID
LLVM_ABI char & PostRASchedulerID
PostRAScheduler - This pass performs post register allocation scheduling.
void initializeR600ExpandSpecialInstrsPassPass(PassRegistry &)
void initializeR600PacketizerPass(PassRegistry &)
std::unique_ptr< ScheduleDAGMutation > createVOPDPairingMutation()
ModulePass * createAMDGPUExportKernelRuntimeHandlesLegacyPass()
ModulePass * createAMDGPUAlwaysInlinePass(bool GlobalOpt=true)
void initializeAMDGPUAsmPrinterPass(PassRegistry &)
void initializeSIFoldOperandsLegacyPass(PassRegistry &)
char & SILoadStoreOptimizerLegacyID
void initializeAMDGPUGlobalISelDivergenceLoweringPass(PassRegistry &)
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
LLVM_ABI std::unique_ptr< CSEConfigBase > getStandardCSEConfigForOpt(CodeGenOptLevel Level)
Target & getTheR600Target()
The target for R600 GPUs.
LLVM_ABI char & MachineSchedulerID
MachineScheduler - This pass schedules machine instructions.
LLVM_ABI Pass * createStructurizeCFGPass(bool SkipUniformRegions=false)
When SkipUniformRegions is true the structizer will not structurize regions that only contain uniform...
LLVM_ABI char & PostMachineSchedulerID
PostMachineScheduler - This pass schedules machine instructions postRA.
LLVM_ABI Pass * createLICMPass()
char & SIFormMemoryClausesID
void initializeSILoadStoreOptimizerLegacyPass(PassRegistry &)
void initializeAMDGPULowerModuleLDSLegacyPass(PassRegistry &)
AnalysisManager< LazyCallGraph::SCC, LazyCallGraph & > CGSCCAnalysisManager
The CGSCC analysis manager.
void initializeAMDGPUCtorDtorLoweringLegacyPass(PassRegistry &)
LLVM_ABI char & EarlyIfConverterLegacyID
EarlyIfConverter - This pass performs if-conversion on SSA form by inserting cmov instructions.
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
FunctionPass * createAMDGPUUniformIntrinsicCombineLegacyPass()
void initializeAMDGPURegBankCombinerPass(PassRegistry &)
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
@ FullLTOPostLink
Full LTO postlink (backend compile) phase.
char & AMDGPUUnifyDivergentExitNodesID
void initializeAMDGPUPrepareAGPRAllocLegacyPass(PassRegistry &)
FunctionPass * createAMDGPUAtomicOptimizerPass(ScanOptions ScanStrategy)
FunctionPass * createAMDGPUPreloadKernArgPrologLegacyPass()
char & SIOptimizeVGPRLiveRangeLegacyID
LLVM_ABI char & ShadowStackGCLoweringID
ShadowStackGCLowering - Implements the custom lowering mechanism used by the shadow stack GC.
void initializeAMDGPURewriteOutArgumentsPass(PassRegistry &)
static Reloc::Model getEffectiveRelocModel(std::optional< Reloc::Model > RM)
void initializeAMDGPUExternalAAWrapperPass(PassRegistry &)
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
void initializeAMDGPULowerKernelArgumentsPass(PassRegistry &)
void initializeSIModeRegisterLegacyPass(PassRegistry &)
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.
void initializeAMDGPUPreloadKernelArgumentsLegacyPass(PassRegistry &)
char & SILateBranchLoweringPassID
FunctionToLoopPassAdaptor createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
LLVM_ABI char & BranchRelaxationPassID
BranchRelaxation - This pass replaces branches that need to jump further than is supported by a branc...
LLVM_ABI FunctionPass * createSinkingPass()
CGSCCToFunctionPassAdaptor createCGSCCToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false, bool NoRerun=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
void initializeSIMemoryLegalizerLegacyPass(PassRegistry &)
ModulePass * createAMDGPULowerIntrinsicsLegacyPass()
void initializeR600MachineCFGStructurizerPass(PassRegistry &)
CodeGenFileType
These enums are meant to be passed into addPassesToEmitFile to indicate what type of file to emit,...
char & GCNDPPCombineLegacyID
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
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()
FunctionPass * createAMDGPULowerKernelArgumentsPass()
char & AMDGPUInsertDelayAluID
std::unique_ptr< ScheduleDAGMutation > createAMDGPUMacroFusionDAGMutation()
Note that you have to add: DAG.addMutation(createAMDGPUMacroFusionDAGMutation()); to AMDGPUTargetMach...
LLVM_ABI char & StackMapLivenessID
StackMapLiveness - This pass analyses the register live-out set of stackmap/patchpoint intrinsics and...
void initializeGCNPreRALongBranchRegLegacyPass(PassRegistry &)
char & SILowerWWMCopiesLegacyID
LLVM_ABI FunctionPass * createUnifyLoopExitsPass()
char & SIOptimizeExecMaskingPreRAID
LLVM_ABI FunctionPass * createFixIrreduciblePass()
void initializeR600EmitClauseMarkersPass(PassRegistry &)
LLVM_ABI char & FuncletLayoutID
This pass lays out funclets contiguously.
LLVM_ABI char & DetectDeadLanesID
This pass adds dead/undef flags after analyzing subregister lanes.
void initializeAMDGPULowerExecSyncLegacyPass(PassRegistry &)
void initializeAMDGPUPostLegalizerCombinerPass(PassRegistry &)
ScheduleDAGInstrs * createGCNNoopPostMachineScheduler(MachineSchedContext *C)
void initializeAMDGPUExportKernelRuntimeHandlesLegacyPass(PassRegistry &)
CodeGenOptLevel
Code generation optimization level.
void initializeSIInsertWaitcntsLegacyPass(PassRegistry &)
ModulePass * createAMDGPUPreloadKernelArgumentsLegacyPass(const TargetMachine *)
ModulePass * createAMDGPUPrintfRuntimeBinding()
LLVM_ABI char & StackSlotColoringID
StackSlotColoring - This pass performs stack slot coloring.
LLVM_ABI Pass * createAlwaysInlinerLegacyPass(bool InsertLifetime=true)
Create a legacy pass manager instance of a pass to inline and remove functions marked as "always_inli...
void initializeR600ControlFlowFinalizerPass(PassRegistry &)
void initializeAMDGPUImageIntrinsicOptimizerPass(PassRegistry &)
void initializeSILateBranchLoweringLegacyPass(PassRegistry &)
void initializeSILowerControlFlowLegacyPass(PassRegistry &)
void initializeSIFormMemoryClausesLegacyPass(PassRegistry &)
char & SIPreAllocateWWMRegsLegacyID
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
ModulePass * createAMDGPULowerModuleLDSLegacyPass(const AMDGPUTargetMachine *TM=nullptr)
void initializeAMDGPUPreLegalizerCombinerPass(PassRegistry &)
FunctionPass * createAMDGPUPromoteAlloca()
LLVM_ABI FunctionPass * createSeparateConstOffsetFromGEPPass(bool LowerGEP=false)
void initializeAMDGPUReserveWWMRegsLegacyPass(PassRegistry &)
char & SIPreEmitPeepholeID
char & SIPostRABundlerLegacyID
ModulePass * createAMDGPURemoveIncompatibleFunctionsPass(const TargetMachine *)
void initializeGCNRegPressurePrinterPass(PassRegistry &)
void initializeSILowerI1CopiesLegacyPass(PassRegistry &)
char & SILowerSGPRSpillsLegacyID
LLVM_ABI FunctionPass * createBasicRegisterAllocator()
BasicRegisterAllocation Pass - This pass implements a degenerate global register allocator using the ...
LLVM_ABI void initializeGlobalISel(PassRegistry &)
Initialize all passes linked into the GlobalISel library.
char & SILowerControlFlowLegacyID
ModulePass * createR600OpenCLImageTypeLoweringPass()
FunctionPass * createAMDGPUCodeGenPreparePass()
void initializeSIAnnotateControlFlowLegacyPass(PassRegistry &)
FunctionPass * createAMDGPUISelDag(TargetMachine &TM, CodeGenOptLevel OptLevel)
This pass converts a legalized DAG into a AMDGPU-specific.
void initializeGCNCreateVOPDLegacyPass(PassRegistry &)
void initializeAMDGPUUniformIntrinsicCombineLegacyPass(PassRegistry &)
ScheduleDAGInstrs * createGCNCoExecMachineScheduler(MachineSchedContext *C)
void initializeSIPreAllocateWWMRegsLegacyPass(PassRegistry &)
void initializeSIFixVGPRCopiesLegacyPass(PassRegistry &)
Target & getTheGCNTarget()
The target for GCN GPUs.
void initializeSIFixSGPRCopiesLegacyPass(PassRegistry &)
void initializeAMDGPUAtomicOptimizerPass(PassRegistry &)
void initializeAMDGPULowerIntrinsicsLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createGVNPass()
Create a legacy GVN pass.
void initializeAMDGPURewriteAGPRCopyMFMALegacyPass(PassRegistry &)
void initializeSIPostRABundlerLegacyPass(PassRegistry &)
FunctionPass * createAMDGPURegBankSelectPass()
FunctionPass * createAMDGPURegBankLegalizePass()
LLVM_ABI char & MachineCSELegacyID
MachineCSE - This pass performs global CSE on machine instructions.
LLVM_ABI std::unique_ptr< ScheduleDAGMutation > createLoadClusterDAGMutation(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...
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
LLVM_ABI char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
void initializeAMDGPUCodeGenPreparePass(PassRegistry &)
FunctionPass * createAMDGPURewriteUndefForPHILegacyPass()
void initializeSIOptimizeExecMaskingLegacyPass(PassRegistry &)
void call_once(once_flag &flag, Function &&F, Args &&... ArgList)
Execute the function specified as a parameter once.
FunctionPass * createSILowerI1CopiesLegacyPass()
FunctionPass * createAMDGPUPostLegalizeCombiner(bool IsOptNone)
void initializeAMDGPULowerKernelAttributesPass(PassRegistry &)
char & SIInsertHardClausesID
char & SIFixSGPRCopiesLegacyID
void initializeGCNDPPCombineLegacyPass(PassRegistry &)
char & SIPeepholeSDWALegacyID
LLVM_ABI char & VirtRegRewriterID
VirtRegRewriter pass.
char & SIFoldOperandsLegacyID
void initializeGCNNSAReassignLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createLowerSwitchPass()
void initializeAMDGPUPreloadKernArgPrologLegacyPass(PassRegistry &)
LLVM_ABI FunctionPass * createVirtRegRewriter(bool ClearVirtRegs=true)
void initializeR600VectorRegMergerPass(PassRegistry &)
char & AMDGPURewriteAGPRCopyMFMALegacyID
ModulePass * createAMDGPULowerExecSyncLegacyPass()
char & AMDGPULowerVGPREncodingLegacyID
FunctionPass * createAMDGPUGlobalISelDivergenceLoweringPass()
FunctionPass * createSIMemoryLegalizerPass()
void initializeAMDGPULateCodeGenPrepareLegacyPass(PassRegistry &)
void initializeSIOptimizeVGPRLiveRangeLegacyPass(PassRegistry &)
void initializeSIPeepholeSDWALegacyPass(PassRegistry &)
void initializeAMDGPURegBankLegalizePass(PassRegistry &)
LLVM_ABI char & TwoAddressInstructionPassID
TwoAddressInstruction - This pass reduces two-address instructions to use two operands.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
FunctionPass * createAMDGPUPreLegalizeCombiner(bool IsOptNone)
void initializeAMDGPURegBankSelectPass(PassRegistry &)
FunctionPass * createAMDGPULateCodeGenPrepareLegacyPass()
LLVM_ABI FunctionPass * createAtomicExpandLegacyPass()
AtomicExpandPass - At IR level this pass replace atomic instructions with __atomic_* library calls,...
MCRegisterInfo * createGCNMCRegisterInfo(AMDGPUDwarfFlavour DwarfFlavour)
LLVM_ABI FunctionPass * createStraightLineStrengthReducePass()
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
FunctionPass * createAMDGPUImageIntrinsicOptimizerPass(const TargetMachine *)
void initializeAMDGPUUnifyDivergentExitNodesPass(PassRegistry &)
void initializeAMDGPULowerBufferFatPointersPass(PassRegistry &)
FunctionPass * createSIInsertWaitcntsPass()
FunctionPass * createAMDGPUAnnotateUniformValuesLegacy()
LLVM_ABI FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
void initializeSIWholeQuadModeLegacyPass(PassRegistry &)
LLVM_ABI char & PHIEliminationID
PHIElimination - This pass eliminates machine instruction PHI nodes by inserting copy instructions.
LLVM_ABI llvm::cl::opt< bool > NoKernelInfoEndLTO
bool parseNamedRegisterReference(PerFunctionMIParsingState &PFS, Register &Reg, StringRef Src, SMDiagnostic &Error)
void initializeAMDGPUResourceUsageAnalysisWrapperPassPass(PassRegistry &)
FunctionPass * createSIShrinkInstructionsLegacyPass()
char & AMDGPUPrepareAGPRAllocLegacyID
char & AMDGPUMarkLastScratchLoadID
LLVM_ABI char & RenameIndependentSubregsID
This pass detects subregister lanes in a virtual register that are used independently of other lanes ...
void initializeAMDGPUAnnotateUniformValuesLegacyPass(PassRegistry &)
std::unique_ptr< ScheduleDAGMutation > createAMDGPUExportClusteringDAGMutation()
void initializeAMDGPUPrintfRuntimeBindingPass(PassRegistry &)
void initializeAMDGPUPromoteAllocaPass(PassRegistry &)
void initializeAMDGPURemoveIncompatibleFunctionsLegacyPass(PassRegistry &)
std::unique_ptr< ScheduleDAGMutation > createAMDGPUHazardLatencyDAGMutation(MachineFunction *MF)
void initializeAMDGPUAlwaysInlinePass(PassRegistry &)
LLVM_ABI char & DeadMachineInstructionElimID
DeadMachineInstructionElim - This pass removes dead machine instructions.
void initializeSIPreEmitPeepholeLegacyPass(PassRegistry &)
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
char & AMDGPUPerfHintAnalysisLegacyID
LLVM_ABI ImmutablePass * createExternalAAWrapperPass(std::function< void(Pass &, Function &, AAResults &)> Callback)
A wrapper pass around a callback which can be used to populate the AAResults in the AAResultsWrapperP...
char & GCNPreRALongBranchRegID
LLVM_ABI CGPassBuilderOption getCGPassBuilderOption()
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
void initializeAMDGPUPromoteKernelArgumentsPass(PassRegistry &)
ArgDescriptor PrivateSegmentBuffer
ArgDescriptor WorkGroupIDY
ArgDescriptor WorkGroupIDZ
ArgDescriptor PrivateSegmentSize
ArgDescriptor ImplicitArgPtr
ArgDescriptor PrivateSegmentWaveByteOffset
ArgDescriptor WorkGroupInfo
ArgDescriptor WorkItemIDZ
ArgDescriptor WorkItemIDY
ArgDescriptor LDSKernelId
ArgDescriptor KernargSegmentPtr
ArgDescriptor WorkItemIDX
ArgDescriptor FlatScratchInit
ArgDescriptor DispatchPtr
ArgDescriptor ImplicitBufferPtr
Register FirstKernArgPreloadReg
ArgDescriptor WorkGroupIDX
static ArgDescriptor createStack(unsigned Offset, unsigned Mask=~0u)
static ArgDescriptor createArg(const ArgDescriptor &Arg, unsigned Mask)
static ArgDescriptor createRegister(Register Reg, unsigned Mask=~0u)
DenormalModeKind Input
Denormal treatment kind for floating point instruction inputs in the default floating-point environme...
@ PreserveSign
The sign of a flushed-to-zero number is preserved in the sign of 0.
@ IEEE
IEEE-754 denormal numbers preserved.
DenormalModeKind Output
Denormal flushing mode for floating point instruction results in the default floating point environme...
A simple and fast domtree-based CSE pass.
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...
StringMap< VRegInfo * > VRegInfosNamed
DenseMap< Register, VRegInfo * > VRegInfos
RegisterTargetMachine - Helper template for registering a target machine implementation,...
A utility pass template to force an analysis result to be available.
bool DX10Clamp
Used by the vector ALU to force DX10-style treatment of NaNs: when set, clamp NaN to zero; otherwise,...
DenormalMode FP64FP16Denormals
If this is set, neither input or output denormals are flushed for both f64 and f16/v2f16 instructions...
bool IEEE
Floating point opcodes that support exception flag gathering quiet and propagate signaling NaN inputs...
DenormalMode FP32Denormals
If this is set, neither input or output denormals are flushed for most f32 instructions.
The llvm::once_flag structure.
Targets should override this in a way that mirrors the implementation of llvm::MachineFunctionInfo.
StringValue SGPRForEXECCopy
SmallVector< StringValue > WWMReservedRegs
StringValue FrameOffsetReg
StringValue LongBranchReservedReg
unsigned NumKernargPreloadSGPRs
StringValue VGPRForAGPRCopy
std::optional< SIArgumentInfo > ArgInfo
SmallVector< StringValue, 2 > SpillPhysVGPRS
StringValue ScratchRSrcReg
StringValue StackPtrOffsetReg
bool FP64FP16OutputDenormals
bool FP64FP16InputDenormals
A wrapper around std::string which contains a source range that's being set during parsing.