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 "WinEHPreparePass");
1627 while (!Params.
empty()) {
1629 std::tie(ParamName, Params) = Params.
split(
';');
1632 if (ParamName ==
"group-by-use")
1634 else if (ParamName ==
"ignore-single-use")
1636 else if (ParamName ==
"merge-const")
1638 else if (ParamName ==
"merge-const-aggressive")
1640 else if (ParamName ==
"merge-external")
1645 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1649 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1658 while (!Params.
empty()) {
1660 std::tie(ParamName, Params) = Params.
split(
';');
1666 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1677 while (!Params.
empty()) {
1679 std::tie(ParamName, Params) = Params.
split(
';');
1682 std::optional<RegAllocFilterFunc>
Filter =
1686 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1695 if (ParamName ==
"no-clear-vregs") {
1701 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1708parseBoundsCheckingOptions(
StringRef Params) {
1710 while (!Params.
empty()) {
1712 std::tie(ParamName, Params) = Params.
split(
';');
1713 if (ParamName ==
"trap") {
1715 }
else if (ParamName ==
"rt") {
1721 }
else if (ParamName ==
"rt-abort") {
1727 }
else if (ParamName ==
"min-rt") {
1733 }
else if (ParamName ==
"min-rt-abort") {
1739 }
else if (ParamName ==
"merge") {
1741 }
else if (ParamName ==
"handler-preserve-all-regs") {
1743 Options.Rt->HandlerPreserveAllRegs =
true;
1747 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1753 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1770 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1772 Param.str().c_str());
1775 if (!
Level.has_value())
1777 "invalid optimization level for expand-ir-insts pass: %s",
1778 Digit.str().c_str());
1785 if (Params.
empty() || Params ==
"all")
1786 return RAGreedyPass::Options();
1790 return RAGreedyPass::Options{*
Filter, Params};
1793 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1799 "MachineSinkingPass");
1803 bool AllowTailMerge =
true;
1804 if (!Params.
empty()) {
1806 if (Params !=
"tail-merge")
1808 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1812 return AllowTailMerge;
1816 bool ClearVirtRegs =
true;
1817 if (!Params.
empty()) {
1819 if (Params !=
"clear-vregs")
1821 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1824 return ClearVirtRegs;
1827struct FatLTOOptions {
1829 bool ThinLTO =
false;
1830 bool EmitSummary =
false;
1835 bool HaveOptLevel =
false;
1836 while (!Params.
empty()) {
1838 std::tie(ParamName, Params) = Params.
split(
';');
1840 if (ParamName ==
"thinlto") {
1842 }
else if (ParamName ==
"emit-summary") {
1843 Result.EmitSummary =
true;
1844 }
else if (std::optional<OptimizationLevel> OptLevel =
1846 Result.OptLevel = *OptLevel;
1847 HaveOptLevel =
true;
1850 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1857 "missing optimization level for fatlto-pre-link pipeline",
1872template <
typename PassManagerT,
typename CallbacksT>
1874 if (!Callbacks.empty()) {
1875 PassManagerT DummyPM;
1876 for (
auto &CB : Callbacks)
1877 if (CB(Name, DummyPM, {}))
1883template <
typename CallbacksT>
1885 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1888 if (Name ==
"module")
1890 if (Name ==
"cgscc")
1892 if (NameNoBracket ==
"function")
1894 if (Name ==
"coro-cond")
1897#define MODULE_PASS(NAME, CREATE_PASS) \
1900#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1901 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1903#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1904 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1906#include "PassRegistry.def"
1911template <
typename CallbacksT>
1914 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1915 if (Name ==
"cgscc")
1917 if (NameNoBracket ==
"function")
1924#define CGSCC_PASS(NAME, CREATE_PASS) \
1927#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1928 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1930#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1931 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1933#include "PassRegistry.def"
1938template <
typename CallbacksT>
1941 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1942 if (NameNoBracket ==
"function")
1944 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1947#define FUNCTION_PASS(NAME, CREATE_PASS) \
1950#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1951 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1953#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1954 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1956#include "PassRegistry.def"
1961template <
typename CallbacksT>
1964 if (Name ==
"machine-function")
1967#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1970#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1972 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1975#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1976 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1979#include "llvm/Passes/MachinePassRegistry.def"
1984template <
typename CallbacksT>
1986 bool &UseMemorySSA) {
1987 UseMemorySSA =
false;
1990 UseMemorySSA =
true;
1994#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1997#include "PassRegistry.def"
2002template <
typename CallbacksT>
2004 bool &UseMemorySSA) {
2005 UseMemorySSA =
false;
2008 UseMemorySSA =
true;
2012#define LOOP_PASS(NAME, CREATE_PASS) \
2015#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2016 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2018#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2019 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2021#include "PassRegistry.def"
2026std::optional<std::vector<PassBuilder::PipelineElement>>
2028 std::vector<PipelineElement> ResultPipeline;
2033 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2034 size_t Pos =
Text.find_first_of(
",()");
2035 Pipeline.push_back({
Text.substr(0, Pos), {}});
2038 if (Pos ==
Text.npos)
2041 char Sep =
Text[Pos];
2049 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2053 assert(Sep ==
')' &&
"Bogus separator!");
2058 if (PipelineStack.
size() == 1)
2059 return std::nullopt;
2062 }
while (
Text.consume_front(
")"));
2070 if (!
Text.consume_front(
","))
2071 return std::nullopt;
2074 if (PipelineStack.
size() > 1)
2076 return std::nullopt;
2078 assert(PipelineStack.
back() == &ResultPipeline &&
2079 "Wrong pipeline at the bottom of the stack!");
2080 return {std::move(ResultPipeline)};
2090 const PipelineElement &
E) {
2091 auto &
Name =
E.Name;
2092 auto &InnerPipeline =
E.InnerPipeline;
2095 if (!InnerPipeline.empty()) {
2096 if (Name ==
"module") {
2098 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2100 MPM.
addPass(std::move(NestedMPM));
2103 if (Name ==
"coro-cond") {
2105 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2107 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2110 if (Name ==
"cgscc") {
2112 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2120 "cannot have a no-rerun module to function adaptor",
2123 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2130 for (
auto &
C : ModulePipelineParsingCallbacks)
2131 if (
C(Name, MPM, InnerPipeline))
2136 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2142#define MODULE_PASS(NAME, CREATE_PASS) \
2143 if (Name == NAME) { \
2144 MPM.addPass(CREATE_PASS); \
2145 return Error::success(); \
2147#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2148 if (checkParametrizedPassName(Name, NAME)) { \
2149 auto Params = parsePassParameters(PARSER, Name, NAME); \
2151 return Params.takeError(); \
2152 MPM.addPass(CREATE_PASS(Params.get())); \
2153 return Error::success(); \
2155#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2156 if (Name == "require<" NAME ">") { \
2158 RequireAnalysisPass< \
2159 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2160 return Error::success(); \
2162 if (Name == "invalidate<" NAME ">") { \
2163 MPM.addPass(InvalidateAnalysisPass< \
2164 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2165 return Error::success(); \
2167#define CGSCC_PASS(NAME, CREATE_PASS) \
2168 if (Name == NAME) { \
2169 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2170 return Error::success(); \
2172#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2173 if (checkParametrizedPassName(Name, NAME)) { \
2174 auto Params = parsePassParameters(PARSER, Name, NAME); \
2176 return Params.takeError(); \
2178 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2179 return Error::success(); \
2181#define FUNCTION_PASS(NAME, CREATE_PASS) \
2182 if (Name == NAME) { \
2183 if constexpr (std::is_constructible_v< \
2184 std::remove_reference_t<decltype(CREATE_PASS)>, \
2185 const TargetMachine &>) { \
2187 return make_error<StringError>( \
2188 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2189 inconvertibleErrorCode()); \
2191 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2192 return Error::success(); \
2194#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2195 if (checkParametrizedPassName(Name, NAME)) { \
2196 auto Params = parsePassParameters(PARSER, Name, NAME); \
2198 return Params.takeError(); \
2199 auto CreatePass = CREATE_PASS; \
2200 if constexpr (std::is_constructible_v< \
2201 std::remove_reference_t<decltype(CreatePass( \
2203 const TargetMachine &, \
2204 std::remove_reference_t<decltype(Params.get())>>) { \
2206 return make_error<StringError>( \
2207 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2208 inconvertibleErrorCode()); \
2211 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2212 return Error::success(); \
2214#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2215 if (Name == NAME) { \
2216 MPM.addPass(createModuleToFunctionPassAdaptor( \
2217 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2218 return Error::success(); \
2220#define LOOP_PASS(NAME, CREATE_PASS) \
2221 if (Name == NAME) { \
2222 MPM.addPass(createModuleToFunctionPassAdaptor( \
2223 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2224 return Error::success(); \
2226#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2227 if (checkParametrizedPassName(Name, NAME)) { \
2228 auto Params = parsePassParameters(PARSER, Name, NAME); \
2230 return Params.takeError(); \
2231 MPM.addPass(createModuleToFunctionPassAdaptor( \
2232 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2233 return Error::success(); \
2235#include "PassRegistry.def"
2237 for (
auto &
C : ModulePipelineParsingCallbacks)
2238 if (
C(Name, MPM, InnerPipeline))
2241 formatv(
"unknown module pass '{}'", Name).str(),
2246 const PipelineElement &
E) {
2247 auto &
Name =
E.Name;
2248 auto &InnerPipeline =
E.InnerPipeline;
2251 if (!InnerPipeline.empty()) {
2252 if (Name ==
"cgscc") {
2254 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2257 CGPM.
addPass(std::move(NestedCGPM));
2262 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2266 std::move(FPM), Params->first, Params->second));
2271 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2278 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2279 if (
C(Name, CGPM, InnerPipeline))
2284 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2289#define CGSCC_PASS(NAME, CREATE_PASS) \
2290 if (Name == NAME) { \
2291 CGPM.addPass(CREATE_PASS); \
2292 return Error::success(); \
2294#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2295 if (checkParametrizedPassName(Name, NAME)) { \
2296 auto Params = parsePassParameters(PARSER, Name, NAME); \
2298 return Params.takeError(); \
2299 CGPM.addPass(CREATE_PASS(Params.get())); \
2300 return Error::success(); \
2302#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2303 if (Name == "require<" NAME ">") { \
2304 CGPM.addPass(RequireAnalysisPass< \
2305 std::remove_reference_t<decltype(CREATE_PASS)>, \
2306 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2307 CGSCCUpdateResult &>()); \
2308 return Error::success(); \
2310 if (Name == "invalidate<" NAME ">") { \
2311 CGPM.addPass(InvalidateAnalysisPass< \
2312 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2313 return Error::success(); \
2315#define FUNCTION_PASS(NAME, CREATE_PASS) \
2316 if (Name == NAME) { \
2317 if constexpr (std::is_constructible_v< \
2318 std::remove_reference_t<decltype(CREATE_PASS)>, \
2319 const TargetMachine &>) { \
2321 return make_error<StringError>( \
2322 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2323 inconvertibleErrorCode()); \
2325 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2326 return Error::success(); \
2328#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2329 if (checkParametrizedPassName(Name, NAME)) { \
2330 auto Params = parsePassParameters(PARSER, Name, NAME); \
2332 return Params.takeError(); \
2333 auto CreatePass = CREATE_PASS; \
2334 if constexpr (std::is_constructible_v< \
2335 std::remove_reference_t<decltype(CreatePass( \
2337 const TargetMachine &, \
2338 std::remove_reference_t<decltype(Params.get())>>) { \
2340 return make_error<StringError>( \
2341 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2342 inconvertibleErrorCode()); \
2345 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2346 return Error::success(); \
2348#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2349 if (Name == NAME) { \
2350 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2351 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2352 return Error::success(); \
2354#define LOOP_PASS(NAME, CREATE_PASS) \
2355 if (Name == NAME) { \
2356 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2357 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2358 return Error::success(); \
2360#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2361 if (checkParametrizedPassName(Name, NAME)) { \
2362 auto Params = parsePassParameters(PARSER, Name, NAME); \
2364 return Params.takeError(); \
2365 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2366 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2367 return Error::success(); \
2369#include "PassRegistry.def"
2371 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2372 if (
C(Name, CGPM, InnerPipeline))
2379 const PipelineElement &
E) {
2380 auto &
Name =
E.Name;
2381 auto &InnerPipeline =
E.InnerPipeline;
2384 if (!InnerPipeline.empty()) {
2385 if (Name ==
"function") {
2387 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2390 FPM.
addPass(std::move(NestedFPM));
2393 if (Name ==
"loop" || Name ==
"loop-mssa") {
2395 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2398 bool UseMemorySSA = (
Name ==
"loop-mssa");
2403 if (Name ==
"machine-function") {
2405 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2411 for (
auto &
C : FunctionPipelineParsingCallbacks)
2412 if (
C(Name, FPM, InnerPipeline))
2417 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2422#define FUNCTION_PASS(NAME, CREATE_PASS) \
2423 if (Name == NAME) { \
2424 if constexpr (std::is_constructible_v< \
2425 std::remove_reference_t<decltype(CREATE_PASS)>, \
2426 const TargetMachine &>) { \
2428 return make_error<StringError>( \
2429 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2430 inconvertibleErrorCode()); \
2432 FPM.addPass(CREATE_PASS); \
2433 return Error::success(); \
2435#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2436 if (checkParametrizedPassName(Name, NAME)) { \
2437 auto Params = parsePassParameters(PARSER, Name, NAME); \
2439 return Params.takeError(); \
2440 auto CreatePass = CREATE_PASS; \
2441 if constexpr (std::is_constructible_v< \
2442 std::remove_reference_t<decltype(CreatePass( \
2444 const TargetMachine &, \
2445 std::remove_reference_t<decltype(Params.get())>>) { \
2447 return make_error<StringError>( \
2448 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2449 inconvertibleErrorCode()); \
2452 FPM.addPass(CREATE_PASS(Params.get())); \
2453 return Error::success(); \
2455#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2456 if (Name == "require<" NAME ">") { \
2457 if constexpr (std::is_constructible_v< \
2458 std::remove_reference_t<decltype(CREATE_PASS)>, \
2459 const TargetMachine &>) { \
2461 return make_error<StringError>( \
2462 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2463 inconvertibleErrorCode()); \
2466 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2468 return Error::success(); \
2470 if (Name == "invalidate<" NAME ">") { \
2471 FPM.addPass(InvalidateAnalysisPass< \
2472 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2473 return Error::success(); \
2479#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2480 if (Name == NAME) { \
2481 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2482 return Error::success(); \
2484#define LOOP_PASS(NAME, CREATE_PASS) \
2485 if (Name == NAME) { \
2486 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2487 return Error::success(); \
2489#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2490 if (checkParametrizedPassName(Name, NAME)) { \
2491 auto Params = parsePassParameters(PARSER, Name, NAME); \
2493 return Params.takeError(); \
2495 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2496 return Error::success(); \
2498#include "PassRegistry.def"
2500 for (
auto &
C : FunctionPipelineParsingCallbacks)
2501 if (
C(Name, FPM, InnerPipeline))
2504 formatv(
"unknown function pass '{}'", Name).str(),
2509 const PipelineElement &
E) {
2510 StringRef
Name =
E.Name;
2511 auto &InnerPipeline =
E.InnerPipeline;
2514 if (!InnerPipeline.empty()) {
2515 if (Name ==
"loop") {
2517 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2520 LPM.addPass(std::move(NestedLPM));
2524 for (
auto &
C : LoopPipelineParsingCallbacks)
2525 if (
C(Name, LPM, InnerPipeline))
2530 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2535#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2536 if (Name == NAME) { \
2537 LPM.addPass(CREATE_PASS); \
2538 return Error::success(); \
2540#define LOOP_PASS(NAME, CREATE_PASS) \
2541 if (Name == NAME) { \
2542 LPM.addPass(CREATE_PASS); \
2543 return Error::success(); \
2545#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2546 if (checkParametrizedPassName(Name, NAME)) { \
2547 auto Params = parsePassParameters(PARSER, Name, NAME); \
2549 return Params.takeError(); \
2550 LPM.addPass(CREATE_PASS(Params.get())); \
2551 return Error::success(); \
2553#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2554 if (Name == "require<" NAME ">") { \
2555 LPM.addPass(RequireAnalysisPass< \
2556 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2557 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2559 return Error::success(); \
2561 if (Name == "invalidate<" NAME ">") { \
2562 LPM.addPass(InvalidateAnalysisPass< \
2563 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2564 return Error::success(); \
2566#include "PassRegistry.def"
2568 for (
auto &
C : LoopPipelineParsingCallbacks)
2569 if (
C(Name, LPM, InnerPipeline))
2576 const PipelineElement &
E) {
2577 StringRef
Name =
E.Name;
2579 if (!
E.InnerPipeline.empty()) {
2580 if (
E.Name ==
"machine-function") {
2582 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2584 MFPM.
addPass(std::move(NestedPM));
2591#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2592 if (Name == NAME) { \
2593 MFPM.addPass(CREATE_PASS); \
2594 return Error::success(); \
2596#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2597 if (Name == NAME) { \
2598 MFPM.addPass(CREATE_PASS); \
2599 return Error::success(); \
2601#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2603 if (checkParametrizedPassName(Name, NAME)) { \
2604 auto Params = parsePassParameters(PARSER, Name, NAME); \
2606 return Params.takeError(); \
2607 MFPM.addPass(CREATE_PASS(Params.get())); \
2608 return Error::success(); \
2610#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2611 if (Name == "require<" NAME ">") { \
2613 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2614 MachineFunction>()); \
2615 return Error::success(); \
2617 if (Name == "invalidate<" NAME ">") { \
2618 MFPM.addPass(InvalidateAnalysisPass< \
2619 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2620 return Error::success(); \
2622#include "llvm/Passes/MachinePassRegistry.def"
2624 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2625 if (
C(Name, MFPM,
E.InnerPipeline))
2628 formatv(
"unknown machine pass '{}'", Name).str(),
2633#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2634 if (Name == NAME) { \
2635 AA.registerModuleAnalysis< \
2636 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2639#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2640 if (Name == NAME) { \
2641 AA.registerFunctionAnalysis< \
2642 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2645#include "PassRegistry.def"
2647 for (
auto &
C : AAParsingCallbacks)
2653Error PassBuilder::parseMachinePassPipeline(
2655 for (
const auto &Element : Pipeline) {
2656 if (
auto Err = parseMachinePass(MFPM, Element))
2664 for (
const auto &Element : Pipeline) {
2665 if (
auto Err = parseLoopPass(LPM, Element))
2671Error PassBuilder::parseFunctionPassPipeline(
2673 for (
const auto &Element : Pipeline) {
2674 if (
auto Err = parseFunctionPass(FPM, Element))
2682 for (
const auto &Element : Pipeline) {
2683 if (
auto Err = parseCGSCCPass(CGPM, Element))
2715 for (
const auto &Element : Pipeline) {
2716 if (
auto Err = parseModulePass(MPM, Element))
2727 auto Pipeline = parsePipelineText(PipelineText);
2728 if (!Pipeline || Pipeline->empty())
2730 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2740 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2742 FunctionPipelineParsingCallbacks)) {
2743 Pipeline = {{
"function", std::move(*Pipeline)}};
2746 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2747 std::move(*Pipeline)}}}};
2748 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2750 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2751 std::move(*Pipeline)}}}};
2753 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2754 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2756 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2757 if (
C(MPM, *Pipeline))
2761 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2763 formatv(
"unknown {} name '{}'",
2764 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2770 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2778 auto Pipeline = parsePipelineText(PipelineText);
2779 if (!Pipeline || Pipeline->empty())
2781 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2787 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2792 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2801 auto Pipeline = parsePipelineText(PipelineText);
2802 if (!Pipeline || Pipeline->empty())
2804 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2810 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2815 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2823 auto Pipeline = parsePipelineText(PipelineText);
2824 if (!Pipeline || Pipeline->empty())
2826 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2829 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2837 auto Pipeline = parsePipelineText(PipelineText);
2838 if (!Pipeline || Pipeline->empty())
2840 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2843 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2852 if (PipelineText ==
"default") {
2857 while (!PipelineText.
empty()) {
2859 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2860 if (!parseAAPassName(
AA, Name))
2862 formatv(
"unknown alias analysis name '{}'", Name).str(),
2869std::optional<RegAllocFilterFunc>
2871 if (FilterName ==
"all")
2873 for (
auto &
C : RegClassFilterParsingCallbacks)
2874 if (
auto F =
C(FilterName))
2876 return std::nullopt;
2887 auto I = PassNames.
begin();
2888 auto End = PassNames.
end();
2895 OS <<
" " << Name <<
'<' << Params <<
">\n";
2902 OS <<
"Module passes:\n";
2903 static constexpr char ModulePassNames[] = {
"\0"
2904#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2905#include "PassRegistry.def"
2909 OS <<
"Module passes with params:\n";
2910 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2911#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2912 NAME "\0" PARAMS "\0"
2913#include "PassRegistry.def"
2917 OS <<
"Module analyses:\n";
2918 static constexpr char ModuleAnalysisNames[] = {
"\0"
2919#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2920#include "PassRegistry.def"
2924 OS <<
"Module alias analyses:\n";
2925 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2926#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2927#include "PassRegistry.def"
2931 OS <<
"CGSCC passes:\n";
2932 static constexpr char CGSCCPassNames[] = {
"\0"
2933#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2934#include "PassRegistry.def"
2938 OS <<
"CGSCC passes with params:\n";
2939 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2940#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2941 NAME "\0" PARAMS "\0"
2942#include "PassRegistry.def"
2946 OS <<
"CGSCC analyses:\n";
2947 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2948#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2949#include "PassRegistry.def"
2953 OS <<
"Function passes:\n";
2954 static constexpr char FunctionPassNames[] = {
"\0"
2955#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2956#include "PassRegistry.def"
2960 OS <<
"Function passes with params:\n";
2961 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2962#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2963 NAME "\0" PARAMS "\0"
2964#include "PassRegistry.def"
2968 OS <<
"Function analyses:\n";
2969 static constexpr char FunctionAnalysisNames[] = {
"\0"
2970#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2971#include "PassRegistry.def"
2975 OS <<
"Function alias analyses:\n";
2976 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2977#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2978#include "PassRegistry.def"
2982 OS <<
"LoopNest passes:\n";
2983 static constexpr char LoopNestPassNames[] = {
"\0"
2984#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2985#include "PassRegistry.def"
2989 OS <<
"Loop passes:\n";
2990 static constexpr char LoopPassNames[] = {
"\0"
2991#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2992#include "PassRegistry.def"
2996 OS <<
"Loop passes with params:\n";
2997 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2998#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2999 NAME "\0" PARAMS "\0"
3000#include "PassRegistry.def"
3004 OS <<
"Loop analyses:\n";
3005 static constexpr char LoopAnalysisNames[] = {
"\0"
3006#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3007#include "PassRegistry.def"
3011 OS <<
"Machine module passes (WIP):\n";
3012 static constexpr char MachineModulePassNames[] = {
"\0"
3013#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
3014#include "llvm/Passes/MachinePassRegistry.def"
3018 OS <<
"Machine function passes (WIP):\n";
3019 static constexpr char MachineFunctionPassNames[] = {
"\0"
3020#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3021#include "llvm/Passes/MachinePassRegistry.def"
3025 OS <<
"Machine function analyses (WIP):\n";
3026 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3027#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3028#include "llvm/Passes/MachinePassRegistry.def"
3036 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