430 "Print string describing the pipeline (best-effort only).\n"
431 " - =text\tPrint a '-passes' compatible string describing the "
433 " - =tree\tPrint a tree-like structure describing the pipeline."));
437 std::optional<PrintPipelinePassesFormat> &Val) {
438 std::optional<PrintPipelinePassesFormat>
Format =
447 "'{0}' value invalid for print-pipeline-passes argument!", Arg));
461 for (
char C : Pipeline) {
469 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
499 return MFA ? &MFA->
getMF() :
nullptr;
505class TriggerVerifierErrorPass
511 auto *PtrTy = PointerType::getUnqual(
M.getContext());
513 GlobalValue::LinkageTypes::InternalLinkage,
514 "__bad_alias",
nullptr, &M);
534 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
539class RequireAllMachineFunctionPropertiesPass
547 static MachineFunctionProperties getRequiredProperties() {
548 return MachineFunctionProperties()
550 .setFailsVerification()
555 .setRegBankSelected()
557 .setTiedOpsRewritten()
558 .setTracksDebugUserValues()
559 .setTracksLiveness();
561 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
567 if (S ==
"Os" || S ==
"Oz")
569 Twine(
"The optimization level \"") + S +
570 "\" is no longer supported. Use O2 in conjunction with the " +
571 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
582 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
586 formatv(
"invalid optimization level '{}'", S).str(),
591 std::optional<PGOOptions> PGOOpt,
594 : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
596 TM->registerPassBuilderCallbacks(*
this);
598 PIC->registerClassToPassNameCallback([
this, PIC]() {
602#define MODULE_PASS(NAME, CREATE_PASS) \
603 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
604#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
605 PIC->addClassToPassName(CLASS, NAME);
606#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
607 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
608#define FUNCTION_PASS(NAME, CREATE_PASS) \
609 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
610#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
611 PIC->addClassToPassName(CLASS, NAME);
612#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
613 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
614#define LOOPNEST_PASS(NAME, CREATE_PASS) \
615 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
616#define LOOP_PASS(NAME, CREATE_PASS) \
617 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
618#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
619 PIC->addClassToPassName(CLASS, NAME);
620#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
621 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
622#define CGSCC_PASS(NAME, CREATE_PASS) \
623 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
624#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
625 PIC->addClassToPassName(CLASS, NAME);
626#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
627 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
628#include "PassRegistry.def"
630#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
631 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
632#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
633 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
634#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
636 PIC->addClassToPassName(CLASS, NAME);
637#include "llvm/Passes/MachinePassRegistry.def"
645#define MODULE_CALLBACK(NAME, INVOKE) \
646 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
647 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
649 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
652 INVOKE(PM, L.get()); \
655#include "PassRegistry.def"
663#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
664 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
665 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
667 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
670 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
673#include "PassRegistry.def"
681#define FUNCTION_CALLBACK(NAME, INVOKE) \
682 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
683 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
685 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
688 INVOKE(PM, L.get()); \
691#include "PassRegistry.def"
699#define CGSCC_CALLBACK(NAME, INVOKE) \
700 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
701 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
703 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
706 INVOKE(PM, L.get()); \
709#include "PassRegistry.def"
717#define LOOP_CALLBACK(NAME, INVOKE) \
718 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
719 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
721 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
724 INVOKE(PM, L.get()); \
727#include "PassRegistry.def"
733#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
734 MAM.registerPass([&] { return CREATE_PASS; });
735#include "PassRegistry.def"
737 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
742#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
743 CGAM.registerPass([&] { return CREATE_PASS; });
744#include "PassRegistry.def"
746 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
756#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
757 if constexpr (std::is_constructible_v< \
758 std::remove_reference_t<decltype(CREATE_PASS)>, \
759 const TargetMachine &>) { \
761 FAM.registerPass([&] { return CREATE_PASS; }); \
763 FAM.registerPass([&] { return CREATE_PASS; }); \
765#include "PassRegistry.def"
767 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
774#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
775 MFAM.registerPass([&] { return CREATE_PASS; });
776#include "llvm/Passes/MachinePassRegistry.def"
778 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
783#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
784 LAM.registerPass([&] { return CREATE_PASS; });
785#include "PassRegistry.def"
787 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
791static std::optional<std::pair<bool, bool>>
793 std::pair<bool, bool> Params;
794 if (!Name.consume_front(
"function"))
798 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
800 while (!Name.empty()) {
801 auto [Front, Back] = Name.split(
';');
803 if (Front ==
"eager-inv")
805 else if (Front ==
"no-rerun")
806 Params.second =
true;
814 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
826 while (!Params.
empty()) {
828 std::tie(ParamName, Params) = Params.
split(
';');
830 if (ParamName == OptionName) {
847 while (!Params.
empty()) {
849 std::tie(ParamName, Params) = Params.
split(
';');
854 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
859 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
863 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
868 if (ParamName ==
"force-hardware-loops") {
870 }
else if (ParamName ==
"force-hardware-loop-phi") {
872 }
else if (ParamName ==
"force-nested-hardware-loop") {
874 }
else if (ParamName ==
"force-hardware-loop-guard") {
878 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
882 return HardwareLoopOpts;
894 "FunctionPropertiesStatisticsPass");
904 Params,
"assume-default-is-flat-addrspace",
"InferAddressSpacesPass");
910 while (!Params.
empty()) {
912 std::tie(ParamName, Params) = Params.
split(
';');
913 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
915 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
922 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
929 if (ParamName ==
"partial") {
931 }
else if (ParamName ==
"peeling") {
933 }
else if (ParamName ==
"profile-peeling") {
935 }
else if (ParamName ==
"runtime") {
937 }
else if (ParamName ==
"upperbound") {
939 }
else if (ParamName ==
"prepare-for-lto") {
943 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
952 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
972 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
981 "EntryExitInstrumenter");
986 "DropUnnecessaryAssumes");
991 "LowerMatrixIntrinsics");
996 while (!Params.
empty()) {
998 std::tie(ParamName, Params) = Params.
split(
';');
1001 if (ParamName ==
"preserve-order")
1003 else if (ParamName ==
"rename-all")
1005 else if (ParamName ==
"fold-all")
1007 else if (ParamName ==
"reorder-operands")
1011 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1021 while (!Params.
empty()) {
1023 std::tie(ParamName, Params) = Params.
split(
';');
1025 if (ParamName ==
"kernel") {
1026 Result.CompileKernel =
true;
1027 }
else if (ParamName ==
"use-after-scope") {
1028 Result.UseAfterScope =
true;
1031 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1041 while (!Params.
empty()) {
1043 std::tie(ParamName, Params) = Params.
split(
';');
1045 if (ParamName ==
"recover") {
1047 }
else if (ParamName ==
"kernel") {
1048 Result.CompileKernel =
true;
1051 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1060parseDropTypeTestsPassOptions(
StringRef Params) {
1062 while (!Params.
empty()) {
1064 std::tie(ParamName, Params) = Params.
split(
';');
1066 if (ParamName ==
"all") {
1068 }
else if (ParamName ==
"assume") {
1072 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1081 while (!Params.
empty()) {
1083 std::tie(ParamName, Params) = Params.
split(
';');
1085 if (ParamName ==
"thinlto") {
1087 }
else if (ParamName ==
"emit-summary") {
1088 Result.EmitLTOSummary =
true;
1091 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1099parseLowerAllowCheckPassOptions(
StringRef Params) {
1101 while (!Params.
empty()) {
1103 std::tie(ParamName, Params) = Params.
split(
';');
1114 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1121 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1126 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1128 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1129 IndicesStr, CutoffStr)
1133 while (IndicesStr !=
"") {
1135 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1141 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1142 firstIndexStr, IndicesStr)
1149 if (index >=
Result.cutoffs.size())
1150 Result.cutoffs.resize(index + 1, 0);
1152 Result.cutoffs[index] = cutoff;
1154 }
else if (ParamName.
starts_with(
"runtime_check")) {
1156 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1160 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1162 ValueString, Params)
1166 Result.runtime_check = runtime_check;
1169 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1180 while (!Params.
empty()) {
1182 std::tie(ParamName, Params) = Params.
split(
';');
1184 if (ParamName ==
"recover") {
1186 }
else if (ParamName ==
"kernel") {
1191 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1196 }
else if (ParamName ==
"eager-checks") {
1197 Result.EagerChecks =
true;
1200 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1210 while (!Params.
empty()) {
1212 std::tie(ParamName, Params) = Params.
split(
';');
1219 formatv(
"invalid argument to AllocToken pass mode "
1226 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1236 while (!Params.
empty()) {
1238 std::tie(ParamName, Params) = Params.
split(
';');
1241 if (ParamName ==
"speculate-blocks") {
1243 }
else if (ParamName ==
"simplify-cond-branch") {
1245 }
else if (ParamName ==
"forward-switch-cond") {
1247 }
else if (ParamName ==
"switch-range-to-icmp") {
1249 }
else if (ParamName ==
"switch-to-arithmetic") {
1251 }
else if (ParamName ==
"switch-to-lookup") {
1253 }
else if (ParamName ==
"keep-loops") {
1255 }
else if (ParamName ==
"hoist-common-insts") {
1257 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1259 }
else if (ParamName ==
"sink-common-insts") {
1261 }
else if (ParamName ==
"speculate-unpredictables") {
1264 APInt BonusInstThreshold;
1267 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1275 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1286 Result.setVerifyFixpoint(
true);
1287 while (!Params.
empty()) {
1289 std::tie(ParamName, Params) = Params.
split(
';');
1292 if (ParamName ==
"verify-fixpoint") {
1295 APInt MaxIterations;
1298 formatv(
"invalid argument to InstCombine pass max-iterations "
1306 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1316 while (!Params.
empty()) {
1318 std::tie(ParamName, Params) = Params.
split(
';');
1321 if (ParamName ==
"interleave-forced-only") {
1323 }
else if (ParamName ==
"vectorize-forced-only") {
1327 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1335 std::pair<bool, bool>
Result = {
false,
true};
1336 while (!Params.
empty()) {
1338 std::tie(ParamName, Params) = Params.
split(
';');
1341 if (ParamName ==
"nontrivial") {
1343 }
else if (ParamName ==
"trivial") {
1347 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1356 while (!Params.
empty()) {
1358 std::tie(ParamName, Params) = Params.
split(
';');
1361 if (ParamName ==
"allowspeculation") {
1365 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1372struct LoopRotateOptions {
1373 bool EnableHeaderDuplication =
true;
1374 bool PrepareForLTO =
false;
1375 bool CheckExitCount =
false;
1379 LoopRotateOptions
Result;
1380 while (!Params.
empty()) {
1382 std::tie(ParamName, Params) = Params.
split(
';');
1385 if (ParamName ==
"header-duplication") {
1387 }
else if (ParamName ==
"prepare-for-lto") {
1389 }
else if (ParamName ==
"check-exit-count") {
1393 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1402 while (!Params.
empty()) {
1404 std::tie(ParamName, Params) = Params.
split(
';');
1407 if (ParamName ==
"split-footer-bb") {
1411 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1422 while (!Params.
empty()) {
1424 std::tie(ParamName, Params) = Params.
split(
';');
1427 if (ParamName ==
"scalar-pre") {
1429 }
else if (ParamName ==
"load-pre") {
1431 }
else if (ParamName ==
"split-backedge-load-pre") {
1433 }
else if (ParamName ==
"memdep") {
1437 }
else if (ParamName ==
"memoryssa") {
1443 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1452 while (!Params.
empty()) {
1454 std::tie(ParamName, Params) = Params.
split(
';');
1457 if (ParamName ==
"func-spec")
1461 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1469 while (!Params.
empty()) {
1471 std::tie(ParamName, Params) = Params.
split(
';');
1476 formatv(
"invalid argument to Scalarizer pass min-bits "
1487 if (ParamName ==
"load-store")
1489 else if (ParamName ==
"variable-insert-extract")
1493 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1503 bool SawCFGOption =
false;
1504 while (!Params.
empty()) {
1506 std::tie(ParamName, Params) = Params.
split(
';');
1508 if (ParamName ==
"modify-cfg") {
1513 SawCFGOption =
true;
1514 }
else if (ParamName ==
"preserve-cfg") {
1519 SawCFGOption =
true;
1520 }
else if (ParamName ==
"aggregate-to-vector") {
1521 Result.AggregateToVector =
true;
1524 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1525 "modify-cfg, or aggregate-to-vector)",
1535parseStackLifetimeOptions(
StringRef Params) {
1537 while (!Params.
empty()) {
1539 std::tie(ParamName, Params) = Params.
split(
';');
1541 if (ParamName ==
"may") {
1543 }
else if (ParamName ==
"must") {
1547 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1556 "DependenceAnalysisPrinter");
1561 "SeparateConstOffsetFromGEP");
1570parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1574 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1582 "MemorySSAPrinterPass");
1587 "SpeculativeExecutionPass");
1592 while (!Params.
empty()) {
1594 std::tie(ParamName, Params) = Params.
split(
';');
1600 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1608parseStructuralHashPrinterPassOptions(
StringRef Params) {
1611 if (Params ==
"detailed")
1613 if (Params ==
"call-target-ignored")
1616 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1622 while (!Params.
empty()) {
1624 std::tie(ParamName, Params) = Params.
split(
';');
1627 if (ParamName ==
"group-by-use")
1629 else if (ParamName ==
"ignore-single-use")
1631 else if (ParamName ==
"merge-const")
1633 else if (ParamName ==
"merge-const-aggressive")
1635 else if (ParamName ==
"merge-external")
1640 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1644 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1653 while (!Params.
empty()) {
1655 std::tie(ParamName, Params) = Params.
split(
';');
1661 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1672 while (!Params.
empty()) {
1674 std::tie(ParamName, Params) = Params.
split(
';');
1677 std::optional<RegAllocFilterFunc>
Filter =
1681 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1690 if (ParamName ==
"no-clear-vregs") {
1696 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1703parseBoundsCheckingOptions(
StringRef Params) {
1705 while (!Params.
empty()) {
1707 std::tie(ParamName, Params) = Params.
split(
';');
1708 if (ParamName ==
"trap") {
1710 }
else if (ParamName ==
"rt") {
1716 }
else if (ParamName ==
"rt-abort") {
1722 }
else if (ParamName ==
"min-rt") {
1728 }
else if (ParamName ==
"min-rt-abort") {
1734 }
else if (ParamName ==
"merge") {
1736 }
else if (ParamName ==
"handler-preserve-all-regs") {
1738 Options.Rt->HandlerPreserveAllRegs =
true;
1742 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1748 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1765 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1767 Param.str().c_str());
1770 if (!
Level.has_value())
1772 "invalid optimization level for expand-ir-insts pass: %s",
1773 Digit.str().c_str());
1780 if (Params.
empty() || Params ==
"all")
1781 return RAGreedyPass::Options();
1785 return RAGreedyPass::Options{*
Filter, Params};
1788 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1794 "MachineSinkingPass");
1798 bool AllowTailMerge =
true;
1799 if (!Params.
empty()) {
1801 if (Params !=
"tail-merge")
1803 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1807 return AllowTailMerge;
1811 bool ClearVirtRegs =
true;
1812 if (!Params.
empty()) {
1814 if (Params !=
"clear-vregs")
1816 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1819 return ClearVirtRegs;
1822struct FatLTOOptions {
1824 bool ThinLTO =
false;
1825 bool EmitSummary =
false;
1830 bool HaveOptLevel =
false;
1831 while (!Params.
empty()) {
1833 std::tie(ParamName, Params) = Params.
split(
';');
1835 if (ParamName ==
"thinlto") {
1837 }
else if (ParamName ==
"emit-summary") {
1838 Result.EmitSummary =
true;
1839 }
else if (std::optional<OptimizationLevel> OptLevel =
1841 Result.OptLevel = *OptLevel;
1842 HaveOptLevel =
true;
1845 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1852 "missing optimization level for fatlto-pre-link pipeline",
1867template <
typename PassManagerT,
typename CallbacksT>
1869 if (!Callbacks.empty()) {
1870 PassManagerT DummyPM;
1871 for (
auto &CB : Callbacks)
1872 if (CB(Name, DummyPM, {}))
1878template <
typename CallbacksT>
1880 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1883 if (Name ==
"module")
1885 if (Name ==
"cgscc")
1887 if (NameNoBracket ==
"function")
1889 if (Name ==
"coro-cond")
1892#define MODULE_PASS(NAME, CREATE_PASS) \
1895#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1896 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1898#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1899 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1901#include "PassRegistry.def"
1906template <
typename CallbacksT>
1909 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1910 if (Name ==
"cgscc")
1912 if (NameNoBracket ==
"function")
1919#define CGSCC_PASS(NAME, CREATE_PASS) \
1922#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1923 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1925#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1926 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1928#include "PassRegistry.def"
1933template <
typename CallbacksT>
1936 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1937 if (NameNoBracket ==
"function")
1939 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1942#define FUNCTION_PASS(NAME, CREATE_PASS) \
1945#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1946 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1948#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1949 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1951#include "PassRegistry.def"
1956template <
typename CallbacksT>
1959 if (Name ==
"machine-function")
1962#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1965#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1967 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1970#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1971 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1974#include "llvm/Passes/MachinePassRegistry.def"
1979template <
typename CallbacksT>
1981 bool &UseMemorySSA) {
1982 UseMemorySSA =
false;
1985 UseMemorySSA =
true;
1989#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1992#include "PassRegistry.def"
1997template <
typename CallbacksT>
1999 bool &UseMemorySSA) {
2000 UseMemorySSA =
false;
2003 UseMemorySSA =
true;
2007#define LOOP_PASS(NAME, CREATE_PASS) \
2010#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2011 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2013#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2014 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2016#include "PassRegistry.def"
2021std::optional<std::vector<PassBuilder::PipelineElement>>
2023 std::vector<PipelineElement> ResultPipeline;
2028 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2029 size_t Pos =
Text.find_first_of(
",()");
2030 Pipeline.push_back({
Text.substr(0, Pos), {}});
2033 if (Pos ==
Text.npos)
2036 char Sep =
Text[Pos];
2044 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2048 assert(Sep ==
')' &&
"Bogus separator!");
2053 if (PipelineStack.
size() == 1)
2054 return std::nullopt;
2057 }
while (
Text.consume_front(
")"));
2065 if (!
Text.consume_front(
","))
2066 return std::nullopt;
2069 if (PipelineStack.
size() > 1)
2071 return std::nullopt;
2073 assert(PipelineStack.
back() == &ResultPipeline &&
2074 "Wrong pipeline at the bottom of the stack!");
2075 return {std::move(ResultPipeline)};
2085 const PipelineElement &
E) {
2086 auto &
Name =
E.Name;
2087 auto &InnerPipeline =
E.InnerPipeline;
2090 if (!InnerPipeline.empty()) {
2091 if (Name ==
"module") {
2093 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2095 MPM.
addPass(std::move(NestedMPM));
2098 if (Name ==
"coro-cond") {
2100 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2102 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2105 if (Name ==
"cgscc") {
2107 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2115 "cannot have a no-rerun module to function adaptor",
2118 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2125 for (
auto &
C : ModulePipelineParsingCallbacks)
2126 if (
C(Name, MPM, InnerPipeline))
2131 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2137#define MODULE_PASS(NAME, CREATE_PASS) \
2138 if (Name == NAME) { \
2139 MPM.addPass(CREATE_PASS); \
2140 return Error::success(); \
2142#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2143 if (checkParametrizedPassName(Name, NAME)) { \
2144 auto Params = parsePassParameters(PARSER, Name, NAME); \
2146 return Params.takeError(); \
2147 MPM.addPass(CREATE_PASS(Params.get())); \
2148 return Error::success(); \
2150#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2151 if (Name == "require<" NAME ">") { \
2153 RequireAnalysisPass< \
2154 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2155 return Error::success(); \
2157 if (Name == "invalidate<" NAME ">") { \
2158 MPM.addPass(InvalidateAnalysisPass< \
2159 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2160 return Error::success(); \
2162#define CGSCC_PASS(NAME, CREATE_PASS) \
2163 if (Name == NAME) { \
2164 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2165 return Error::success(); \
2167#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2168 if (checkParametrizedPassName(Name, NAME)) { \
2169 auto Params = parsePassParameters(PARSER, Name, NAME); \
2171 return Params.takeError(); \
2173 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2174 return Error::success(); \
2176#define FUNCTION_PASS(NAME, CREATE_PASS) \
2177 if (Name == NAME) { \
2178 if constexpr (std::is_constructible_v< \
2179 std::remove_reference_t<decltype(CREATE_PASS)>, \
2180 const TargetMachine &>) { \
2182 return make_error<StringError>( \
2183 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2184 inconvertibleErrorCode()); \
2186 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2187 return Error::success(); \
2189#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2190 if (checkParametrizedPassName(Name, NAME)) { \
2191 auto Params = parsePassParameters(PARSER, Name, NAME); \
2193 return Params.takeError(); \
2194 auto CreatePass = CREATE_PASS; \
2195 if constexpr (std::is_constructible_v< \
2196 std::remove_reference_t<decltype(CreatePass( \
2198 const TargetMachine &, \
2199 std::remove_reference_t<decltype(Params.get())>>) { \
2201 return make_error<StringError>( \
2202 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2203 inconvertibleErrorCode()); \
2206 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2207 return Error::success(); \
2209#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2210 if (Name == NAME) { \
2211 MPM.addPass(createModuleToFunctionPassAdaptor( \
2212 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2213 return Error::success(); \
2215#define LOOP_PASS(NAME, CREATE_PASS) \
2216 if (Name == NAME) { \
2217 MPM.addPass(createModuleToFunctionPassAdaptor( \
2218 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2219 return Error::success(); \
2221#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2222 if (checkParametrizedPassName(Name, NAME)) { \
2223 auto Params = parsePassParameters(PARSER, Name, NAME); \
2225 return Params.takeError(); \
2226 MPM.addPass(createModuleToFunctionPassAdaptor( \
2227 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2228 return Error::success(); \
2230#include "PassRegistry.def"
2232 for (
auto &
C : ModulePipelineParsingCallbacks)
2233 if (
C(Name, MPM, InnerPipeline))
2236 formatv(
"unknown module pass '{}'", Name).str(),
2241 const PipelineElement &
E) {
2242 auto &
Name =
E.Name;
2243 auto &InnerPipeline =
E.InnerPipeline;
2246 if (!InnerPipeline.empty()) {
2247 if (Name ==
"cgscc") {
2249 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2252 CGPM.
addPass(std::move(NestedCGPM));
2257 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2261 std::move(FPM), Params->first, Params->second));
2266 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2273 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2274 if (
C(Name, CGPM, InnerPipeline))
2279 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2284#define CGSCC_PASS(NAME, CREATE_PASS) \
2285 if (Name == NAME) { \
2286 CGPM.addPass(CREATE_PASS); \
2287 return Error::success(); \
2289#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2290 if (checkParametrizedPassName(Name, NAME)) { \
2291 auto Params = parsePassParameters(PARSER, Name, NAME); \
2293 return Params.takeError(); \
2294 CGPM.addPass(CREATE_PASS(Params.get())); \
2295 return Error::success(); \
2297#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2298 if (Name == "require<" NAME ">") { \
2299 CGPM.addPass(RequireAnalysisPass< \
2300 std::remove_reference_t<decltype(CREATE_PASS)>, \
2301 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2302 CGSCCUpdateResult &>()); \
2303 return Error::success(); \
2305 if (Name == "invalidate<" NAME ">") { \
2306 CGPM.addPass(InvalidateAnalysisPass< \
2307 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2308 return Error::success(); \
2310#define FUNCTION_PASS(NAME, CREATE_PASS) \
2311 if (Name == NAME) { \
2312 if constexpr (std::is_constructible_v< \
2313 std::remove_reference_t<decltype(CREATE_PASS)>, \
2314 const TargetMachine &>) { \
2316 return make_error<StringError>( \
2317 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2318 inconvertibleErrorCode()); \
2320 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2321 return Error::success(); \
2323#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2324 if (checkParametrizedPassName(Name, NAME)) { \
2325 auto Params = parsePassParameters(PARSER, Name, NAME); \
2327 return Params.takeError(); \
2328 auto CreatePass = CREATE_PASS; \
2329 if constexpr (std::is_constructible_v< \
2330 std::remove_reference_t<decltype(CreatePass( \
2332 const TargetMachine &, \
2333 std::remove_reference_t<decltype(Params.get())>>) { \
2335 return make_error<StringError>( \
2336 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2337 inconvertibleErrorCode()); \
2340 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2341 return Error::success(); \
2343#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2344 if (Name == NAME) { \
2345 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2346 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2347 return Error::success(); \
2349#define LOOP_PASS(NAME, CREATE_PASS) \
2350 if (Name == NAME) { \
2351 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2352 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2353 return Error::success(); \
2355#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2356 if (checkParametrizedPassName(Name, NAME)) { \
2357 auto Params = parsePassParameters(PARSER, Name, NAME); \
2359 return Params.takeError(); \
2360 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2361 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2362 return Error::success(); \
2364#include "PassRegistry.def"
2366 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2367 if (
C(Name, CGPM, InnerPipeline))
2374 const PipelineElement &
E) {
2375 auto &
Name =
E.Name;
2376 auto &InnerPipeline =
E.InnerPipeline;
2379 if (!InnerPipeline.empty()) {
2380 if (Name ==
"function") {
2382 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2385 FPM.
addPass(std::move(NestedFPM));
2388 if (Name ==
"loop" || Name ==
"loop-mssa") {
2390 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2393 bool UseMemorySSA = (
Name ==
"loop-mssa");
2398 if (Name ==
"machine-function") {
2400 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2406 for (
auto &
C : FunctionPipelineParsingCallbacks)
2407 if (
C(Name, FPM, InnerPipeline))
2412 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2417#define FUNCTION_PASS(NAME, CREATE_PASS) \
2418 if (Name == NAME) { \
2419 if constexpr (std::is_constructible_v< \
2420 std::remove_reference_t<decltype(CREATE_PASS)>, \
2421 const TargetMachine &>) { \
2423 return make_error<StringError>( \
2424 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2425 inconvertibleErrorCode()); \
2427 FPM.addPass(CREATE_PASS); \
2428 return Error::success(); \
2430#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2431 if (checkParametrizedPassName(Name, NAME)) { \
2432 auto Params = parsePassParameters(PARSER, Name, NAME); \
2434 return Params.takeError(); \
2435 auto CreatePass = CREATE_PASS; \
2436 if constexpr (std::is_constructible_v< \
2437 std::remove_reference_t<decltype(CreatePass( \
2439 const TargetMachine &, \
2440 std::remove_reference_t<decltype(Params.get())>>) { \
2442 return make_error<StringError>( \
2443 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2444 inconvertibleErrorCode()); \
2447 FPM.addPass(CREATE_PASS(Params.get())); \
2448 return Error::success(); \
2450#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2451 if (Name == "require<" NAME ">") { \
2452 if constexpr (std::is_constructible_v< \
2453 std::remove_reference_t<decltype(CREATE_PASS)>, \
2454 const TargetMachine &>) { \
2456 return make_error<StringError>( \
2457 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2458 inconvertibleErrorCode()); \
2461 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2463 return Error::success(); \
2465 if (Name == "invalidate<" NAME ">") { \
2466 FPM.addPass(InvalidateAnalysisPass< \
2467 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2468 return Error::success(); \
2474#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2475 if (Name == NAME) { \
2476 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2477 return Error::success(); \
2479#define LOOP_PASS(NAME, CREATE_PASS) \
2480 if (Name == NAME) { \
2481 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2482 return Error::success(); \
2484#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2485 if (checkParametrizedPassName(Name, NAME)) { \
2486 auto Params = parsePassParameters(PARSER, Name, NAME); \
2488 return Params.takeError(); \
2490 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2491 return Error::success(); \
2493#include "PassRegistry.def"
2495 for (
auto &
C : FunctionPipelineParsingCallbacks)
2496 if (
C(Name, FPM, InnerPipeline))
2499 formatv(
"unknown function pass '{}'", Name).str(),
2504 const PipelineElement &
E) {
2505 StringRef
Name =
E.Name;
2506 auto &InnerPipeline =
E.InnerPipeline;
2509 if (!InnerPipeline.empty()) {
2510 if (Name ==
"loop") {
2512 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2515 LPM.addPass(std::move(NestedLPM));
2519 for (
auto &
C : LoopPipelineParsingCallbacks)
2520 if (
C(Name, LPM, InnerPipeline))
2525 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2530#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2531 if (Name == NAME) { \
2532 LPM.addPass(CREATE_PASS); \
2533 return Error::success(); \
2535#define LOOP_PASS(NAME, CREATE_PASS) \
2536 if (Name == NAME) { \
2537 LPM.addPass(CREATE_PASS); \
2538 return Error::success(); \
2540#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2541 if (checkParametrizedPassName(Name, NAME)) { \
2542 auto Params = parsePassParameters(PARSER, Name, NAME); \
2544 return Params.takeError(); \
2545 LPM.addPass(CREATE_PASS(Params.get())); \
2546 return Error::success(); \
2548#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2549 if (Name == "require<" NAME ">") { \
2550 LPM.addPass(RequireAnalysisPass< \
2551 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2552 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2554 return Error::success(); \
2556 if (Name == "invalidate<" NAME ">") { \
2557 LPM.addPass(InvalidateAnalysisPass< \
2558 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2559 return Error::success(); \
2561#include "PassRegistry.def"
2563 for (
auto &
C : LoopPipelineParsingCallbacks)
2564 if (
C(Name, LPM, InnerPipeline))
2571 const PipelineElement &
E) {
2572 StringRef
Name =
E.Name;
2574 if (!
E.InnerPipeline.empty()) {
2575 if (
E.Name ==
"machine-function") {
2577 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2579 MFPM.
addPass(std::move(NestedPM));
2586#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2587 if (Name == NAME) { \
2588 MFPM.addPass(CREATE_PASS); \
2589 return Error::success(); \
2591#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2592 if (Name == NAME) { \
2593 MFPM.addPass(CREATE_PASS); \
2594 return Error::success(); \
2596#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2598 if (checkParametrizedPassName(Name, NAME)) { \
2599 auto Params = parsePassParameters(PARSER, Name, NAME); \
2601 return Params.takeError(); \
2602 MFPM.addPass(CREATE_PASS(Params.get())); \
2603 return Error::success(); \
2605#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2606 if (Name == "require<" NAME ">") { \
2608 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2609 MachineFunction>()); \
2610 return Error::success(); \
2612 if (Name == "invalidate<" NAME ">") { \
2613 MFPM.addPass(InvalidateAnalysisPass< \
2614 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2615 return Error::success(); \
2617#include "llvm/Passes/MachinePassRegistry.def"
2619 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2620 if (
C(Name, MFPM,
E.InnerPipeline))
2623 formatv(
"unknown machine pass '{}'", Name).str(),
2628#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2629 if (Name == NAME) { \
2630 AA.registerModuleAnalysis< \
2631 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2634#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2635 if (Name == NAME) { \
2636 AA.registerFunctionAnalysis< \
2637 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2640#include "PassRegistry.def"
2642 for (
auto &
C : AAParsingCallbacks)
2648Error PassBuilder::parseMachinePassPipeline(
2650 for (
const auto &Element : Pipeline) {
2651 if (
auto Err = parseMachinePass(MFPM, Element))
2659 for (
const auto &Element : Pipeline) {
2660 if (
auto Err = parseLoopPass(LPM, Element))
2666Error PassBuilder::parseFunctionPassPipeline(
2668 for (
const auto &Element : Pipeline) {
2669 if (
auto Err = parseFunctionPass(FPM, Element))
2677 for (
const auto &Element : Pipeline) {
2678 if (
auto Err = parseCGSCCPass(CGPM, Element))
2710 for (
const auto &Element : Pipeline) {
2711 if (
auto Err = parseModulePass(MPM, Element))
2722 auto Pipeline = parsePipelineText(PipelineText);
2723 if (!Pipeline || Pipeline->empty())
2725 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2735 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2737 FunctionPipelineParsingCallbacks)) {
2738 Pipeline = {{
"function", std::move(*Pipeline)}};
2741 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2742 std::move(*Pipeline)}}}};
2743 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2745 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2746 std::move(*Pipeline)}}}};
2748 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2749 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2751 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2752 if (
C(MPM, *Pipeline))
2756 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2758 formatv(
"unknown {} name '{}'",
2759 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2765 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2773 auto Pipeline = parsePipelineText(PipelineText);
2774 if (!Pipeline || Pipeline->empty())
2776 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2782 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2787 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2796 auto Pipeline = parsePipelineText(PipelineText);
2797 if (!Pipeline || Pipeline->empty())
2799 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2805 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2810 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2818 auto Pipeline = parsePipelineText(PipelineText);
2819 if (!Pipeline || Pipeline->empty())
2821 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2824 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2832 auto Pipeline = parsePipelineText(PipelineText);
2833 if (!Pipeline || Pipeline->empty())
2835 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2838 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2847 if (PipelineText ==
"default") {
2852 while (!PipelineText.
empty()) {
2854 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2855 if (!parseAAPassName(
AA, Name))
2857 formatv(
"unknown alias analysis name '{}'", Name).str(),
2864std::optional<RegAllocFilterFunc>
2866 if (FilterName ==
"all")
2868 for (
auto &
C : RegClassFilterParsingCallbacks)
2869 if (
auto F =
C(FilterName))
2871 return std::nullopt;
2882 auto I = PassNames.
begin();
2883 auto End = PassNames.
end();
2890 OS <<
" " << Name <<
'<' << Params <<
">\n";
2897 OS <<
"Module passes:\n";
2898 static constexpr char ModulePassNames[] = {
"\0"
2899#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2900#include "PassRegistry.def"
2904 OS <<
"Module passes with params:\n";
2905 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2906#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2907 NAME "\0" PARAMS "\0"
2908#include "PassRegistry.def"
2912 OS <<
"Module analyses:\n";
2913 static constexpr char ModuleAnalysisNames[] = {
"\0"
2914#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2915#include "PassRegistry.def"
2919 OS <<
"Module alias analyses:\n";
2920 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2921#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2922#include "PassRegistry.def"
2926 OS <<
"CGSCC passes:\n";
2927 static constexpr char CGSCCPassNames[] = {
"\0"
2928#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2929#include "PassRegistry.def"
2933 OS <<
"CGSCC passes with params:\n";
2934 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2935#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2936 NAME "\0" PARAMS "\0"
2937#include "PassRegistry.def"
2941 OS <<
"CGSCC analyses:\n";
2942 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2943#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2944#include "PassRegistry.def"
2948 OS <<
"Function passes:\n";
2949 static constexpr char FunctionPassNames[] = {
"\0"
2950#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2951#include "PassRegistry.def"
2955 OS <<
"Function passes with params:\n";
2956 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2957#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2958 NAME "\0" PARAMS "\0"
2959#include "PassRegistry.def"
2963 OS <<
"Function analyses:\n";
2964 static constexpr char FunctionAnalysisNames[] = {
"\0"
2965#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2966#include "PassRegistry.def"
2970 OS <<
"Function alias analyses:\n";
2971 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2972#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2973#include "PassRegistry.def"
2977 OS <<
"LoopNest passes:\n";
2978 static constexpr char LoopNestPassNames[] = {
"\0"
2979#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2980#include "PassRegistry.def"
2984 OS <<
"Loop passes:\n";
2985 static constexpr char LoopPassNames[] = {
"\0"
2986#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2987#include "PassRegistry.def"
2991 OS <<
"Loop passes with params:\n";
2992 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2993#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2994 NAME "\0" PARAMS "\0"
2995#include "PassRegistry.def"
2999 OS <<
"Loop analyses:\n";
3000 static constexpr char LoopAnalysisNames[] = {
"\0"
3001#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3002#include "PassRegistry.def"
3006 OS <<
"Machine module passes (WIP):\n";
3007 static constexpr char MachineModulePassNames[] = {
"\0"
3008#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
3009#include "llvm/Passes/MachinePassRegistry.def"
3013 OS <<
"Machine function passes (WIP):\n";
3014 static constexpr char MachineFunctionPassNames[] = {
"\0"
3015#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3016#include "llvm/Passes/MachinePassRegistry.def"
3020 OS <<
"Machine function analyses (WIP):\n";
3021 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3022#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3023#include "llvm/Passes/MachinePassRegistry.def"
3031 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 file declares the IRTranslator pass.
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file provides the interface for LLVM's Logical Scalar Replacement of Aggregates pass.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
Machine Check Debug Module
This file contains the declaration of the CheckDebugMachineModulePass class, used by the new pass man...
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
This pass performs merges of loads and stores on both sides of a.
This is the interface to build a ModuleSummaryIndex for a module.
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
This file provides the interface for LLVM's Global Value Numbering pass.
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static std::optional< int > parseDevirtPassName(StringRef Name)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameList(StringTable PassNames, raw_ostream &OS)
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static Expected< OptimizationLevel > parseOptLevelParam(StringRef S)
static std::optional< OptimizationLevel > parseOptLevel(StringRef S)
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static std::optional< std::pair< bool, bool > > parseFunctionPipelineName(StringRef Name)
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameListWithParams(StringTable PassNames, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static void setupOptionsForPipelineAlias(PipelineTuningOptions &PTO, OptimizationLevel L)
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file contains the declaration of the ResetMachineFunctionPass class.
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
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.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
DropTestKind
Specifies how to drop type tests.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
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