415 "Print string describing the pipeline (best-effort only).\n"
416 " - =text\tPrint a '-passes' compatible string describing the "
418 " - =tree\tPrint a tree-like structure describing the pipeline."));
422 std::optional<PrintPipelinePassesFormat> &Val) {
423 std::optional<PrintPipelinePassesFormat>
Format =
432 "'{0}' value invalid for print-pipeline-passes argument!", Arg));
446 for (
char C : Pipeline) {
454 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
484 return MFA ? &MFA->
getMF() :
nullptr;
490class TriggerVerifierErrorPass
496 auto *PtrTy = PointerType::getUnqual(
M.getContext());
498 GlobalValue::LinkageTypes::InternalLinkage,
499 "__bad_alias",
nullptr, &M);
519 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
524class RequireAllMachineFunctionPropertiesPass
532 static MachineFunctionProperties getRequiredProperties() {
533 return MachineFunctionProperties()
535 .setFailsVerification()
540 .setRegBankSelected()
542 .setTiedOpsRewritten()
543 .setTracksDebugUserValues()
544 .setTracksLiveness();
546 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
552 if (S ==
"Os" || S ==
"Oz")
554 Twine(
"The optimization level \"") + S +
555 "\" is no longer supported. Use O2 in conjunction with the " +
556 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
567 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
571 formatv(
"invalid optimization level '{}'", S).str(),
576 std::optional<PGOOptions> PGOOpt,
579 : TM(TM), PTO(PTO), 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");
890 while (!Params.
empty()) {
892 std::tie(ParamName, Params) = Params.
split(
';');
893 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
895 UnrollOpts.
setOptLevel(OptLevel->getSpeedupLevel());
902 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
909 if (ParamName ==
"partial") {
911 }
else if (ParamName ==
"peeling") {
913 }
else if (ParamName ==
"profile-peeling") {
915 }
else if (ParamName ==
"runtime") {
917 }
else if (ParamName ==
"upperbound") {
921 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
930 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
950 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
959 "EntryExitInstrumenter");
964 "DropUnnecessaryAssumes");
973 "LowerMatrixIntrinsics");
978 while (!Params.
empty()) {
980 std::tie(ParamName, Params) = Params.
split(
';');
983 if (ParamName ==
"preserve-order")
985 else if (ParamName ==
"rename-all")
987 else if (ParamName ==
"fold-all")
989 else if (ParamName ==
"reorder-operands")
993 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1003 while (!Params.
empty()) {
1005 std::tie(ParamName, Params) = Params.
split(
';');
1007 if (ParamName ==
"kernel") {
1008 Result.CompileKernel =
true;
1009 }
else if (ParamName ==
"use-after-scope") {
1010 Result.UseAfterScope =
true;
1013 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1023 while (!Params.
empty()) {
1025 std::tie(ParamName, Params) = Params.
split(
';');
1027 if (ParamName ==
"recover") {
1029 }
else if (ParamName ==
"kernel") {
1030 Result.CompileKernel =
true;
1033 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1042parseDropTypeTestsPassOptions(
StringRef Params) {
1044 while (!Params.
empty()) {
1046 std::tie(ParamName, Params) = Params.
split(
';');
1048 if (ParamName ==
"all") {
1050 }
else if (ParamName ==
"assume") {
1054 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1063 while (!Params.
empty()) {
1065 std::tie(ParamName, Params) = Params.
split(
';');
1067 if (ParamName ==
"thinlto") {
1069 }
else if (ParamName ==
"emit-summary") {
1070 Result.EmitLTOSummary =
true;
1073 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1081parseLowerAllowCheckPassOptions(
StringRef Params) {
1083 while (!Params.
empty()) {
1085 std::tie(ParamName, Params) = Params.
split(
';');
1096 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1103 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1108 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1110 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1111 IndicesStr, CutoffStr)
1115 while (IndicesStr !=
"") {
1117 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1123 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1124 firstIndexStr, IndicesStr)
1131 if (index >=
Result.cutoffs.size())
1132 Result.cutoffs.resize(index + 1, 0);
1134 Result.cutoffs[index] = cutoff;
1136 }
else if (ParamName.
starts_with(
"runtime_check")) {
1138 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1142 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1144 ValueString, Params)
1148 Result.runtime_check = runtime_check;
1151 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1162 while (!Params.
empty()) {
1164 std::tie(ParamName, Params) = Params.
split(
';');
1166 if (ParamName ==
"recover") {
1168 }
else if (ParamName ==
"kernel") {
1173 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1178 }
else if (ParamName ==
"eager-checks") {
1179 Result.EagerChecks =
true;
1182 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1192 while (!Params.
empty()) {
1194 std::tie(ParamName, Params) = Params.
split(
';');
1201 formatv(
"invalid argument to AllocToken pass mode "
1208 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1218 while (!Params.
empty()) {
1220 std::tie(ParamName, Params) = Params.
split(
';');
1223 if (ParamName ==
"speculate-blocks") {
1225 }
else if (ParamName ==
"simplify-cond-branch") {
1227 }
else if (ParamName ==
"forward-switch-cond") {
1229 }
else if (ParamName ==
"switch-range-to-icmp") {
1231 }
else if (ParamName ==
"switch-to-arithmetic") {
1233 }
else if (ParamName ==
"switch-to-lookup") {
1235 }
else if (ParamName ==
"keep-loops") {
1237 }
else if (ParamName ==
"hoist-common-insts") {
1239 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1241 }
else if (ParamName ==
"sink-common-insts") {
1243 }
else if (ParamName ==
"speculate-unpredictables") {
1246 APInt BonusInstThreshold;
1249 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1257 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1268 Result.setVerifyFixpoint(
true);
1269 while (!Params.
empty()) {
1271 std::tie(ParamName, Params) = Params.
split(
';');
1274 if (ParamName ==
"verify-fixpoint") {
1277 APInt MaxIterations;
1280 formatv(
"invalid argument to InstCombine pass max-iterations "
1288 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1298 while (!Params.
empty()) {
1300 std::tie(ParamName, Params) = Params.
split(
';');
1303 if (ParamName ==
"interleave-forced-only") {
1305 }
else if (ParamName ==
"vectorize-forced-only") {
1309 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1317 std::pair<bool, bool>
Result = {
false,
true};
1318 while (!Params.
empty()) {
1320 std::tie(ParamName, Params) = Params.
split(
';');
1323 if (ParamName ==
"nontrivial") {
1325 }
else if (ParamName ==
"trivial") {
1329 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1338 while (!Params.
empty()) {
1340 std::tie(ParamName, Params) = Params.
split(
';');
1343 if (ParamName ==
"allowspeculation") {
1347 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1354struct LoopRotateOptions {
1355 bool EnableHeaderDuplication =
true;
1356 bool PrepareForLTO =
false;
1357 bool CheckExitCount =
false;
1361 LoopRotateOptions
Result;
1362 while (!Params.
empty()) {
1364 std::tie(ParamName, Params) = Params.
split(
';');
1367 if (ParamName ==
"header-duplication") {
1369 }
else if (ParamName ==
"prepare-for-lto") {
1371 }
else if (ParamName ==
"check-exit-count") {
1375 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1384 while (!Params.
empty()) {
1386 std::tie(ParamName, Params) = Params.
split(
';');
1389 if (ParamName ==
"split-footer-bb") {
1393 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1404 while (!Params.
empty()) {
1406 std::tie(ParamName, Params) = Params.
split(
';');
1409 if (ParamName ==
"scalar-pre") {
1411 }
else if (ParamName ==
"load-pre") {
1413 }
else if (ParamName ==
"split-backedge-load-pre") {
1415 }
else if (ParamName ==
"memdep") {
1419 }
else if (ParamName ==
"memoryssa") {
1425 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1434 while (!Params.
empty()) {
1436 std::tie(ParamName, Params) = Params.
split(
';');
1439 if (ParamName ==
"func-spec")
1443 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1451 while (!Params.
empty()) {
1453 std::tie(ParamName, Params) = Params.
split(
';');
1458 formatv(
"invalid argument to Scalarizer pass min-bits "
1469 if (ParamName ==
"load-store")
1471 else if (ParamName ==
"variable-insert-extract")
1475 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1485 bool SawCFGOption =
false;
1486 while (!Params.
empty()) {
1488 std::tie(ParamName, Params) = Params.
split(
';');
1490 if (ParamName ==
"modify-cfg") {
1495 SawCFGOption =
true;
1496 }
else if (ParamName ==
"preserve-cfg") {
1501 SawCFGOption =
true;
1502 }
else if (ParamName ==
"aggregate-to-vector") {
1503 Result.AggregateToVector =
true;
1506 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1507 "modify-cfg, or aggregate-to-vector)",
1517parseStackLifetimeOptions(
StringRef Params) {
1519 while (!Params.
empty()) {
1521 std::tie(ParamName, Params) = Params.
split(
';');
1523 if (ParamName ==
"may") {
1525 }
else if (ParamName ==
"must") {
1529 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1538 "DependenceAnalysisPrinter");
1543 "SeparateConstOffsetFromGEP");
1552parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1556 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1564 "MemorySSAPrinterPass");
1569 "SpeculativeExecutionPass");
1574 while (!Params.
empty()) {
1576 std::tie(ParamName, Params) = Params.
split(
';');
1582 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1590parseStructuralHashPrinterPassOptions(
StringRef Params) {
1593 if (Params ==
"detailed")
1595 if (Params ==
"call-target-ignored")
1598 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1604 "WinEHPreparePass");
1609 while (!Params.
empty()) {
1611 std::tie(ParamName, Params) = Params.
split(
';');
1614 if (ParamName ==
"group-by-use")
1616 else if (ParamName ==
"ignore-single-use")
1618 else if (ParamName ==
"merge-const")
1620 else if (ParamName ==
"merge-const-aggressive")
1622 else if (ParamName ==
"merge-external")
1627 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1631 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1640 while (!Params.
empty()) {
1642 std::tie(ParamName, Params) = Params.
split(
';');
1648 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1659 while (!Params.
empty()) {
1661 std::tie(ParamName, Params) = Params.
split(
';');
1664 std::optional<RegAllocFilterFunc>
Filter =
1668 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1677 if (ParamName ==
"no-clear-vregs") {
1683 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1690parseBoundsCheckingOptions(
StringRef Params) {
1692 while (!Params.
empty()) {
1694 std::tie(ParamName, Params) = Params.
split(
';');
1695 if (ParamName ==
"trap") {
1697 }
else if (ParamName ==
"rt") {
1703 }
else if (ParamName ==
"rt-abort") {
1709 }
else if (ParamName ==
"min-rt") {
1715 }
else if (ParamName ==
"min-rt-abort") {
1721 }
else if (ParamName ==
"merge") {
1723 }
else if (ParamName ==
"handler-preserve-all-regs") {
1725 Options.Rt->HandlerPreserveAllRegs =
true;
1729 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1735 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1752 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1754 Param.str().c_str());
1757 if (!
Level.has_value())
1759 "invalid optimization level for expand-ir-insts pass: %s",
1760 Digit.str().c_str());
1767 if (Params.
empty() || Params ==
"all")
1768 return RAGreedyPass::Options();
1772 return RAGreedyPass::Options{*
Filter, Params};
1775 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1781 "MachineSinkingPass");
1785 bool AllowTailMerge =
true;
1786 if (!Params.
empty()) {
1788 if (Params !=
"tail-merge")
1790 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1794 return AllowTailMerge;
1798 bool ClearVirtRegs =
true;
1799 if (!Params.
empty()) {
1801 if (Params !=
"clear-vregs")
1803 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1806 return ClearVirtRegs;
1809struct FatLTOOptions {
1810 OptimizationLevel OptLevel;
1811 bool ThinLTO =
false;
1812 bool EmitSummary =
false;
1817 bool HaveOptLevel =
false;
1818 while (!Params.
empty()) {
1820 std::tie(ParamName, Params) = Params.
split(
';');
1822 if (ParamName ==
"thinlto") {
1824 }
else if (ParamName ==
"emit-summary") {
1825 Result.EmitSummary =
true;
1826 }
else if (std::optional<OptimizationLevel> OptLevel =
1828 Result.OptLevel = *OptLevel;
1829 HaveOptLevel =
true;
1832 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1839 "missing optimization level for fatlto-pre-link pipeline",
1854template <
typename PassManagerT,
typename CallbacksT>
1856 if (!Callbacks.empty()) {
1857 PassManagerT DummyPM;
1858 for (
auto &CB : Callbacks)
1859 if (CB(Name, DummyPM, {}))
1865template <
typename CallbacksT>
1867 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1870 if (Name ==
"module")
1872 if (Name ==
"cgscc")
1874 if (NameNoBracket ==
"function")
1876 if (Name ==
"coro-cond")
1879#define MODULE_PASS(NAME, CREATE_PASS) \
1882#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1883 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1885#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1886 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1888#include "PassRegistry.def"
1893template <
typename CallbacksT>
1896 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1897 if (Name ==
"cgscc")
1899 if (NameNoBracket ==
"function")
1906#define CGSCC_PASS(NAME, CREATE_PASS) \
1909#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1910 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1912#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1913 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1915#include "PassRegistry.def"
1920template <
typename CallbacksT>
1923 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1924 if (NameNoBracket ==
"function")
1926 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1929#define FUNCTION_PASS(NAME, CREATE_PASS) \
1932#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1933 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1935#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1936 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1938#include "PassRegistry.def"
1943template <
typename CallbacksT>
1946 if (Name ==
"machine-function")
1949#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1952#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1954 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1957#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1958 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1961#include "llvm/Passes/MachinePassRegistry.def"
1966template <
typename CallbacksT>
1968 bool &UseMemorySSA) {
1969 UseMemorySSA =
false;
1972 UseMemorySSA =
true;
1976#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1979#include "PassRegistry.def"
1984template <
typename CallbacksT>
1986 bool &UseMemorySSA) {
1987 UseMemorySSA =
false;
1990 UseMemorySSA =
true;
1994#define LOOP_PASS(NAME, CREATE_PASS) \
1997#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1998 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2000#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2001 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2003#include "PassRegistry.def"
2008std::optional<std::vector<PassBuilder::PipelineElement>>
2010 std::vector<PipelineElement> ResultPipeline;
2015 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2016 size_t Pos =
Text.find_first_of(
",()");
2017 Pipeline.push_back({
Text.substr(0, Pos), {}});
2020 if (Pos ==
Text.npos)
2023 char Sep =
Text[Pos];
2031 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2035 assert(Sep ==
')' &&
"Bogus separator!");
2040 if (PipelineStack.
size() == 1)
2041 return std::nullopt;
2044 }
while (
Text.consume_front(
")"));
2052 if (!
Text.consume_front(
","))
2053 return std::nullopt;
2056 if (PipelineStack.
size() > 1)
2058 return std::nullopt;
2060 assert(PipelineStack.
back() == &ResultPipeline &&
2061 "Wrong pipeline at the bottom of the stack!");
2062 return {std::move(ResultPipeline)};
2072 const PipelineElement &
E) {
2073 auto &
Name =
E.Name;
2074 auto &InnerPipeline =
E.InnerPipeline;
2077 if (!InnerPipeline.empty()) {
2078 if (Name ==
"module") {
2080 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2082 MPM.
addPass(std::move(NestedMPM));
2085 if (Name ==
"coro-cond") {
2087 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2089 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2092 if (Name ==
"cgscc") {
2094 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2102 "cannot have a no-rerun module to function adaptor",
2105 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2112 for (
auto &
C : ModulePipelineParsingCallbacks)
2113 if (
C(Name, MPM, InnerPipeline))
2118 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2124#define MODULE_PASS(NAME, CREATE_PASS) \
2125 if (Name == NAME) { \
2126 MPM.addPass(CREATE_PASS); \
2127 return Error::success(); \
2129#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2130 if (checkParametrizedPassName(Name, NAME)) { \
2131 auto Params = parsePassParameters(PARSER, Name, NAME); \
2133 return Params.takeError(); \
2134 MPM.addPass(CREATE_PASS(Params.get())); \
2135 return Error::success(); \
2137#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2138 if (Name == "require<" NAME ">") { \
2140 RequireAnalysisPass< \
2141 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2142 return Error::success(); \
2144 if (Name == "invalidate<" NAME ">") { \
2145 MPM.addPass(InvalidateAnalysisPass< \
2146 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2147 return Error::success(); \
2149#define CGSCC_PASS(NAME, CREATE_PASS) \
2150 if (Name == NAME) { \
2151 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2152 return Error::success(); \
2154#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2155 if (checkParametrizedPassName(Name, NAME)) { \
2156 auto Params = parsePassParameters(PARSER, Name, NAME); \
2158 return Params.takeError(); \
2160 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2161 return Error::success(); \
2163#define FUNCTION_PASS(NAME, CREATE_PASS) \
2164 if (Name == NAME) { \
2165 if constexpr (std::is_constructible_v< \
2166 std::remove_reference_t<decltype(CREATE_PASS)>, \
2167 const TargetMachine &>) { \
2169 return make_error<StringError>( \
2170 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2171 inconvertibleErrorCode()); \
2173 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2174 return Error::success(); \
2176#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2177 if (checkParametrizedPassName(Name, NAME)) { \
2178 auto Params = parsePassParameters(PARSER, Name, NAME); \
2180 return Params.takeError(); \
2181 auto CreatePass = CREATE_PASS; \
2182 if constexpr (std::is_constructible_v< \
2183 std::remove_reference_t<decltype(CreatePass( \
2185 const TargetMachine &, \
2186 std::remove_reference_t<decltype(Params.get())>>) { \
2188 return make_error<StringError>( \
2189 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2190 inconvertibleErrorCode()); \
2193 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2194 return Error::success(); \
2196#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2197 if (Name == NAME) { \
2198 MPM.addPass(createModuleToFunctionPassAdaptor( \
2199 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2200 return Error::success(); \
2202#define LOOP_PASS(NAME, CREATE_PASS) \
2203 if (Name == NAME) { \
2204 MPM.addPass(createModuleToFunctionPassAdaptor( \
2205 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2206 return Error::success(); \
2208#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2209 if (checkParametrizedPassName(Name, NAME)) { \
2210 auto Params = parsePassParameters(PARSER, Name, NAME); \
2212 return Params.takeError(); \
2213 MPM.addPass(createModuleToFunctionPassAdaptor( \
2214 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2215 return Error::success(); \
2217#include "PassRegistry.def"
2219 for (
auto &
C : ModulePipelineParsingCallbacks)
2220 if (
C(Name, MPM, InnerPipeline))
2223 formatv(
"unknown module pass '{}'", Name).str(),
2228 const PipelineElement &
E) {
2229 auto &
Name =
E.Name;
2230 auto &InnerPipeline =
E.InnerPipeline;
2233 if (!InnerPipeline.empty()) {
2234 if (Name ==
"cgscc") {
2236 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2239 CGPM.
addPass(std::move(NestedCGPM));
2244 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2248 std::move(FPM), Params->first, Params->second));
2253 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2260 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2261 if (
C(Name, CGPM, InnerPipeline))
2266 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2271#define CGSCC_PASS(NAME, CREATE_PASS) \
2272 if (Name == NAME) { \
2273 CGPM.addPass(CREATE_PASS); \
2274 return Error::success(); \
2276#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2277 if (checkParametrizedPassName(Name, NAME)) { \
2278 auto Params = parsePassParameters(PARSER, Name, NAME); \
2280 return Params.takeError(); \
2281 CGPM.addPass(CREATE_PASS(Params.get())); \
2282 return Error::success(); \
2284#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2285 if (Name == "require<" NAME ">") { \
2286 CGPM.addPass(RequireAnalysisPass< \
2287 std::remove_reference_t<decltype(CREATE_PASS)>, \
2288 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2289 CGSCCUpdateResult &>()); \
2290 return Error::success(); \
2292 if (Name == "invalidate<" NAME ">") { \
2293 CGPM.addPass(InvalidateAnalysisPass< \
2294 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2295 return Error::success(); \
2297#define FUNCTION_PASS(NAME, CREATE_PASS) \
2298 if (Name == NAME) { \
2299 if constexpr (std::is_constructible_v< \
2300 std::remove_reference_t<decltype(CREATE_PASS)>, \
2301 const TargetMachine &>) { \
2303 return make_error<StringError>( \
2304 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2305 inconvertibleErrorCode()); \
2307 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2308 return Error::success(); \
2310#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2311 if (checkParametrizedPassName(Name, NAME)) { \
2312 auto Params = parsePassParameters(PARSER, Name, NAME); \
2314 return Params.takeError(); \
2315 auto CreatePass = CREATE_PASS; \
2316 if constexpr (std::is_constructible_v< \
2317 std::remove_reference_t<decltype(CreatePass( \
2319 const TargetMachine &, \
2320 std::remove_reference_t<decltype(Params.get())>>) { \
2322 return make_error<StringError>( \
2323 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2324 inconvertibleErrorCode()); \
2327 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2328 return Error::success(); \
2330#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2331 if (Name == NAME) { \
2332 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2333 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2334 return Error::success(); \
2336#define LOOP_PASS(NAME, CREATE_PASS) \
2337 if (Name == NAME) { \
2338 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2339 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2340 return Error::success(); \
2342#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2343 if (checkParametrizedPassName(Name, NAME)) { \
2344 auto Params = parsePassParameters(PARSER, Name, NAME); \
2346 return Params.takeError(); \
2347 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2348 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2349 return Error::success(); \
2351#include "PassRegistry.def"
2353 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2354 if (
C(Name, CGPM, InnerPipeline))
2361 const PipelineElement &
E) {
2362 auto &
Name =
E.Name;
2363 auto &InnerPipeline =
E.InnerPipeline;
2366 if (!InnerPipeline.empty()) {
2367 if (Name ==
"function") {
2369 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2372 FPM.
addPass(std::move(NestedFPM));
2375 if (Name ==
"loop" || Name ==
"loop-mssa") {
2377 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2380 bool UseMemorySSA = (
Name ==
"loop-mssa");
2385 if (Name ==
"machine-function") {
2387 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2393 for (
auto &
C : FunctionPipelineParsingCallbacks)
2394 if (
C(Name, FPM, InnerPipeline))
2399 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2404#define FUNCTION_PASS(NAME, CREATE_PASS) \
2405 if (Name == NAME) { \
2406 if constexpr (std::is_constructible_v< \
2407 std::remove_reference_t<decltype(CREATE_PASS)>, \
2408 const TargetMachine &>) { \
2410 return make_error<StringError>( \
2411 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2412 inconvertibleErrorCode()); \
2414 FPM.addPass(CREATE_PASS); \
2415 return Error::success(); \
2417#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2418 if (checkParametrizedPassName(Name, NAME)) { \
2419 auto Params = parsePassParameters(PARSER, Name, NAME); \
2421 return Params.takeError(); \
2422 auto CreatePass = CREATE_PASS; \
2423 if constexpr (std::is_constructible_v< \
2424 std::remove_reference_t<decltype(CreatePass( \
2426 const TargetMachine &, \
2427 std::remove_reference_t<decltype(Params.get())>>) { \
2429 return make_error<StringError>( \
2430 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2431 inconvertibleErrorCode()); \
2434 FPM.addPass(CREATE_PASS(Params.get())); \
2435 return Error::success(); \
2437#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2438 if (Name == "require<" NAME ">") { \
2439 if constexpr (std::is_constructible_v< \
2440 std::remove_reference_t<decltype(CREATE_PASS)>, \
2441 const TargetMachine &>) { \
2443 return make_error<StringError>( \
2444 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2445 inconvertibleErrorCode()); \
2448 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2450 return Error::success(); \
2452 if (Name == "invalidate<" NAME ">") { \
2453 FPM.addPass(InvalidateAnalysisPass< \
2454 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2455 return Error::success(); \
2461#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2462 if (Name == NAME) { \
2463 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2464 return Error::success(); \
2466#define LOOP_PASS(NAME, CREATE_PASS) \
2467 if (Name == NAME) { \
2468 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2469 return Error::success(); \
2471#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2472 if (checkParametrizedPassName(Name, NAME)) { \
2473 auto Params = parsePassParameters(PARSER, Name, NAME); \
2475 return Params.takeError(); \
2477 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2478 return Error::success(); \
2480#include "PassRegistry.def"
2482 for (
auto &
C : FunctionPipelineParsingCallbacks)
2483 if (
C(Name, FPM, InnerPipeline))
2486 formatv(
"unknown function pass '{}'", Name).str(),
2491 const PipelineElement &
E) {
2492 StringRef
Name =
E.Name;
2493 auto &InnerPipeline =
E.InnerPipeline;
2496 if (!InnerPipeline.empty()) {
2497 if (Name ==
"loop") {
2499 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2502 LPM.addPass(std::move(NestedLPM));
2506 for (
auto &
C : LoopPipelineParsingCallbacks)
2507 if (
C(Name, LPM, InnerPipeline))
2512 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2517#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2518 if (Name == NAME) { \
2519 LPM.addPass(CREATE_PASS); \
2520 return Error::success(); \
2522#define LOOP_PASS(NAME, CREATE_PASS) \
2523 if (Name == NAME) { \
2524 LPM.addPass(CREATE_PASS); \
2525 return Error::success(); \
2527#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2528 if (checkParametrizedPassName(Name, NAME)) { \
2529 auto Params = parsePassParameters(PARSER, Name, NAME); \
2531 return Params.takeError(); \
2532 LPM.addPass(CREATE_PASS(Params.get())); \
2533 return Error::success(); \
2535#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2536 if (Name == "require<" NAME ">") { \
2537 LPM.addPass(RequireAnalysisPass< \
2538 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2539 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2541 return Error::success(); \
2543 if (Name == "invalidate<" NAME ">") { \
2544 LPM.addPass(InvalidateAnalysisPass< \
2545 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2546 return Error::success(); \
2548#include "PassRegistry.def"
2550 for (
auto &
C : LoopPipelineParsingCallbacks)
2551 if (
C(Name, LPM, InnerPipeline))
2558 const PipelineElement &
E) {
2559 StringRef
Name =
E.Name;
2561 if (!
E.InnerPipeline.empty()) {
2562 if (
E.Name ==
"machine-function") {
2564 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2566 MFPM.
addPass(std::move(NestedPM));
2573#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2574 if (Name == NAME) { \
2575 MFPM.addPass(CREATE_PASS); \
2576 return Error::success(); \
2578#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2579 if (Name == NAME) { \
2580 MFPM.addPass(CREATE_PASS); \
2581 return Error::success(); \
2583#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2585 if (checkParametrizedPassName(Name, NAME)) { \
2586 auto Params = parsePassParameters(PARSER, Name, NAME); \
2588 return Params.takeError(); \
2589 MFPM.addPass(CREATE_PASS(Params.get())); \
2590 return Error::success(); \
2592#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2593 if (Name == "require<" NAME ">") { \
2595 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2596 MachineFunction>()); \
2597 return Error::success(); \
2599 if (Name == "invalidate<" NAME ">") { \
2600 MFPM.addPass(InvalidateAnalysisPass< \
2601 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2602 return Error::success(); \
2604#include "llvm/Passes/MachinePassRegistry.def"
2606 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2607 if (
C(Name, MFPM,
E.InnerPipeline))
2610 formatv(
"unknown machine pass '{}'", Name).str(),
2615#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2616 if (Name == NAME) { \
2617 AA.registerModuleAnalysis< \
2618 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2621#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2622 if (Name == NAME) { \
2623 AA.registerFunctionAnalysis< \
2624 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2627#include "PassRegistry.def"
2629 for (
auto &
C : AAParsingCallbacks)
2635Error PassBuilder::parseMachinePassPipeline(
2637 for (
const auto &Element : Pipeline) {
2638 if (
auto Err = parseMachinePass(MFPM, Element))
2646 for (
const auto &Element : Pipeline) {
2647 if (
auto Err = parseLoopPass(LPM, Element))
2653Error PassBuilder::parseFunctionPassPipeline(
2655 for (
const auto &Element : Pipeline) {
2656 if (
auto Err = parseFunctionPass(FPM, Element))
2664 for (
const auto &Element : Pipeline) {
2665 if (
auto Err = parseCGSCCPass(CGPM, Element))
2697 for (
const auto &Element : Pipeline) {
2698 if (
auto Err = parseModulePass(MPM, Element))
2709 auto Pipeline = parsePipelineText(PipelineText);
2710 if (!Pipeline || Pipeline->empty())
2712 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2722 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2724 FunctionPipelineParsingCallbacks)) {
2725 Pipeline = {{
"function", std::move(*Pipeline)}};
2728 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2729 std::move(*Pipeline)}}}};
2730 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2732 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2733 std::move(*Pipeline)}}}};
2735 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2736 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2738 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2739 if (
C(MPM, *Pipeline))
2743 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2745 formatv(
"unknown {} name '{}'",
2746 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2752 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2760 auto Pipeline = parsePipelineText(PipelineText);
2761 if (!Pipeline || Pipeline->empty())
2763 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2769 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2774 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2783 auto Pipeline = parsePipelineText(PipelineText);
2784 if (!Pipeline || Pipeline->empty())
2786 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2792 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2797 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2805 auto Pipeline = parsePipelineText(PipelineText);
2806 if (!Pipeline || Pipeline->empty())
2808 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2811 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2819 auto Pipeline = parsePipelineText(PipelineText);
2820 if (!Pipeline || Pipeline->empty())
2822 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2825 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2834 if (PipelineText ==
"default") {
2839 while (!PipelineText.
empty()) {
2841 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2842 if (!parseAAPassName(
AA, Name))
2844 formatv(
"unknown alias analysis name '{}'", Name).str(),
2851std::optional<RegAllocFilterFunc>
2853 if (FilterName ==
"all")
2855 for (
auto &
C : RegClassFilterParsingCallbacks)
2856 if (
auto F =
C(FilterName))
2858 return std::nullopt;
2869 auto I = PassNames.
begin();
2870 auto End = PassNames.
end();
2878 OS <<
" " << Name <<
'<' << Params <<
">\n";
2885 OS <<
"Module passes:\n";
2886 static constexpr char ModulePassNames[] = {
"\0"
2887#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2888#include "PassRegistry.def"
2892 OS <<
"Module passes with params:\n";
2893 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2894#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2895 NAME "\0" PARAMS "\0"
2896#include "PassRegistry.def"
2900 OS <<
"Module analyses:\n";
2901 static constexpr char ModuleAnalysisNames[] = {
"\0"
2902#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2903#include "PassRegistry.def"
2907 OS <<
"Module alias analyses:\n";
2908 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2909#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2910#include "PassRegistry.def"
2914 OS <<
"CGSCC passes:\n";
2915 static constexpr char CGSCCPassNames[] = {
"\0"
2916#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2917#include "PassRegistry.def"
2921 OS <<
"CGSCC passes with params:\n";
2922 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2923#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2924 NAME "\0" PARAMS "\0"
2925#include "PassRegistry.def"
2929 OS <<
"CGSCC analyses:\n";
2930 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2931#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2932#include "PassRegistry.def"
2936 OS <<
"Function passes:\n";
2937 static constexpr char FunctionPassNames[] = {
"\0"
2938#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2939#include "PassRegistry.def"
2943 OS <<
"Function passes with params:\n";
2944 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2945#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2946 NAME "\0" PARAMS "\0"
2947#include "PassRegistry.def"
2951 OS <<
"Function analyses:\n";
2952 static constexpr char FunctionAnalysisNames[] = {
"\0"
2953#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2954#include "PassRegistry.def"
2958 OS <<
"Function alias analyses:\n";
2959 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2960#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2961#include "PassRegistry.def"
2965 OS <<
"LoopNest passes:\n";
2966 static constexpr char LoopNestPassNames[] = {
"\0"
2967#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2968#include "PassRegistry.def"
2972 OS <<
"Loop passes:\n";
2973 static constexpr char LoopPassNames[] = {
"\0"
2974#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2975#include "PassRegistry.def"
2979 OS <<
"Loop passes with params:\n";
2980 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2981#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2982 NAME "\0" PARAMS "\0"
2983#include "PassRegistry.def"
2987 OS <<
"Loop analyses:\n";
2988 static constexpr char LoopAnalysisNames[] = {
"\0"
2989#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2990#include "PassRegistry.def"
2994 OS <<
"Machine module passes (WIP):\n";
2995 static constexpr char MachineModulePassNames[] = {
"\0"
2996#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2997#include "llvm/Passes/MachinePassRegistry.def"
3001 OS <<
"Machine function passes (WIP):\n";
3002 static constexpr char MachineFunctionPassNames[] = {
"\0"
3003#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3004#include "llvm/Passes/MachinePassRegistry.def"
3008 OS <<
"Machine function analyses (WIP):\n";
3009 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3010#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3011#include "llvm/Passes/MachinePassRegistry.def"
3019 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< 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 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 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 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(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 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 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".
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.
static LLVM_ABI const OptimizationLevel O3
Optimize for fast execution as much as possible.
static LLVM_ABI const OptimizationLevel O0
Disable as many optimizations as possible.
static LLVM_ABI const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
static LLVM_ABI const OptimizationLevel O1
Optimize quickly without destroying debuggability.
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 PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
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 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.
@ C
The default llvm calling convention, compatible with C.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
@ BasicBlock
Various leaf nodes.
DXILDebugInfoMap run(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.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI cl::opt< std::optional< PrintPipelinePassesFormat >, false, PrintPipelinePassesFormatParser > PrintPipelinePasses
Common option used by multiple tools to print pipeline passes.
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.
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.
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...
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 & 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