429std::optional<PrintPipelinePassesFormat>
431 return Opts.print_pipeline_passes;
442 for (
char C : Pipeline) {
450 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
480 return MFA ? &MFA->
getMF() :
nullptr;
486class TriggerVerifierErrorPass
492 auto *PtrTy = PointerType::getUnqual(
M.getContext());
494 GlobalValue::LinkageTypes::InternalLinkage,
495 "__bad_alias",
nullptr, &M);
515 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
520class RequireAllMachineFunctionPropertiesPass
528 static MachineFunctionProperties getRequiredProperties() {
529 return MachineFunctionProperties()
531 .setFailsVerification()
536 .setRegBankSelected()
538 .setTiedOpsRewritten()
539 .setTracksDebugUserValues()
540 .setTracksLiveness();
542 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
548 if (S ==
"Os" || S ==
"Oz")
550 Twine(
"The optimization level \"") + S +
551 "\" is no longer supported. Use O2 in conjunction with the " +
552 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
563 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
567 formatv(
"invalid optimization level '{}'", S).str(),
572 std::optional<PipelineTuningOptions> PTO,
573 std::optional<PGOOptions> PGOOpt,
576 : Context(Context), Opts(Context.getLibraryOptions().
get<PassesOptions>()),
579 PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
581 TM->registerPassBuilderCallbacks(*
this);
583 PIC->registerClassToPassNameCallback([
this, PIC]() {
587#define MODULE_PASS(NAME, CREATE_PASS) \
588 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
589#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
590 PIC->addClassToPassName(CLASS, NAME);
591#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
592 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
593#define FUNCTION_PASS(NAME, CREATE_PASS) \
594 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
595#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
596 PIC->addClassToPassName(CLASS, NAME);
597#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
598 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
599#define LOOPNEST_PASS(NAME, CREATE_PASS) \
600 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
601#define LOOP_PASS(NAME, CREATE_PASS) \
602 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
603#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
604 PIC->addClassToPassName(CLASS, NAME);
605#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
606 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
607#define CGSCC_PASS(NAME, CREATE_PASS) \
608 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
609#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
610 PIC->addClassToPassName(CLASS, NAME);
611#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
612 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
613#include "PassRegistry.def"
615#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
616 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
617#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
618 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
619#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
621 PIC->addClassToPassName(CLASS, NAME);
622#include "llvm/Passes/MachinePassRegistry.def"
630#define MODULE_CALLBACK(NAME, INVOKE) \
631 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
632 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
634 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
637 INVOKE(PM, L.get()); \
640#include "PassRegistry.def"
648#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
649 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
650 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
652 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
655 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
658#include "PassRegistry.def"
666#define FUNCTION_CALLBACK(NAME, INVOKE) \
667 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
668 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
670 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
673 INVOKE(PM, L.get()); \
676#include "PassRegistry.def"
684#define CGSCC_CALLBACK(NAME, INVOKE) \
685 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
686 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
688 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
691 INVOKE(PM, L.get()); \
694#include "PassRegistry.def"
702#define LOOP_CALLBACK(NAME, INVOKE) \
703 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
704 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
706 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
709 INVOKE(PM, L.get()); \
712#include "PassRegistry.def"
718#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
719 MAM.registerPass([&] { return CREATE_PASS; });
720#include "PassRegistry.def"
722 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
727#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
728 CGAM.registerPass([&] { return CREATE_PASS; });
729#include "PassRegistry.def"
731 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
741#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
742 if constexpr (std::is_constructible_v< \
743 std::remove_reference_t<decltype(CREATE_PASS)>, \
744 const TargetMachine &>) { \
746 FAM.registerPass([&] { return CREATE_PASS; }); \
748 FAM.registerPass([&] { return CREATE_PASS; }); \
750#include "PassRegistry.def"
752 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
759#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
760 MFAM.registerPass([&] { return CREATE_PASS; });
761#include "llvm/Passes/MachinePassRegistry.def"
763 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
768#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
769 LAM.registerPass([&] { return CREATE_PASS; });
770#include "PassRegistry.def"
772 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
776static std::optional<std::pair<bool, bool>>
778 std::pair<bool, bool> Params;
779 if (!Name.consume_front(
"function"))
783 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
785 while (!Name.empty()) {
786 auto [Front, Back] = Name.split(
';');
788 if (Front ==
"eager-inv")
790 else if (Front ==
"no-rerun")
791 Params.second =
true;
799 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
811 while (!Params.
empty()) {
813 std::tie(ParamName, Params) = Params.
split(
';');
815 if (ParamName == OptionName) {
832 while (!Params.
empty()) {
834 std::tie(ParamName, Params) = Params.
split(
';');
839 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
844 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
848 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
853 if (ParamName ==
"force-hardware-loops") {
855 }
else if (ParamName ==
"force-hardware-loop-phi") {
857 }
else if (ParamName ==
"force-nested-hardware-loop") {
859 }
else if (ParamName ==
"force-hardware-loop-guard") {
863 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
867 return HardwareLoopOpts;
879 "FunctionPropertiesStatisticsPass");
889 Params,
"assume-default-is-flat-addrspace",
"InferAddressSpacesPass");
895 while (!Params.
empty()) {
897 std::tie(ParamName, Params) = Params.
split(
';');
898 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
900 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
907 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
914 if (ParamName ==
"partial") {
916 }
else if (ParamName ==
"peeling") {
918 }
else if (ParamName ==
"profile-peeling") {
920 }
else if (ParamName ==
"runtime") {
922 }
else if (ParamName ==
"upperbound") {
924 }
else if (ParamName ==
"prepare-for-lto") {
928 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
937 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
957 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
966 "EntryExitInstrumenter");
971 "DropUnnecessaryAssumes");
976 "LowerMatrixIntrinsics");
981 while (!Params.
empty()) {
983 std::tie(ParamName, Params) = Params.
split(
';');
986 if (ParamName ==
"preserve-order")
988 else if (ParamName ==
"rename-all")
990 else if (ParamName ==
"fold-all")
992 else if (ParamName ==
"reorder-operands")
996 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1006 while (!Params.
empty()) {
1008 std::tie(ParamName, Params) = Params.
split(
';');
1010 if (ParamName ==
"kernel") {
1011 Result.CompileKernel =
true;
1012 }
else if (ParamName ==
"use-after-scope") {
1013 Result.UseAfterScope =
true;
1016 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1026 while (!Params.
empty()) {
1028 std::tie(ParamName, Params) = Params.
split(
';');
1030 if (ParamName ==
"recover") {
1032 }
else if (ParamName ==
"kernel") {
1033 Result.CompileKernel =
true;
1036 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1045parseDropTypeTestsPassOptions(
StringRef Params) {
1047 while (!Params.
empty()) {
1049 std::tie(ParamName, Params) = Params.
split(
';');
1051 if (ParamName ==
"all") {
1053 }
else if (ParamName ==
"assume") {
1057 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1066 while (!Params.
empty()) {
1068 std::tie(ParamName, Params) = Params.
split(
';');
1070 if (ParamName ==
"thinlto") {
1072 }
else if (ParamName ==
"emit-summary") {
1073 Result.EmitLTOSummary =
true;
1076 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1084parseLowerAllowCheckPassOptions(
StringRef Params) {
1086 while (!Params.
empty()) {
1088 std::tie(ParamName, Params) = Params.
split(
';');
1099 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1106 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1111 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1113 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1114 IndicesStr, CutoffStr)
1118 while (IndicesStr !=
"") {
1120 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1126 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1127 firstIndexStr, IndicesStr)
1134 if (index >=
Result.cutoffs.size())
1135 Result.cutoffs.resize(index + 1, 0);
1137 Result.cutoffs[index] = cutoff;
1139 }
else if (ParamName.
starts_with(
"runtime_check")) {
1141 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1145 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1147 ValueString, Params)
1151 Result.runtime_check = runtime_check;
1154 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1165 while (!Params.
empty()) {
1167 std::tie(ParamName, Params) = Params.
split(
';');
1169 if (ParamName ==
"recover") {
1171 }
else if (ParamName ==
"kernel") {
1176 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1181 }
else if (ParamName ==
"eager-checks") {
1182 Result.EagerChecks =
true;
1185 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1195 while (!Params.
empty()) {
1197 std::tie(ParamName, Params) = Params.
split(
';');
1204 formatv(
"invalid argument to AllocToken pass mode "
1211 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1221 while (!Params.
empty()) {
1223 std::tie(ParamName, Params) = Params.
split(
';');
1226 if (ParamName ==
"speculate-blocks") {
1228 }
else if (ParamName ==
"simplify-cond-branch") {
1230 }
else if (ParamName ==
"forward-switch-cond") {
1232 }
else if (ParamName ==
"switch-range-to-icmp") {
1234 }
else if (ParamName ==
"switch-to-arithmetic") {
1236 }
else if (ParamName ==
"switch-to-lookup") {
1238 }
else if (ParamName ==
"keep-loops") {
1240 }
else if (ParamName ==
"hoist-common-insts") {
1242 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1244 }
else if (ParamName ==
"sink-common-insts") {
1246 }
else if (ParamName ==
"speculate-unpredictables") {
1249 APInt BonusInstThreshold;
1252 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1260 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1271 Result.setVerifyFixpoint(
true);
1272 while (!Params.
empty()) {
1274 std::tie(ParamName, Params) = Params.
split(
';');
1277 if (ParamName ==
"verify-fixpoint") {
1280 APInt MaxIterations;
1283 formatv(
"invalid argument to InstCombine pass max-iterations "
1291 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1301 while (!Params.
empty()) {
1303 std::tie(ParamName, Params) = Params.
split(
';');
1306 if (ParamName ==
"interleave-forced-only") {
1308 }
else if (ParamName ==
"vectorize-forced-only") {
1312 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1320 std::pair<bool, bool>
Result = {
false,
true};
1321 while (!Params.
empty()) {
1323 std::tie(ParamName, Params) = Params.
split(
';');
1326 if (ParamName ==
"nontrivial") {
1328 }
else if (ParamName ==
"trivial") {
1332 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1341 while (!Params.
empty()) {
1343 std::tie(ParamName, Params) = Params.
split(
';');
1346 if (ParamName ==
"allowspeculation") {
1350 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1357struct LoopRotateOptions {
1358 bool EnableHeaderDuplication =
true;
1359 bool PrepareForLTO =
false;
1360 bool CheckExitCount =
false;
1364 LoopRotateOptions
Result;
1365 while (!Params.
empty()) {
1367 std::tie(ParamName, Params) = Params.
split(
';');
1370 if (ParamName ==
"header-duplication") {
1372 }
else if (ParamName ==
"prepare-for-lto") {
1374 }
else if (ParamName ==
"check-exit-count") {
1378 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1387 while (!Params.
empty()) {
1389 std::tie(ParamName, Params) = Params.
split(
';');
1392 if (ParamName ==
"split-footer-bb") {
1396 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1407 while (!Params.
empty()) {
1409 std::tie(ParamName, Params) = Params.
split(
';');
1412 if (ParamName ==
"scalar-pre") {
1414 }
else if (ParamName ==
"load-pre") {
1416 }
else if (ParamName ==
"split-backedge-load-pre") {
1418 }
else if (ParamName ==
"memdep") {
1422 }
else if (ParamName ==
"memoryssa") {
1428 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1437 while (!Params.
empty()) {
1439 std::tie(ParamName, Params) = Params.
split(
';');
1442 if (ParamName ==
"func-spec")
1446 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1454 while (!Params.
empty()) {
1456 std::tie(ParamName, Params) = Params.
split(
';');
1461 formatv(
"invalid argument to Scalarizer pass min-bits "
1472 if (ParamName ==
"load-store")
1474 else if (ParamName ==
"variable-insert-extract")
1478 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1488 bool SawCFGOption =
false;
1489 while (!Params.
empty()) {
1491 std::tie(ParamName, Params) = Params.
split(
';');
1493 if (ParamName ==
"modify-cfg") {
1498 SawCFGOption =
true;
1499 }
else if (ParamName ==
"preserve-cfg") {
1504 SawCFGOption =
true;
1505 }
else if (ParamName ==
"aggregate-to-vector") {
1506 Result.AggregateToVector =
true;
1509 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1510 "modify-cfg, or aggregate-to-vector)",
1520parseStackLifetimeOptions(
StringRef Params) {
1522 while (!Params.
empty()) {
1524 std::tie(ParamName, Params) = Params.
split(
';');
1526 if (ParamName ==
"may") {
1528 }
else if (ParamName ==
"must") {
1532 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1541 "DependenceAnalysisPrinter");
1546 "SeparateConstOffsetFromGEP");
1555parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1559 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1567 "MemorySSAPrinterPass");
1572 "SpeculativeExecutionPass");
1577 while (!Params.
empty()) {
1579 std::tie(ParamName, Params) = Params.
split(
';');
1585 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1593parseStructuralHashPrinterPassOptions(
StringRef Params) {
1596 if (Params ==
"detailed")
1598 if (Params ==
"call-target-ignored")
1601 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1607 while (!Params.
empty()) {
1609 std::tie(ParamName, Params) = Params.
split(
';');
1612 if (ParamName ==
"group-by-use")
1614 else if (ParamName ==
"ignore-single-use")
1616 else if (ParamName ==
"merge-const")
1618 else if (ParamName ==
"merge-const-aggressive")
1620 else if (ParamName ==
"merge-external")
1625 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1629 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1638 while (!Params.
empty()) {
1640 std::tie(ParamName, Params) = Params.
split(
';');
1646 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1657 while (!Params.
empty()) {
1659 std::tie(ParamName, Params) = Params.
split(
';');
1662 std::optional<RegAllocFilterFunc>
Filter =
1666 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1675 if (ParamName ==
"no-clear-vregs") {
1681 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1688parseBoundsCheckingOptions(
StringRef Params) {
1690 while (!Params.
empty()) {
1692 std::tie(ParamName, Params) = Params.
split(
';');
1693 if (ParamName ==
"trap") {
1695 }
else if (ParamName ==
"rt") {
1701 }
else if (ParamName ==
"rt-abort") {
1707 }
else if (ParamName ==
"min-rt") {
1713 }
else if (ParamName ==
"min-rt-abort") {
1719 }
else if (ParamName ==
"merge") {
1721 }
else if (ParamName ==
"handler-preserve-all-regs") {
1723 Options.Rt->HandlerPreserveAllRegs =
true;
1727 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1733 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1750 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1752 Param.str().c_str());
1755 if (!
Level.has_value())
1757 "invalid optimization level for expand-ir-insts pass: %s",
1758 Digit.str().c_str());
1765 if (Params.
empty() || Params ==
"all")
1766 return RAGreedyPass::Options();
1770 return RAGreedyPass::Options{*
Filter, Params};
1773 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1779 "MachineSinkingPass");
1783 bool AllowTailMerge =
true;
1784 if (!Params.
empty()) {
1786 if (Params !=
"tail-merge")
1788 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1792 return AllowTailMerge;
1796 bool ClearVirtRegs =
true;
1797 if (!Params.
empty()) {
1799 if (Params !=
"clear-vregs")
1801 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1804 return ClearVirtRegs;
1807struct FatLTOOptions {
1809 bool ThinLTO =
false;
1810 bool EmitSummary =
false;
1815 bool HaveOptLevel =
false;
1816 while (!Params.
empty()) {
1818 std::tie(ParamName, Params) = Params.
split(
';');
1820 if (ParamName ==
"thinlto") {
1822 }
else if (ParamName ==
"emit-summary") {
1823 Result.EmitSummary =
true;
1824 }
else if (std::optional<OptimizationLevel> OptLevel =
1826 Result.OptLevel = *OptLevel;
1827 HaveOptLevel =
true;
1830 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1837 "missing optimization level for fatlto-pre-link pipeline",
1852template <
typename PassManagerT,
typename CallbacksT>
1854 if (!Callbacks.empty()) {
1855 PassManagerT DummyPM;
1856 for (
auto &CB : Callbacks)
1857 if (CB(Name, DummyPM, {}))
1863template <
typename CallbacksT>
1865 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1868 if (Name ==
"module")
1870 if (Name ==
"cgscc")
1872 if (NameNoBracket ==
"function")
1874 if (Name ==
"coro-cond")
1877#define MODULE_PASS(NAME, CREATE_PASS) \
1880#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1881 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1883#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1884 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1886#include "PassRegistry.def"
1891template <
typename CallbacksT>
1894 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1895 if (Name ==
"cgscc")
1897 if (NameNoBracket ==
"function")
1904#define CGSCC_PASS(NAME, CREATE_PASS) \
1907#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1908 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1910#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1911 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1913#include "PassRegistry.def"
1918template <
typename CallbacksT>
1921 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1922 if (NameNoBracket ==
"function")
1924 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1927#define FUNCTION_PASS(NAME, CREATE_PASS) \
1930#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1931 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1933#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1934 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1936#include "PassRegistry.def"
1941template <
typename CallbacksT>
1944 if (Name ==
"machine-function")
1947#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1950#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1952 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1955#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1956 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1959#include "llvm/Passes/MachinePassRegistry.def"
1964template <
typename CallbacksT>
1966 bool &UseMemorySSA) {
1967 UseMemorySSA =
false;
1970 UseMemorySSA =
true;
1974#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1977#include "PassRegistry.def"
1982template <
typename CallbacksT>
1984 bool &UseMemorySSA) {
1985 UseMemorySSA =
false;
1988 UseMemorySSA =
true;
1992#define LOOP_PASS(NAME, CREATE_PASS) \
1995#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1996 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1998#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1999 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2001#include "PassRegistry.def"
2006std::optional<std::vector<PassBuilder::PipelineElement>>
2008 std::vector<PipelineElement> ResultPipeline;
2013 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2014 size_t Pos =
Text.find_first_of(
",()");
2015 Pipeline.push_back({
Text.substr(0, Pos), {}});
2018 if (Pos ==
Text.npos)
2021 char Sep =
Text[Pos];
2029 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2033 assert(Sep ==
')' &&
"Bogus separator!");
2038 if (PipelineStack.
size() == 1)
2039 return std::nullopt;
2042 }
while (
Text.consume_front(
")"));
2050 if (!
Text.consume_front(
","))
2051 return std::nullopt;
2054 if (PipelineStack.
size() > 1)
2056 return std::nullopt;
2058 assert(PipelineStack.
back() == &ResultPipeline &&
2059 "Wrong pipeline at the bottom of the stack!");
2060 return {std::move(ResultPipeline)};
2070 const PipelineElement &
E) {
2071 auto &
Name =
E.Name;
2072 auto &InnerPipeline =
E.InnerPipeline;
2075 if (!InnerPipeline.empty()) {
2076 if (Name ==
"module") {
2078 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2080 MPM.
addPass(std::move(NestedMPM));
2083 if (Name ==
"coro-cond") {
2085 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2087 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2090 if (Name ==
"cgscc") {
2092 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2100 "cannot have a no-rerun module to function adaptor",
2103 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2110 for (
auto &
C : ModulePipelineParsingCallbacks)
2111 if (
C(Name, MPM, InnerPipeline))
2116 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2122#define MODULE_PASS(NAME, CREATE_PASS) \
2123 if (Name == NAME) { \
2124 MPM.addPass(CREATE_PASS); \
2125 return Error::success(); \
2127#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2128 if (checkParametrizedPassName(Name, NAME)) { \
2129 auto Params = parsePassParameters(PARSER, Name, NAME); \
2131 return Params.takeError(); \
2132 MPM.addPass(CREATE_PASS(Params.get())); \
2133 return Error::success(); \
2135#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2136 if (Name == "require<" NAME ">") { \
2138 RequireAnalysisPass< \
2139 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2140 return Error::success(); \
2142 if (Name == "invalidate<" NAME ">") { \
2143 MPM.addPass(InvalidateAnalysisPass< \
2144 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2145 return Error::success(); \
2147#define CGSCC_PASS(NAME, CREATE_PASS) \
2148 if (Name == NAME) { \
2149 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2150 return Error::success(); \
2152#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2153 if (checkParametrizedPassName(Name, NAME)) { \
2154 auto Params = parsePassParameters(PARSER, Name, NAME); \
2156 return Params.takeError(); \
2158 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2159 return Error::success(); \
2161#define FUNCTION_PASS(NAME, CREATE_PASS) \
2162 if (Name == NAME) { \
2163 if constexpr (std::is_constructible_v< \
2164 std::remove_reference_t<decltype(CREATE_PASS)>, \
2165 const TargetMachine &>) { \
2167 return make_error<StringError>( \
2168 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2169 inconvertibleErrorCode()); \
2171 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2172 return Error::success(); \
2174#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2175 if (checkParametrizedPassName(Name, NAME)) { \
2176 auto Params = parsePassParameters(PARSER, Name, NAME); \
2178 return Params.takeError(); \
2179 auto CreatePass = CREATE_PASS; \
2180 if constexpr (std::is_constructible_v< \
2181 std::remove_reference_t<decltype(CreatePass( \
2183 const TargetMachine &, \
2184 std::remove_reference_t<decltype(Params.get())>>) { \
2186 return make_error<StringError>( \
2187 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2188 inconvertibleErrorCode()); \
2191 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2192 return Error::success(); \
2194#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2195 if (Name == NAME) { \
2196 MPM.addPass(createModuleToFunctionPassAdaptor( \
2197 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2198 return Error::success(); \
2200#define LOOP_PASS(NAME, CREATE_PASS) \
2201 if (Name == NAME) { \
2202 MPM.addPass(createModuleToFunctionPassAdaptor( \
2203 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2204 return Error::success(); \
2206#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2207 if (checkParametrizedPassName(Name, NAME)) { \
2208 auto Params = parsePassParameters(PARSER, Name, NAME); \
2210 return Params.takeError(); \
2211 MPM.addPass(createModuleToFunctionPassAdaptor( \
2212 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2213 return Error::success(); \
2215#include "PassRegistry.def"
2217 for (
auto &
C : ModulePipelineParsingCallbacks)
2218 if (
C(Name, MPM, InnerPipeline))
2221 formatv(
"unknown module pass '{}'", Name).str(),
2226 const PipelineElement &
E) {
2227 auto &
Name =
E.Name;
2228 auto &InnerPipeline =
E.InnerPipeline;
2231 if (!InnerPipeline.empty()) {
2232 if (Name ==
"cgscc") {
2234 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2237 CGPM.
addPass(std::move(NestedCGPM));
2242 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2246 std::move(FPM), Params->first, Params->second));
2251 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2258 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2259 if (
C(Name, CGPM, InnerPipeline))
2264 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2269#define CGSCC_PASS(NAME, CREATE_PASS) \
2270 if (Name == NAME) { \
2271 CGPM.addPass(CREATE_PASS); \
2272 return Error::success(); \
2274#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2275 if (checkParametrizedPassName(Name, NAME)) { \
2276 auto Params = parsePassParameters(PARSER, Name, NAME); \
2278 return Params.takeError(); \
2279 CGPM.addPass(CREATE_PASS(Params.get())); \
2280 return Error::success(); \
2282#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2283 if (Name == "require<" NAME ">") { \
2284 CGPM.addPass(RequireAnalysisPass< \
2285 std::remove_reference_t<decltype(CREATE_PASS)>, \
2286 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2287 CGSCCUpdateResult &>()); \
2288 return Error::success(); \
2290 if (Name == "invalidate<" NAME ">") { \
2291 CGPM.addPass(InvalidateAnalysisPass< \
2292 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2293 return Error::success(); \
2295#define FUNCTION_PASS(NAME, CREATE_PASS) \
2296 if (Name == NAME) { \
2297 if constexpr (std::is_constructible_v< \
2298 std::remove_reference_t<decltype(CREATE_PASS)>, \
2299 const TargetMachine &>) { \
2301 return make_error<StringError>( \
2302 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2303 inconvertibleErrorCode()); \
2305 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2306 return Error::success(); \
2308#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2309 if (checkParametrizedPassName(Name, NAME)) { \
2310 auto Params = parsePassParameters(PARSER, Name, NAME); \
2312 return Params.takeError(); \
2313 auto CreatePass = CREATE_PASS; \
2314 if constexpr (std::is_constructible_v< \
2315 std::remove_reference_t<decltype(CreatePass( \
2317 const TargetMachine &, \
2318 std::remove_reference_t<decltype(Params.get())>>) { \
2320 return make_error<StringError>( \
2321 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2322 inconvertibleErrorCode()); \
2325 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2326 return Error::success(); \
2328#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2329 if (Name == NAME) { \
2330 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2331 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2332 return Error::success(); \
2334#define LOOP_PASS(NAME, CREATE_PASS) \
2335 if (Name == NAME) { \
2336 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2337 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2338 return Error::success(); \
2340#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2341 if (checkParametrizedPassName(Name, NAME)) { \
2342 auto Params = parsePassParameters(PARSER, Name, NAME); \
2344 return Params.takeError(); \
2345 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2346 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2347 return Error::success(); \
2349#include "PassRegistry.def"
2351 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2352 if (
C(Name, CGPM, InnerPipeline))
2359 const PipelineElement &
E) {
2360 auto &
Name =
E.Name;
2361 auto &InnerPipeline =
E.InnerPipeline;
2364 if (!InnerPipeline.empty()) {
2365 if (Name ==
"function") {
2367 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2370 FPM.
addPass(std::move(NestedFPM));
2373 if (Name ==
"loop" || Name ==
"loop-mssa") {
2375 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2378 bool UseMemorySSA = (
Name ==
"loop-mssa");
2383 if (Name ==
"machine-function") {
2385 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2391 for (
auto &
C : FunctionPipelineParsingCallbacks)
2392 if (
C(Name, FPM, InnerPipeline))
2397 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2402#define FUNCTION_PASS(NAME, CREATE_PASS) \
2403 if (Name == NAME) { \
2404 if constexpr (std::is_constructible_v< \
2405 std::remove_reference_t<decltype(CREATE_PASS)>, \
2406 const TargetMachine &>) { \
2408 return make_error<StringError>( \
2409 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2410 inconvertibleErrorCode()); \
2412 FPM.addPass(CREATE_PASS); \
2413 return Error::success(); \
2415#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2416 if (checkParametrizedPassName(Name, NAME)) { \
2417 auto Params = parsePassParameters(PARSER, Name, NAME); \
2419 return Params.takeError(); \
2420 auto CreatePass = CREATE_PASS; \
2421 if constexpr (std::is_constructible_v< \
2422 std::remove_reference_t<decltype(CreatePass( \
2424 const TargetMachine &, \
2425 std::remove_reference_t<decltype(Params.get())>>) { \
2427 return make_error<StringError>( \
2428 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2429 inconvertibleErrorCode()); \
2432 FPM.addPass(CREATE_PASS(Params.get())); \
2433 return Error::success(); \
2435#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2436 if (Name == "require<" NAME ">") { \
2437 if constexpr (std::is_constructible_v< \
2438 std::remove_reference_t<decltype(CREATE_PASS)>, \
2439 const TargetMachine &>) { \
2441 return make_error<StringError>( \
2442 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2443 inconvertibleErrorCode()); \
2446 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2448 return Error::success(); \
2450 if (Name == "invalidate<" NAME ">") { \
2451 FPM.addPass(InvalidateAnalysisPass< \
2452 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2453 return Error::success(); \
2459#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2460 if (Name == NAME) { \
2461 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2462 return Error::success(); \
2464#define LOOP_PASS(NAME, CREATE_PASS) \
2465 if (Name == NAME) { \
2466 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2467 return Error::success(); \
2469#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2470 if (checkParametrizedPassName(Name, NAME)) { \
2471 auto Params = parsePassParameters(PARSER, Name, NAME); \
2473 return Params.takeError(); \
2475 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2476 return Error::success(); \
2478#include "PassRegistry.def"
2480 for (
auto &
C : FunctionPipelineParsingCallbacks)
2481 if (
C(Name, FPM, InnerPipeline))
2484 formatv(
"unknown function pass '{}'", Name).str(),
2489 const PipelineElement &
E) {
2490 StringRef
Name =
E.Name;
2491 auto &InnerPipeline =
E.InnerPipeline;
2494 if (!InnerPipeline.empty()) {
2495 if (Name ==
"loop") {
2497 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2500 LPM.addPass(std::move(NestedLPM));
2504 for (
auto &
C : LoopPipelineParsingCallbacks)
2505 if (
C(Name, LPM, InnerPipeline))
2510 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2515#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2516 if (Name == NAME) { \
2517 LPM.addPass(CREATE_PASS); \
2518 return Error::success(); \
2520#define LOOP_PASS(NAME, CREATE_PASS) \
2521 if (Name == NAME) { \
2522 LPM.addPass(CREATE_PASS); \
2523 return Error::success(); \
2525#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2526 if (checkParametrizedPassName(Name, NAME)) { \
2527 auto Params = parsePassParameters(PARSER, Name, NAME); \
2529 return Params.takeError(); \
2530 LPM.addPass(CREATE_PASS(Params.get())); \
2531 return Error::success(); \
2533#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2534 if (Name == "require<" NAME ">") { \
2535 LPM.addPass(RequireAnalysisPass< \
2536 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2537 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2539 return Error::success(); \
2541 if (Name == "invalidate<" NAME ">") { \
2542 LPM.addPass(InvalidateAnalysisPass< \
2543 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2544 return Error::success(); \
2546#include "PassRegistry.def"
2548 for (
auto &
C : LoopPipelineParsingCallbacks)
2549 if (
C(Name, LPM, InnerPipeline))
2556 const PipelineElement &
E) {
2557 StringRef
Name =
E.Name;
2559 if (!
E.InnerPipeline.empty()) {
2560 if (
E.Name ==
"machine-function") {
2562 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2564 MFPM.
addPass(std::move(NestedPM));
2571#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2572 if (Name == NAME) { \
2573 MFPM.addPass(CREATE_PASS); \
2574 return Error::success(); \
2576#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2577 if (Name == NAME) { \
2578 MFPM.addPass(CREATE_PASS); \
2579 return Error::success(); \
2581#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2583 if (checkParametrizedPassName(Name, NAME)) { \
2584 auto Params = parsePassParameters(PARSER, Name, NAME); \
2586 return Params.takeError(); \
2587 MFPM.addPass(CREATE_PASS(Params.get())); \
2588 return Error::success(); \
2590#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2591 if (Name == "require<" NAME ">") { \
2593 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2594 MachineFunction>()); \
2595 return Error::success(); \
2597 if (Name == "invalidate<" NAME ">") { \
2598 MFPM.addPass(InvalidateAnalysisPass< \
2599 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2600 return Error::success(); \
2602#include "llvm/Passes/MachinePassRegistry.def"
2604 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2605 if (
C(Name, MFPM,
E.InnerPipeline))
2608 formatv(
"unknown machine pass '{}'", Name).str(),
2613#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2614 if (Name == NAME) { \
2615 AA.registerModuleAnalysis< \
2616 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2619#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2620 if (Name == NAME) { \
2621 AA.registerFunctionAnalysis< \
2622 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2625#include "PassRegistry.def"
2627 for (
auto &
C : AAParsingCallbacks)
2633Error PassBuilder::parseMachinePassPipeline(
2635 for (
const auto &Element : Pipeline) {
2636 if (
auto Err = parseMachinePass(MFPM, Element))
2644 for (
const auto &Element : Pipeline) {
2645 if (
auto Err = parseLoopPass(LPM, Element))
2651Error PassBuilder::parseFunctionPassPipeline(
2653 for (
const auto &Element : Pipeline) {
2654 if (
auto Err = parseFunctionPass(FPM, Element))
2662 for (
const auto &Element : Pipeline) {
2663 if (
auto Err = parseCGSCCPass(CGPM, Element))
2695 for (
const auto &Element : Pipeline) {
2696 if (
auto Err = parseModulePass(MPM, Element))
2707 auto Pipeline = parsePipelineText(PipelineText);
2708 if (!Pipeline || Pipeline->empty())
2710 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2720 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2722 FunctionPipelineParsingCallbacks)) {
2723 Pipeline = {{
"function", std::move(*Pipeline)}};
2726 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2727 std::move(*Pipeline)}}}};
2728 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2730 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2731 std::move(*Pipeline)}}}};
2733 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2734 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2736 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2737 if (
C(MPM, *Pipeline))
2741 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2743 formatv(
"unknown {} name '{}'",
2744 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2750 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2758 auto Pipeline = parsePipelineText(PipelineText);
2759 if (!Pipeline || Pipeline->empty())
2761 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2767 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2772 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2781 auto Pipeline = parsePipelineText(PipelineText);
2782 if (!Pipeline || Pipeline->empty())
2784 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2790 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2795 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2803 auto Pipeline = parsePipelineText(PipelineText);
2804 if (!Pipeline || Pipeline->empty())
2806 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2809 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2817 auto Pipeline = parsePipelineText(PipelineText);
2818 if (!Pipeline || Pipeline->empty())
2820 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2823 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2832 if (PipelineText ==
"default") {
2837 while (!PipelineText.
empty()) {
2839 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2840 if (!parseAAPassName(
AA, Name))
2842 formatv(
"unknown alias analysis name '{}'", Name).str(),
2849std::optional<RegAllocFilterFunc>
2851 if (FilterName ==
"all")
2853 for (
auto &
C : RegClassFilterParsingCallbacks)
2854 if (
auto F =
C(FilterName))
2856 return std::nullopt;
2867 auto I = PassNames.
begin();
2868 auto End = PassNames.
end();
2875 OS <<
" " << Name <<
'<' << Params <<
">\n";
2882 OS <<
"Module passes:\n";
2883 static constexpr char ModulePassNames[] = {
"\0"
2884#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2885#include "PassRegistry.def"
2889 OS <<
"Module passes with params:\n";
2890 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2891#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2892 NAME "\0" PARAMS "\0"
2893#include "PassRegistry.def"
2897 OS <<
"Module analyses:\n";
2898 static constexpr char ModuleAnalysisNames[] = {
"\0"
2899#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2900#include "PassRegistry.def"
2904 OS <<
"Module alias analyses:\n";
2905 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2906#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2907#include "PassRegistry.def"
2911 OS <<
"CGSCC passes:\n";
2912 static constexpr char CGSCCPassNames[] = {
"\0"
2913#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2914#include "PassRegistry.def"
2918 OS <<
"CGSCC passes with params:\n";
2919 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2920#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2921 NAME "\0" PARAMS "\0"
2922#include "PassRegistry.def"
2926 OS <<
"CGSCC analyses:\n";
2927 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2928#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2929#include "PassRegistry.def"
2933 OS <<
"Function passes:\n";
2934 static constexpr char FunctionPassNames[] = {
"\0"
2935#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2936#include "PassRegistry.def"
2940 OS <<
"Function passes with params:\n";
2941 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2942#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2943 NAME "\0" PARAMS "\0"
2944#include "PassRegistry.def"
2948 OS <<
"Function analyses:\n";
2949 static constexpr char FunctionAnalysisNames[] = {
"\0"
2950#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2951#include "PassRegistry.def"
2955 OS <<
"Function alias analyses:\n";
2956 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2957#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2958#include "PassRegistry.def"
2962 OS <<
"LoopNest passes:\n";
2963 static constexpr char LoopNestPassNames[] = {
"\0"
2964#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2965#include "PassRegistry.def"
2969 OS <<
"Loop passes:\n";
2970 static constexpr char LoopPassNames[] = {
"\0"
2971#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2972#include "PassRegistry.def"
2976 OS <<
"Loop passes with params:\n";
2977 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2978#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2979 NAME "\0" PARAMS "\0"
2980#include "PassRegistry.def"
2984 OS <<
"Loop analyses:\n";
2985 static constexpr char LoopAnalysisNames[] = {
"\0"
2986#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2987#include "PassRegistry.def"
2991 OS <<
"Machine module passes (WIP):\n";
2992 static constexpr char MachineModulePassNames[] = {
"\0"
2993#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2994#include "llvm/Passes/MachinePassRegistry.def"
2998 OS <<
"Machine function passes (WIP):\n";
2999 static constexpr char MachineFunctionPassNames[] = {
"\0"
3000#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3001#include "llvm/Passes/MachinePassRegistry.def"
3005 OS <<
"Machine function analyses (WIP):\n";
3006 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3007#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3008#include "llvm/Passes/MachinePassRegistry.def"
3016 TopLevelPipelineParsingCallbacks.push_back(
C);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...
This file implements a simple N^2 alias analysis accuracy evaluator.
Provides passes to inlining "always_inline" functions.
This is the interface for LLVM's primary stateless and local alias analysis.
This file contains the declaration of the BreakFalseDepsPass class, used to identify and avoid false ...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Contains definition of the base CFIFixup pass.
This file provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
Provides analysis for continuously CSEing during GISel passes.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
Defines an IR pass for CodeGen Prepare.
This file contains the declaration of the MachineKCFI class, which is a Machine Pass that implements ...
#define LLVM_ATTRIBUTE_NOINLINE
LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inl...
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
Analysis that tracks defined/used subregister lanes across COPY instructions and instructions that ge...
This file provides the interface for a simple, fast CSE pass.
This file provides a pass which clones the current module and runs the provided pass pipeline on the ...
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Provides passes for computing function attributes based on interprocedural analyses.
This file provides the interface for the GCOV style profiler pass.
Provides analysis for querying information about KnownBits during GISel passes.
This file provides the interface for the GVNHoist pass.
This file provides the interface for the GVNSink pass.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
This is the interface for a simple mod/ref and alias analysis over globals.
Defines an IR pass for the creation of hardware loops.
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder inte...
This file defines passes to print out IR in various granularities.
This file declares the IRTranslator pass.
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file provides the interface for LLVM's Logical Scalar Replacement of Aggregates pass.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
Machine Check Debug Module
This file contains the declaration of the CheckDebugMachineModulePass class, used by the new pass man...
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
This pass performs merges of loads and stores on both sides of a.
This is the interface to build a ModuleSummaryIndex for a module.
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
This file provides the interface for LLVM's Global Value Numbering pass.
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassBuilder PB(Mod->getContext(), Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static std::optional< int > parseDevirtPassName(StringRef Name)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameList(StringTable PassNames, raw_ostream &OS)
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static Expected< OptimizationLevel > parseOptLevelParam(StringRef S)
static std::optional< OptimizationLevel > parseOptLevel(StringRef S)
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static std::optional< std::pair< bool, bool > > parseFunctionPipelineName(StringRef Name)
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameListWithParams(StringTable PassNames, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static void setupOptionsForPipelineAlias(PipelineTuningOptions &PTO, OptimizationLevel L)
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file contains the declaration of the ResetMachineFunctionPass class.
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
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.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
This is an important class for using LLVM in a threaded context.
MachineFunction & getMF()
This analysis create MachineFunction for given Function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineFunctionProperties & getProperties() const
Get the function properties.
LLVM_ABI Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
This class provides access to building LLVM's passes.
LLVM_ABI void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
LLVM_ABI AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
LLVM_ABI Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
LLVM_ABI void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
LLVM_ABI std::optional< RegAllocFilterFunc > parseRegAllocFilter(StringRef RegAllocFilterName)
Parse RegAllocFilterName to get RegAllocFilterFunc.
LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
LLVM_ABI PassBuilder(LLVMContext &Context, TargetMachine *TM=nullptr, std::optional< PipelineTuningOptions > PTO=std::nullopt, std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
The pipelines read the library options of Context, which must outlive the PassBuilder.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
LLVM_ABI void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
LLVM_ABI std::optional< PrintPipelinePassesFormat > getPrintPipelinePasses() const
The format -print-pipeline-passes requests, or std::nullopt if it is not given.
LLVM_ABI void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
static LLVM_ABI Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
LLVM_ABI void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
LLVM_ABI void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis 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)
Tunable parameters for passes in the default pipelines.
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
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.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
Check if the string is empty.
char front() const
Get the first character in the string.
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 & Case(StringLiteral S, T Value)
A table of densely packed, null-terminated strings indexed by offset.
constexpr Iterator begin() const
constexpr Iterator end() const
Primary interface to the complete machine description for the target machine.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
Interfaces for registering analysis passes, producing common pass manager configurations,...
Abstract Attribute helper functions.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
@ BasicBlock
Various leaf nodes.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
DropTestKind
Specifies how to drop type tests.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
DevirtSCCRepeatedPass createDevirtSCCRepeatedPass(CGSCCPassT &&Pass, int MaxIterations)
A function to deduce a function pass type and wrap it in the templated adaptor.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
@ O1
Optimize quickly without destroying debuggability.
@ O0
Disable as many optimizations as possible.
@ O3
Optimize for fast execution as much as possible.
@ O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
InnerAnalysisManagerProxy< LoopAnalysisManager, Function > LoopAnalysisManagerFunctionProxy
A proxy from a LoopAnalysisManager to a Function.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
AnalysisManager< LazyCallGraph::SCC, LazyCallGraph & > CGSCCAnalysisManager
The CGSCC analysis manager.
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
FunctionToLoopPassAdaptor createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
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.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
FunctionToMachineFunctionPassAdaptor createFunctionToMachineFunctionPassAdaptor(MachineFunctionPassT &&Pass)
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
InnerAnalysisManagerProxy< MachineFunctionAnalysisManager, Function > MachineFunctionAnalysisManagerFunctionProxy
OuterAnalysisManagerProxy< FunctionAnalysisManager, Loop, LoopStandardAnalysisResults & > FunctionAnalysisManagerLoopProxy
A proxy from a FunctionAnalysisManager to a Loop.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
support::detail::RepeatAdapter< T > fmt_repeat(T &&Item, size_t Count)
OuterAnalysisManagerProxy< ModuleAnalysisManager, LazyCallGraph::SCC, LazyCallGraph & > ModuleAnalysisManagerCGSCCProxy
A proxy from a ModuleAnalysisManager to an SCC.
InnerAnalysisManagerProxy< MachineFunctionAnalysisManager, Module > MachineFunctionAnalysisManagerModuleProxy
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
InnerAnalysisManagerProxy< CGSCCAnalysisManager, Module > CGSCCAnalysisManagerModuleProxy
A proxy from a CGSCCAnalysisManager to a Module.
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
MFPropsModifier(PassT &P, MachineFunction &MF) -> MFPropsModifier< PassT >
LLVM_ABI void printFormattedPipelinePasses(raw_ostream &OS, StringRef Pipeline, PrintPipelinePassesFormat Format=PrintPipelinePassesFormat::Text)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
PassManager< MachineFunction > MachineFunctionPassManager
Convenience typedef for a pass manager over functions.
LLVM_ABI bool applyDebugifyMetadataToMachineFunction(DIBuilder &DIB, Function &F, llvm::function_ref< MachineFunction *(Function &)> GetMF)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI std::optional< AllocTokenMode > getAllocTokenModeFromString(StringRef Name)
Returns the AllocTokenMode from its canonical string name; if an invalid name was provided returns nu...
@ End
Run the machine verifier once, at the end of the pipeline.
PrintPipelinePassesFormat
@ Detailed
Hash with opcode only.
@ CallTargetIgnored
Hash with opcode and operands.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Implement std::hash so that hash_code can be used in STL containers.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A set of parameters to control various transforms performed by GVN pass.
HardwareLoopOptions & setForceNested(bool Force)
HardwareLoopOptions & setDecrement(unsigned Count)
HardwareLoopOptions & setForceGuard(bool Force)
HardwareLoopOptions & setForce(bool Force)
HardwareLoopOptions & setCounterBitwidth(unsigned Width)
HardwareLoopOptions & setForcePhi(bool Force)
A set of parameters to control various transforms performed by IPSCCP pass.
A set of parameters used to control various transforms performed by the LoopUnroll pass.
LoopUnrollOptions & setPeeling(bool Peeling)
Enables or disables loop peeling.
LoopUnrollOptions & setOptLevel(int O)
LoopUnrollOptions & setPartial(bool Partial)
Enables or disables partial unrolling.
LoopUnrollOptions & setFullUnrollMaxCount(unsigned O)
LoopUnrollOptions & setPrepareForLTO(bool V)
LoopUnrollOptions & setUpperBound(bool UpperBound)
Enables or disables the use of trip count upper bound in loop unrolling.
LoopUnrollOptions & setRuntime(bool Runtime)
Enables or disables unrolling of loops with runtime trip count.
LoopUnrollOptions & setProfileBasedPeeling(int O)
LoopVectorizeOptions & setVectorizeOnlyWhenForced(bool Value)
LoopVectorizeOptions & setInterleaveOnlyWhenForced(bool Value)
A CRTP mix-in for passes that can be skipped.
RegAllocFilterFunc Filter