418 "Print string describing the pipeline (best-effort only).\n"
419 " - =text\tPrint a '-passes' compatible string describing the "
421 " - =tree\tPrint a tree-like structure describing the pipeline."));
425 std::optional<PrintPipelinePassesFormat> &Val) {
426 std::optional<PrintPipelinePassesFormat>
Format =
435 "'{0}' value invalid for print-pipeline-passes argument!", Arg));
449 for (
char C : Pipeline) {
457 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
487 return MFA ? &MFA->
getMF() :
nullptr;
493class TriggerVerifierErrorPass
499 auto *PtrTy = PointerType::getUnqual(
M.getContext());
501 GlobalValue::LinkageTypes::InternalLinkage,
502 "__bad_alias",
nullptr, &M);
522 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
527class RequireAllMachineFunctionPropertiesPass
535 static MachineFunctionProperties getRequiredProperties() {
536 return MachineFunctionProperties()
538 .setFailsVerification()
543 .setRegBankSelected()
545 .setTiedOpsRewritten()
546 .setTracksDebugUserValues()
547 .setTracksLiveness();
549 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
555 if (S ==
"Os" || S ==
"Oz")
557 Twine(
"The optimization level \"") + S +
558 "\" is no longer supported. Use O2 in conjunction with the " +
559 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
570 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
574 formatv(
"invalid optimization level '{}'", S).str(),
579 std::optional<PGOOptions> PGOOpt,
582 : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
584 TM->registerPassBuilderCallbacks(*
this);
586 PIC->registerClassToPassNameCallback([
this, PIC]() {
590#define MODULE_PASS(NAME, CREATE_PASS) \
591 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
592#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
593 PIC->addClassToPassName(CLASS, NAME);
594#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
595 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
596#define FUNCTION_PASS(NAME, CREATE_PASS) \
597 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
598#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
599 PIC->addClassToPassName(CLASS, NAME);
600#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
601 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
602#define LOOPNEST_PASS(NAME, CREATE_PASS) \
603 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
604#define LOOP_PASS(NAME, CREATE_PASS) \
605 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
606#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
607 PIC->addClassToPassName(CLASS, NAME);
608#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
609 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
610#define CGSCC_PASS(NAME, CREATE_PASS) \
611 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
612#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
613 PIC->addClassToPassName(CLASS, NAME);
614#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
615 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
616#include "PassRegistry.def"
618#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
619 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
620#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
621 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
622#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
624 PIC->addClassToPassName(CLASS, NAME);
625#include "llvm/Passes/MachinePassRegistry.def"
633#define MODULE_CALLBACK(NAME, INVOKE) \
634 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
635 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
637 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
640 INVOKE(PM, L.get()); \
643#include "PassRegistry.def"
651#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
652 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
653 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
655 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
658 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
661#include "PassRegistry.def"
669#define FUNCTION_CALLBACK(NAME, INVOKE) \
670 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
671 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
673 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
676 INVOKE(PM, L.get()); \
679#include "PassRegistry.def"
687#define CGSCC_CALLBACK(NAME, INVOKE) \
688 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
689 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
691 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
694 INVOKE(PM, L.get()); \
697#include "PassRegistry.def"
705#define LOOP_CALLBACK(NAME, INVOKE) \
706 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
707 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
709 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
712 INVOKE(PM, L.get()); \
715#include "PassRegistry.def"
721#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
722 MAM.registerPass([&] { return CREATE_PASS; });
723#include "PassRegistry.def"
725 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
730#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
731 CGAM.registerPass([&] { return CREATE_PASS; });
732#include "PassRegistry.def"
734 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
744#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
745 if constexpr (std::is_constructible_v< \
746 std::remove_reference_t<decltype(CREATE_PASS)>, \
747 const TargetMachine &>) { \
749 FAM.registerPass([&] { return CREATE_PASS; }); \
751 FAM.registerPass([&] { return CREATE_PASS; }); \
753#include "PassRegistry.def"
755 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
762#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
763 MFAM.registerPass([&] { return CREATE_PASS; });
764#include "llvm/Passes/MachinePassRegistry.def"
766 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
771#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
772 LAM.registerPass([&] { return CREATE_PASS; });
773#include "PassRegistry.def"
775 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
779static std::optional<std::pair<bool, bool>>
781 std::pair<bool, bool> Params;
782 if (!Name.consume_front(
"function"))
786 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
788 while (!Name.empty()) {
789 auto [Front, Back] = Name.split(
';');
791 if (Front ==
"eager-inv")
793 else if (Front ==
"no-rerun")
794 Params.second =
true;
802 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
814 while (!Params.
empty()) {
816 std::tie(ParamName, Params) = Params.
split(
';');
818 if (ParamName == OptionName) {
835 while (!Params.
empty()) {
837 std::tie(ParamName, Params) = Params.
split(
';');
842 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
847 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
851 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
856 if (ParamName ==
"force-hardware-loops") {
858 }
else if (ParamName ==
"force-hardware-loop-phi") {
860 }
else if (ParamName ==
"force-nested-hardware-loop") {
862 }
else if (ParamName ==
"force-hardware-loop-guard") {
866 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
870 return HardwareLoopOpts;
882 "FunctionPropertiesStatisticsPass");
893 while (!Params.
empty()) {
895 std::tie(ParamName, Params) = Params.
split(
';');
896 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
898 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
905 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
912 if (ParamName ==
"partial") {
914 }
else if (ParamName ==
"peeling") {
916 }
else if (ParamName ==
"profile-peeling") {
918 }
else if (ParamName ==
"runtime") {
920 }
else if (ParamName ==
"upperbound") {
922 }
else if (ParamName ==
"prepare-for-lto") {
926 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
935 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
955 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
964 "EntryExitInstrumenter");
969 "DropUnnecessaryAssumes");
978 "LowerMatrixIntrinsics");
983 while (!Params.
empty()) {
985 std::tie(ParamName, Params) = Params.
split(
';');
988 if (ParamName ==
"preserve-order")
990 else if (ParamName ==
"rename-all")
992 else if (ParamName ==
"fold-all")
994 else if (ParamName ==
"reorder-operands")
998 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1008 while (!Params.
empty()) {
1010 std::tie(ParamName, Params) = Params.
split(
';');
1012 if (ParamName ==
"kernel") {
1013 Result.CompileKernel =
true;
1014 }
else if (ParamName ==
"use-after-scope") {
1015 Result.UseAfterScope =
true;
1018 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1028 while (!Params.
empty()) {
1030 std::tie(ParamName, Params) = Params.
split(
';');
1032 if (ParamName ==
"recover") {
1034 }
else if (ParamName ==
"kernel") {
1035 Result.CompileKernel =
true;
1038 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1047parseDropTypeTestsPassOptions(
StringRef Params) {
1049 while (!Params.
empty()) {
1051 std::tie(ParamName, Params) = Params.
split(
';');
1053 if (ParamName ==
"all") {
1055 }
else if (ParamName ==
"assume") {
1059 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1068 while (!Params.
empty()) {
1070 std::tie(ParamName, Params) = Params.
split(
';');
1072 if (ParamName ==
"thinlto") {
1074 }
else if (ParamName ==
"emit-summary") {
1075 Result.EmitLTOSummary =
true;
1078 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1086parseLowerAllowCheckPassOptions(
StringRef Params) {
1088 while (!Params.
empty()) {
1090 std::tie(ParamName, Params) = Params.
split(
';');
1101 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1108 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1113 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1115 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1116 IndicesStr, CutoffStr)
1120 while (IndicesStr !=
"") {
1122 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1128 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1129 firstIndexStr, IndicesStr)
1136 if (index >=
Result.cutoffs.size())
1137 Result.cutoffs.resize(index + 1, 0);
1139 Result.cutoffs[index] = cutoff;
1141 }
else if (ParamName.
starts_with(
"runtime_check")) {
1143 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1147 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1149 ValueString, Params)
1153 Result.runtime_check = runtime_check;
1156 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1167 while (!Params.
empty()) {
1169 std::tie(ParamName, Params) = Params.
split(
';');
1171 if (ParamName ==
"recover") {
1173 }
else if (ParamName ==
"kernel") {
1178 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1183 }
else if (ParamName ==
"eager-checks") {
1184 Result.EagerChecks =
true;
1187 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1197 while (!Params.
empty()) {
1199 std::tie(ParamName, Params) = Params.
split(
';');
1206 formatv(
"invalid argument to AllocToken pass mode "
1213 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1223 while (!Params.
empty()) {
1225 std::tie(ParamName, Params) = Params.
split(
';');
1228 if (ParamName ==
"speculate-blocks") {
1230 }
else if (ParamName ==
"simplify-cond-branch") {
1232 }
else if (ParamName ==
"forward-switch-cond") {
1234 }
else if (ParamName ==
"switch-range-to-icmp") {
1236 }
else if (ParamName ==
"switch-to-arithmetic") {
1238 }
else if (ParamName ==
"switch-to-lookup") {
1240 }
else if (ParamName ==
"keep-loops") {
1242 }
else if (ParamName ==
"hoist-common-insts") {
1244 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1246 }
else if (ParamName ==
"sink-common-insts") {
1248 }
else if (ParamName ==
"speculate-unpredictables") {
1251 APInt BonusInstThreshold;
1254 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1262 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1273 Result.setVerifyFixpoint(
true);
1274 while (!Params.
empty()) {
1276 std::tie(ParamName, Params) = Params.
split(
';');
1279 if (ParamName ==
"verify-fixpoint") {
1282 APInt MaxIterations;
1285 formatv(
"invalid argument to InstCombine pass max-iterations "
1293 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1303 while (!Params.
empty()) {
1305 std::tie(ParamName, Params) = Params.
split(
';');
1308 if (ParamName ==
"interleave-forced-only") {
1310 }
else if (ParamName ==
"vectorize-forced-only") {
1314 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1322 std::pair<bool, bool>
Result = {
false,
true};
1323 while (!Params.
empty()) {
1325 std::tie(ParamName, Params) = Params.
split(
';');
1328 if (ParamName ==
"nontrivial") {
1330 }
else if (ParamName ==
"trivial") {
1334 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1343 while (!Params.
empty()) {
1345 std::tie(ParamName, Params) = Params.
split(
';');
1348 if (ParamName ==
"allowspeculation") {
1352 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1359struct LoopRotateOptions {
1360 bool EnableHeaderDuplication =
true;
1361 bool PrepareForLTO =
false;
1362 bool CheckExitCount =
false;
1366 LoopRotateOptions
Result;
1367 while (!Params.
empty()) {
1369 std::tie(ParamName, Params) = Params.
split(
';');
1372 if (ParamName ==
"header-duplication") {
1374 }
else if (ParamName ==
"prepare-for-lto") {
1376 }
else if (ParamName ==
"check-exit-count") {
1380 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1389 while (!Params.
empty()) {
1391 std::tie(ParamName, Params) = Params.
split(
';');
1394 if (ParamName ==
"split-footer-bb") {
1398 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1409 while (!Params.
empty()) {
1411 std::tie(ParamName, Params) = Params.
split(
';');
1414 if (ParamName ==
"scalar-pre") {
1416 }
else if (ParamName ==
"load-pre") {
1418 }
else if (ParamName ==
"split-backedge-load-pre") {
1420 }
else if (ParamName ==
"memdep") {
1424 }
else if (ParamName ==
"memoryssa") {
1430 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1439 while (!Params.
empty()) {
1441 std::tie(ParamName, Params) = Params.
split(
';');
1444 if (ParamName ==
"func-spec")
1448 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1456 while (!Params.
empty()) {
1458 std::tie(ParamName, Params) = Params.
split(
';');
1463 formatv(
"invalid argument to Scalarizer pass min-bits "
1474 if (ParamName ==
"load-store")
1476 else if (ParamName ==
"variable-insert-extract")
1480 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1490 bool SawCFGOption =
false;
1491 while (!Params.
empty()) {
1493 std::tie(ParamName, Params) = Params.
split(
';');
1495 if (ParamName ==
"modify-cfg") {
1500 SawCFGOption =
true;
1501 }
else if (ParamName ==
"preserve-cfg") {
1506 SawCFGOption =
true;
1507 }
else if (ParamName ==
"aggregate-to-vector") {
1508 Result.AggregateToVector =
true;
1511 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1512 "modify-cfg, or aggregate-to-vector)",
1522parseStackLifetimeOptions(
StringRef Params) {
1524 while (!Params.
empty()) {
1526 std::tie(ParamName, Params) = Params.
split(
';');
1528 if (ParamName ==
"may") {
1530 }
else if (ParamName ==
"must") {
1534 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1543 "DependenceAnalysisPrinter");
1548 "SeparateConstOffsetFromGEP");
1557parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1561 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1569 "MemorySSAPrinterPass");
1574 "SpeculativeExecutionPass");
1579 while (!Params.
empty()) {
1581 std::tie(ParamName, Params) = Params.
split(
';');
1587 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1595parseStructuralHashPrinterPassOptions(
StringRef Params) {
1598 if (Params ==
"detailed")
1600 if (Params ==
"call-target-ignored")
1603 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1609 "WinEHPreparePass");
1614 while (!Params.
empty()) {
1616 std::tie(ParamName, Params) = Params.
split(
';');
1619 if (ParamName ==
"group-by-use")
1621 else if (ParamName ==
"ignore-single-use")
1623 else if (ParamName ==
"merge-const")
1625 else if (ParamName ==
"merge-const-aggressive")
1627 else if (ParamName ==
"merge-external")
1632 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1636 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1645 while (!Params.
empty()) {
1647 std::tie(ParamName, Params) = Params.
split(
';');
1653 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1664 while (!Params.
empty()) {
1666 std::tie(ParamName, Params) = Params.
split(
';');
1669 std::optional<RegAllocFilterFunc>
Filter =
1673 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1682 if (ParamName ==
"no-clear-vregs") {
1688 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1695parseBoundsCheckingOptions(
StringRef Params) {
1697 while (!Params.
empty()) {
1699 std::tie(ParamName, Params) = Params.
split(
';');
1700 if (ParamName ==
"trap") {
1702 }
else if (ParamName ==
"rt") {
1708 }
else if (ParamName ==
"rt-abort") {
1714 }
else if (ParamName ==
"min-rt") {
1720 }
else if (ParamName ==
"min-rt-abort") {
1726 }
else if (ParamName ==
"merge") {
1728 }
else if (ParamName ==
"handler-preserve-all-regs") {
1730 Options.Rt->HandlerPreserveAllRegs =
true;
1734 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1740 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1757 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1759 Param.str().c_str());
1762 if (!
Level.has_value())
1764 "invalid optimization level for expand-ir-insts pass: %s",
1765 Digit.str().c_str());
1772 if (Params.
empty() || Params ==
"all")
1773 return RAGreedyPass::Options();
1777 return RAGreedyPass::Options{*
Filter, Params};
1780 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1786 "MachineSinkingPass");
1790 bool AllowTailMerge =
true;
1791 if (!Params.
empty()) {
1793 if (Params !=
"tail-merge")
1795 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1799 return AllowTailMerge;
1803 bool ClearVirtRegs =
true;
1804 if (!Params.
empty()) {
1806 if (Params !=
"clear-vregs")
1808 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1811 return ClearVirtRegs;
1814struct FatLTOOptions {
1816 bool ThinLTO =
false;
1817 bool EmitSummary =
false;
1822 bool HaveOptLevel =
false;
1823 while (!Params.
empty()) {
1825 std::tie(ParamName, Params) = Params.
split(
';');
1827 if (ParamName ==
"thinlto") {
1829 }
else if (ParamName ==
"emit-summary") {
1830 Result.EmitSummary =
true;
1831 }
else if (std::optional<OptimizationLevel> OptLevel =
1833 Result.OptLevel = *OptLevel;
1834 HaveOptLevel =
true;
1837 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1844 "missing optimization level for fatlto-pre-link pipeline",
1859template <
typename PassManagerT,
typename CallbacksT>
1861 if (!Callbacks.empty()) {
1862 PassManagerT DummyPM;
1863 for (
auto &CB : Callbacks)
1864 if (CB(Name, DummyPM, {}))
1870template <
typename CallbacksT>
1872 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1875 if (Name ==
"module")
1877 if (Name ==
"cgscc")
1879 if (NameNoBracket ==
"function")
1881 if (Name ==
"coro-cond")
1884#define MODULE_PASS(NAME, CREATE_PASS) \
1887#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1888 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1890#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1891 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1893#include "PassRegistry.def"
1898template <
typename CallbacksT>
1901 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1902 if (Name ==
"cgscc")
1904 if (NameNoBracket ==
"function")
1911#define CGSCC_PASS(NAME, CREATE_PASS) \
1914#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1915 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1917#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1918 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1920#include "PassRegistry.def"
1925template <
typename CallbacksT>
1928 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1929 if (NameNoBracket ==
"function")
1931 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1934#define FUNCTION_PASS(NAME, CREATE_PASS) \
1937#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1938 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1940#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1941 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1943#include "PassRegistry.def"
1948template <
typename CallbacksT>
1951 if (Name ==
"machine-function")
1954#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1957#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1959 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1962#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1963 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1966#include "llvm/Passes/MachinePassRegistry.def"
1971template <
typename CallbacksT>
1973 bool &UseMemorySSA) {
1974 UseMemorySSA =
false;
1977 UseMemorySSA =
true;
1981#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1984#include "PassRegistry.def"
1989template <
typename CallbacksT>
1991 bool &UseMemorySSA) {
1992 UseMemorySSA =
false;
1995 UseMemorySSA =
true;
1999#define LOOP_PASS(NAME, CREATE_PASS) \
2002#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2003 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2005#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2006 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2008#include "PassRegistry.def"
2013std::optional<std::vector<PassBuilder::PipelineElement>>
2015 std::vector<PipelineElement> ResultPipeline;
2020 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2021 size_t Pos =
Text.find_first_of(
",()");
2022 Pipeline.push_back({
Text.substr(0, Pos), {}});
2025 if (Pos ==
Text.npos)
2028 char Sep =
Text[Pos];
2036 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2040 assert(Sep ==
')' &&
"Bogus separator!");
2045 if (PipelineStack.
size() == 1)
2046 return std::nullopt;
2049 }
while (
Text.consume_front(
")"));
2057 if (!
Text.consume_front(
","))
2058 return std::nullopt;
2061 if (PipelineStack.
size() > 1)
2063 return std::nullopt;
2065 assert(PipelineStack.
back() == &ResultPipeline &&
2066 "Wrong pipeline at the bottom of the stack!");
2067 return {std::move(ResultPipeline)};
2077 const PipelineElement &
E) {
2078 auto &
Name =
E.Name;
2079 auto &InnerPipeline =
E.InnerPipeline;
2082 if (!InnerPipeline.empty()) {
2083 if (Name ==
"module") {
2085 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2087 MPM.
addPass(std::move(NestedMPM));
2090 if (Name ==
"coro-cond") {
2092 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2094 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2097 if (Name ==
"cgscc") {
2099 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2107 "cannot have a no-rerun module to function adaptor",
2110 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2117 for (
auto &
C : ModulePipelineParsingCallbacks)
2118 if (
C(Name, MPM, InnerPipeline))
2123 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2129#define MODULE_PASS(NAME, CREATE_PASS) \
2130 if (Name == NAME) { \
2131 MPM.addPass(CREATE_PASS); \
2132 return Error::success(); \
2134#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2135 if (checkParametrizedPassName(Name, NAME)) { \
2136 auto Params = parsePassParameters(PARSER, Name, NAME); \
2138 return Params.takeError(); \
2139 MPM.addPass(CREATE_PASS(Params.get())); \
2140 return Error::success(); \
2142#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2143 if (Name == "require<" NAME ">") { \
2145 RequireAnalysisPass< \
2146 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2147 return Error::success(); \
2149 if (Name == "invalidate<" NAME ">") { \
2150 MPM.addPass(InvalidateAnalysisPass< \
2151 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2152 return Error::success(); \
2154#define CGSCC_PASS(NAME, CREATE_PASS) \
2155 if (Name == NAME) { \
2156 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2157 return Error::success(); \
2159#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2160 if (checkParametrizedPassName(Name, NAME)) { \
2161 auto Params = parsePassParameters(PARSER, Name, NAME); \
2163 return Params.takeError(); \
2165 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2166 return Error::success(); \
2168#define FUNCTION_PASS(NAME, CREATE_PASS) \
2169 if (Name == NAME) { \
2170 if constexpr (std::is_constructible_v< \
2171 std::remove_reference_t<decltype(CREATE_PASS)>, \
2172 const TargetMachine &>) { \
2174 return make_error<StringError>( \
2175 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2176 inconvertibleErrorCode()); \
2178 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2179 return Error::success(); \
2181#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2182 if (checkParametrizedPassName(Name, NAME)) { \
2183 auto Params = parsePassParameters(PARSER, Name, NAME); \
2185 return Params.takeError(); \
2186 auto CreatePass = CREATE_PASS; \
2187 if constexpr (std::is_constructible_v< \
2188 std::remove_reference_t<decltype(CreatePass( \
2190 const TargetMachine &, \
2191 std::remove_reference_t<decltype(Params.get())>>) { \
2193 return make_error<StringError>( \
2194 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2195 inconvertibleErrorCode()); \
2198 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2199 return Error::success(); \
2201#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2202 if (Name == NAME) { \
2203 MPM.addPass(createModuleToFunctionPassAdaptor( \
2204 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2205 return Error::success(); \
2207#define LOOP_PASS(NAME, CREATE_PASS) \
2208 if (Name == NAME) { \
2209 MPM.addPass(createModuleToFunctionPassAdaptor( \
2210 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2211 return Error::success(); \
2213#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2214 if (checkParametrizedPassName(Name, NAME)) { \
2215 auto Params = parsePassParameters(PARSER, Name, NAME); \
2217 return Params.takeError(); \
2218 MPM.addPass(createModuleToFunctionPassAdaptor( \
2219 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2220 return Error::success(); \
2222#include "PassRegistry.def"
2224 for (
auto &
C : ModulePipelineParsingCallbacks)
2225 if (
C(Name, MPM, InnerPipeline))
2228 formatv(
"unknown module pass '{}'", Name).str(),
2233 const PipelineElement &
E) {
2234 auto &
Name =
E.Name;
2235 auto &InnerPipeline =
E.InnerPipeline;
2238 if (!InnerPipeline.empty()) {
2239 if (Name ==
"cgscc") {
2241 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2244 CGPM.
addPass(std::move(NestedCGPM));
2249 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2253 std::move(FPM), Params->first, Params->second));
2258 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2265 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2266 if (
C(Name, CGPM, InnerPipeline))
2271 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2276#define CGSCC_PASS(NAME, CREATE_PASS) \
2277 if (Name == NAME) { \
2278 CGPM.addPass(CREATE_PASS); \
2279 return Error::success(); \
2281#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2282 if (checkParametrizedPassName(Name, NAME)) { \
2283 auto Params = parsePassParameters(PARSER, Name, NAME); \
2285 return Params.takeError(); \
2286 CGPM.addPass(CREATE_PASS(Params.get())); \
2287 return Error::success(); \
2289#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2290 if (Name == "require<" NAME ">") { \
2291 CGPM.addPass(RequireAnalysisPass< \
2292 std::remove_reference_t<decltype(CREATE_PASS)>, \
2293 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2294 CGSCCUpdateResult &>()); \
2295 return Error::success(); \
2297 if (Name == "invalidate<" NAME ">") { \
2298 CGPM.addPass(InvalidateAnalysisPass< \
2299 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2300 return Error::success(); \
2302#define FUNCTION_PASS(NAME, CREATE_PASS) \
2303 if (Name == NAME) { \
2304 if constexpr (std::is_constructible_v< \
2305 std::remove_reference_t<decltype(CREATE_PASS)>, \
2306 const TargetMachine &>) { \
2308 return make_error<StringError>( \
2309 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2310 inconvertibleErrorCode()); \
2312 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2313 return Error::success(); \
2315#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2316 if (checkParametrizedPassName(Name, NAME)) { \
2317 auto Params = parsePassParameters(PARSER, Name, NAME); \
2319 return Params.takeError(); \
2320 auto CreatePass = CREATE_PASS; \
2321 if constexpr (std::is_constructible_v< \
2322 std::remove_reference_t<decltype(CreatePass( \
2324 const TargetMachine &, \
2325 std::remove_reference_t<decltype(Params.get())>>) { \
2327 return make_error<StringError>( \
2328 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2329 inconvertibleErrorCode()); \
2332 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2333 return Error::success(); \
2335#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2336 if (Name == NAME) { \
2337 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2338 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2339 return Error::success(); \
2341#define LOOP_PASS(NAME, CREATE_PASS) \
2342 if (Name == NAME) { \
2343 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2344 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2345 return Error::success(); \
2347#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2348 if (checkParametrizedPassName(Name, NAME)) { \
2349 auto Params = parsePassParameters(PARSER, Name, NAME); \
2351 return Params.takeError(); \
2352 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2353 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2354 return Error::success(); \
2356#include "PassRegistry.def"
2358 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2359 if (
C(Name, CGPM, InnerPipeline))
2366 const PipelineElement &
E) {
2367 auto &
Name =
E.Name;
2368 auto &InnerPipeline =
E.InnerPipeline;
2371 if (!InnerPipeline.empty()) {
2372 if (Name ==
"function") {
2374 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2377 FPM.
addPass(std::move(NestedFPM));
2380 if (Name ==
"loop" || Name ==
"loop-mssa") {
2382 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2385 bool UseMemorySSA = (
Name ==
"loop-mssa");
2390 if (Name ==
"machine-function") {
2392 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2398 for (
auto &
C : FunctionPipelineParsingCallbacks)
2399 if (
C(Name, FPM, InnerPipeline))
2404 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2409#define FUNCTION_PASS(NAME, CREATE_PASS) \
2410 if (Name == NAME) { \
2411 if constexpr (std::is_constructible_v< \
2412 std::remove_reference_t<decltype(CREATE_PASS)>, \
2413 const TargetMachine &>) { \
2415 return make_error<StringError>( \
2416 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2417 inconvertibleErrorCode()); \
2419 FPM.addPass(CREATE_PASS); \
2420 return Error::success(); \
2422#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2423 if (checkParametrizedPassName(Name, NAME)) { \
2424 auto Params = parsePassParameters(PARSER, Name, NAME); \
2426 return Params.takeError(); \
2427 auto CreatePass = CREATE_PASS; \
2428 if constexpr (std::is_constructible_v< \
2429 std::remove_reference_t<decltype(CreatePass( \
2431 const TargetMachine &, \
2432 std::remove_reference_t<decltype(Params.get())>>) { \
2434 return make_error<StringError>( \
2435 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2436 inconvertibleErrorCode()); \
2439 FPM.addPass(CREATE_PASS(Params.get())); \
2440 return Error::success(); \
2442#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2443 if (Name == "require<" NAME ">") { \
2444 if constexpr (std::is_constructible_v< \
2445 std::remove_reference_t<decltype(CREATE_PASS)>, \
2446 const TargetMachine &>) { \
2448 return make_error<StringError>( \
2449 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2450 inconvertibleErrorCode()); \
2453 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2455 return Error::success(); \
2457 if (Name == "invalidate<" NAME ">") { \
2458 FPM.addPass(InvalidateAnalysisPass< \
2459 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2460 return Error::success(); \
2466#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2467 if (Name == NAME) { \
2468 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2469 return Error::success(); \
2471#define LOOP_PASS(NAME, CREATE_PASS) \
2472 if (Name == NAME) { \
2473 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2474 return Error::success(); \
2476#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2477 if (checkParametrizedPassName(Name, NAME)) { \
2478 auto Params = parsePassParameters(PARSER, Name, NAME); \
2480 return Params.takeError(); \
2482 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2483 return Error::success(); \
2485#include "PassRegistry.def"
2487 for (
auto &
C : FunctionPipelineParsingCallbacks)
2488 if (
C(Name, FPM, InnerPipeline))
2491 formatv(
"unknown function pass '{}'", Name).str(),
2496 const PipelineElement &
E) {
2497 StringRef
Name =
E.Name;
2498 auto &InnerPipeline =
E.InnerPipeline;
2501 if (!InnerPipeline.empty()) {
2502 if (Name ==
"loop") {
2504 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2507 LPM.addPass(std::move(NestedLPM));
2511 for (
auto &
C : LoopPipelineParsingCallbacks)
2512 if (
C(Name, LPM, InnerPipeline))
2517 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2522#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2523 if (Name == NAME) { \
2524 LPM.addPass(CREATE_PASS); \
2525 return Error::success(); \
2527#define LOOP_PASS(NAME, CREATE_PASS) \
2528 if (Name == NAME) { \
2529 LPM.addPass(CREATE_PASS); \
2530 return Error::success(); \
2532#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2533 if (checkParametrizedPassName(Name, NAME)) { \
2534 auto Params = parsePassParameters(PARSER, Name, NAME); \
2536 return Params.takeError(); \
2537 LPM.addPass(CREATE_PASS(Params.get())); \
2538 return Error::success(); \
2540#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2541 if (Name == "require<" NAME ">") { \
2542 LPM.addPass(RequireAnalysisPass< \
2543 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2544 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2546 return Error::success(); \
2548 if (Name == "invalidate<" NAME ">") { \
2549 LPM.addPass(InvalidateAnalysisPass< \
2550 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2551 return Error::success(); \
2553#include "PassRegistry.def"
2555 for (
auto &
C : LoopPipelineParsingCallbacks)
2556 if (
C(Name, LPM, InnerPipeline))
2563 const PipelineElement &
E) {
2564 StringRef
Name =
E.Name;
2566 if (!
E.InnerPipeline.empty()) {
2567 if (
E.Name ==
"machine-function") {
2569 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2571 MFPM.
addPass(std::move(NestedPM));
2578#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2579 if (Name == NAME) { \
2580 MFPM.addPass(CREATE_PASS); \
2581 return Error::success(); \
2583#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2584 if (Name == NAME) { \
2585 MFPM.addPass(CREATE_PASS); \
2586 return Error::success(); \
2588#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2590 if (checkParametrizedPassName(Name, NAME)) { \
2591 auto Params = parsePassParameters(PARSER, Name, NAME); \
2593 return Params.takeError(); \
2594 MFPM.addPass(CREATE_PASS(Params.get())); \
2595 return Error::success(); \
2597#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2598 if (Name == "require<" NAME ">") { \
2600 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2601 MachineFunction>()); \
2602 return Error::success(); \
2604 if (Name == "invalidate<" NAME ">") { \
2605 MFPM.addPass(InvalidateAnalysisPass< \
2606 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2607 return Error::success(); \
2609#include "llvm/Passes/MachinePassRegistry.def"
2611 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2612 if (
C(Name, MFPM,
E.InnerPipeline))
2615 formatv(
"unknown machine pass '{}'", Name).str(),
2620#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2621 if (Name == NAME) { \
2622 AA.registerModuleAnalysis< \
2623 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2626#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2627 if (Name == NAME) { \
2628 AA.registerFunctionAnalysis< \
2629 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2632#include "PassRegistry.def"
2634 for (
auto &
C : AAParsingCallbacks)
2640Error PassBuilder::parseMachinePassPipeline(
2642 for (
const auto &Element : Pipeline) {
2643 if (
auto Err = parseMachinePass(MFPM, Element))
2651 for (
const auto &Element : Pipeline) {
2652 if (
auto Err = parseLoopPass(LPM, Element))
2658Error PassBuilder::parseFunctionPassPipeline(
2660 for (
const auto &Element : Pipeline) {
2661 if (
auto Err = parseFunctionPass(FPM, Element))
2669 for (
const auto &Element : Pipeline) {
2670 if (
auto Err = parseCGSCCPass(CGPM, Element))
2702 for (
const auto &Element : Pipeline) {
2703 if (
auto Err = parseModulePass(MPM, Element))
2714 auto Pipeline = parsePipelineText(PipelineText);
2715 if (!Pipeline || Pipeline->empty())
2717 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2727 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2729 FunctionPipelineParsingCallbacks)) {
2730 Pipeline = {{
"function", std::move(*Pipeline)}};
2733 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2734 std::move(*Pipeline)}}}};
2735 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2737 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2738 std::move(*Pipeline)}}}};
2740 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2741 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2743 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2744 if (
C(MPM, *Pipeline))
2748 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2750 formatv(
"unknown {} name '{}'",
2751 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2757 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2765 auto Pipeline = parsePipelineText(PipelineText);
2766 if (!Pipeline || Pipeline->empty())
2768 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2774 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2779 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2788 auto Pipeline = parsePipelineText(PipelineText);
2789 if (!Pipeline || Pipeline->empty())
2791 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2797 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2802 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2810 auto Pipeline = parsePipelineText(PipelineText);
2811 if (!Pipeline || Pipeline->empty())
2813 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2816 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2824 auto Pipeline = parsePipelineText(PipelineText);
2825 if (!Pipeline || Pipeline->empty())
2827 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2830 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2839 if (PipelineText ==
"default") {
2844 while (!PipelineText.
empty()) {
2846 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2847 if (!parseAAPassName(
AA, Name))
2849 formatv(
"unknown alias analysis name '{}'", Name).str(),
2856std::optional<RegAllocFilterFunc>
2858 if (FilterName ==
"all")
2860 for (
auto &
C : RegClassFilterParsingCallbacks)
2861 if (
auto F =
C(FilterName))
2863 return std::nullopt;
2874 auto I = PassNames.
begin();
2875 auto End = PassNames.
end();
2882 OS <<
" " << Name <<
'<' << Params <<
">\n";
2889 OS <<
"Module passes:\n";
2890 static constexpr char ModulePassNames[] = {
"\0"
2891#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2892#include "PassRegistry.def"
2896 OS <<
"Module passes with params:\n";
2897 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2898#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2899 NAME "\0" PARAMS "\0"
2900#include "PassRegistry.def"
2904 OS <<
"Module analyses:\n";
2905 static constexpr char ModuleAnalysisNames[] = {
"\0"
2906#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2907#include "PassRegistry.def"
2911 OS <<
"Module alias analyses:\n";
2912 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2913#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2914#include "PassRegistry.def"
2918 OS <<
"CGSCC passes:\n";
2919 static constexpr char CGSCCPassNames[] = {
"\0"
2920#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2921#include "PassRegistry.def"
2925 OS <<
"CGSCC passes with params:\n";
2926 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2927#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2928 NAME "\0" PARAMS "\0"
2929#include "PassRegistry.def"
2933 OS <<
"CGSCC analyses:\n";
2934 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2935#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2936#include "PassRegistry.def"
2940 OS <<
"Function passes:\n";
2941 static constexpr char FunctionPassNames[] = {
"\0"
2942#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2943#include "PassRegistry.def"
2947 OS <<
"Function passes with params:\n";
2948 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2949#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2950 NAME "\0" PARAMS "\0"
2951#include "PassRegistry.def"
2955 OS <<
"Function analyses:\n";
2956 static constexpr char FunctionAnalysisNames[] = {
"\0"
2957#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2958#include "PassRegistry.def"
2962 OS <<
"Function alias analyses:\n";
2963 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2964#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2965#include "PassRegistry.def"
2969 OS <<
"LoopNest passes:\n";
2970 static constexpr char LoopNestPassNames[] = {
"\0"
2971#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2972#include "PassRegistry.def"
2976 OS <<
"Loop passes:\n";
2977 static constexpr char LoopPassNames[] = {
"\0"
2978#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2979#include "PassRegistry.def"
2983 OS <<
"Loop passes with params:\n";
2984 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2985#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2986 NAME "\0" PARAMS "\0"
2987#include "PassRegistry.def"
2991 OS <<
"Loop analyses:\n";
2992 static constexpr char LoopAnalysisNames[] = {
"\0"
2993#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2994#include "PassRegistry.def"
2998 OS <<
"Machine module passes (WIP):\n";
2999 static constexpr char MachineModulePassNames[] = {
"\0"
3000#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
3001#include "llvm/Passes/MachinePassRegistry.def"
3005 OS <<
"Machine function passes (WIP):\n";
3006 static constexpr char MachineFunctionPassNames[] = {
"\0"
3007#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3008#include "llvm/Passes/MachinePassRegistry.def"
3012 OS <<
"Machine function analyses (WIP):\n";
3013 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3014#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3015#include "llvm/Passes/MachinePassRegistry.def"
3023 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 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 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(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.
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.
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.
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.
@ 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.
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 & 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