417 "Print string describing the pipeline (best-effort only).\n"
418 " - =text\tPrint a '-passes' compatible string describing the "
420 " - =tree\tPrint a tree-like structure describing the pipeline."));
424 std::optional<PrintPipelinePassesFormat> &Val) {
425 std::optional<PrintPipelinePassesFormat>
Format =
434 "'{0}' value invalid for print-pipeline-passes argument!", Arg));
448 for (
char C : Pipeline) {
456 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
486 return MFA ? &MFA->
getMF() :
nullptr;
492class TriggerVerifierErrorPass
498 auto *PtrTy = PointerType::getUnqual(
M.getContext());
500 GlobalValue::LinkageTypes::InternalLinkage,
501 "__bad_alias",
nullptr, &M);
521 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
526class RequireAllMachineFunctionPropertiesPass
534 static MachineFunctionProperties getRequiredProperties() {
535 return MachineFunctionProperties()
537 .setFailsVerification()
542 .setRegBankSelected()
544 .setTiedOpsRewritten()
545 .setTracksDebugUserValues()
546 .setTracksLiveness();
548 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
554 if (S ==
"Os" || S ==
"Oz")
556 Twine(
"The optimization level \"") + S +
557 "\" is no longer supported. Use O2 in conjunction with the " +
558 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
569 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
573 formatv(
"invalid optimization level '{}'", S).str(),
578 std::optional<PGOOptions> PGOOpt,
581 : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
583 TM->registerPassBuilderCallbacks(*
this);
585 PIC->registerClassToPassNameCallback([
this, PIC]() {
589#define MODULE_PASS(NAME, CREATE_PASS) \
590 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
591#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
592 PIC->addClassToPassName(CLASS, NAME);
593#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
594 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
595#define FUNCTION_PASS(NAME, CREATE_PASS) \
596 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
597#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
598 PIC->addClassToPassName(CLASS, NAME);
599#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
600 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
601#define LOOPNEST_PASS(NAME, CREATE_PASS) \
602 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
603#define LOOP_PASS(NAME, CREATE_PASS) \
604 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
605#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
606 PIC->addClassToPassName(CLASS, NAME);
607#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
608 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
609#define CGSCC_PASS(NAME, CREATE_PASS) \
610 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
611#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
612 PIC->addClassToPassName(CLASS, NAME);
613#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
614 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
615#include "PassRegistry.def"
617#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
618 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
619#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
620 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
621#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
623 PIC->addClassToPassName(CLASS, NAME);
624#include "llvm/Passes/MachinePassRegistry.def"
632#define MODULE_CALLBACK(NAME, INVOKE) \
633 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
634 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
636 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
639 INVOKE(PM, L.get()); \
642#include "PassRegistry.def"
650#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
651 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
652 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
654 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
657 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
660#include "PassRegistry.def"
668#define FUNCTION_CALLBACK(NAME, INVOKE) \
669 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
670 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
672 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
675 INVOKE(PM, L.get()); \
678#include "PassRegistry.def"
686#define CGSCC_CALLBACK(NAME, INVOKE) \
687 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
688 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
690 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
693 INVOKE(PM, L.get()); \
696#include "PassRegistry.def"
704#define LOOP_CALLBACK(NAME, INVOKE) \
705 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
706 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
708 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
711 INVOKE(PM, L.get()); \
714#include "PassRegistry.def"
720#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
721 MAM.registerPass([&] { return CREATE_PASS; });
722#include "PassRegistry.def"
724 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
729#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
730 CGAM.registerPass([&] { return CREATE_PASS; });
731#include "PassRegistry.def"
733 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
743#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
744 if constexpr (std::is_constructible_v< \
745 std::remove_reference_t<decltype(CREATE_PASS)>, \
746 const TargetMachine &>) { \
748 FAM.registerPass([&] { return CREATE_PASS; }); \
750 FAM.registerPass([&] { return CREATE_PASS; }); \
752#include "PassRegistry.def"
754 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
761#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
762 MFAM.registerPass([&] { return CREATE_PASS; });
763#include "llvm/Passes/MachinePassRegistry.def"
765 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
770#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
771 LAM.registerPass([&] { return CREATE_PASS; });
772#include "PassRegistry.def"
774 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
778static std::optional<std::pair<bool, bool>>
780 std::pair<bool, bool> Params;
781 if (!Name.consume_front(
"function"))
785 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
787 while (!Name.empty()) {
788 auto [Front, Back] = Name.split(
';');
790 if (Front ==
"eager-inv")
792 else if (Front ==
"no-rerun")
793 Params.second =
true;
801 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
813 while (!Params.
empty()) {
815 std::tie(ParamName, Params) = Params.
split(
';');
817 if (ParamName == OptionName) {
834 while (!Params.
empty()) {
836 std::tie(ParamName, Params) = Params.
split(
';');
841 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
846 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
850 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
855 if (ParamName ==
"force-hardware-loops") {
857 }
else if (ParamName ==
"force-hardware-loop-phi") {
859 }
else if (ParamName ==
"force-nested-hardware-loop") {
861 }
else if (ParamName ==
"force-hardware-loop-guard") {
865 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
869 return HardwareLoopOpts;
881 "FunctionPropertiesStatisticsPass");
892 while (!Params.
empty()) {
894 std::tie(ParamName, Params) = Params.
split(
';');
895 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
897 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
904 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
911 if (ParamName ==
"partial") {
913 }
else if (ParamName ==
"peeling") {
915 }
else if (ParamName ==
"profile-peeling") {
917 }
else if (ParamName ==
"runtime") {
919 }
else if (ParamName ==
"upperbound") {
921 }
else if (ParamName ==
"prepare-for-lto") {
925 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
934 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
954 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
963 "EntryExitInstrumenter");
968 "DropUnnecessaryAssumes");
977 "LowerMatrixIntrinsics");
982 while (!Params.
empty()) {
984 std::tie(ParamName, Params) = Params.
split(
';');
987 if (ParamName ==
"preserve-order")
989 else if (ParamName ==
"rename-all")
991 else if (ParamName ==
"fold-all")
993 else if (ParamName ==
"reorder-operands")
997 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1007 while (!Params.
empty()) {
1009 std::tie(ParamName, Params) = Params.
split(
';');
1011 if (ParamName ==
"kernel") {
1012 Result.CompileKernel =
true;
1013 }
else if (ParamName ==
"use-after-scope") {
1014 Result.UseAfterScope =
true;
1017 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1027 while (!Params.
empty()) {
1029 std::tie(ParamName, Params) = Params.
split(
';');
1031 if (ParamName ==
"recover") {
1033 }
else if (ParamName ==
"kernel") {
1034 Result.CompileKernel =
true;
1037 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1046parseDropTypeTestsPassOptions(
StringRef Params) {
1048 while (!Params.
empty()) {
1050 std::tie(ParamName, Params) = Params.
split(
';');
1052 if (ParamName ==
"all") {
1054 }
else if (ParamName ==
"assume") {
1058 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1067 while (!Params.
empty()) {
1069 std::tie(ParamName, Params) = Params.
split(
';');
1071 if (ParamName ==
"thinlto") {
1073 }
else if (ParamName ==
"emit-summary") {
1074 Result.EmitLTOSummary =
true;
1077 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1085parseLowerAllowCheckPassOptions(
StringRef Params) {
1087 while (!Params.
empty()) {
1089 std::tie(ParamName, Params) = Params.
split(
';');
1100 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1107 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1112 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1114 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1115 IndicesStr, CutoffStr)
1119 while (IndicesStr !=
"") {
1121 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1127 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1128 firstIndexStr, IndicesStr)
1135 if (index >=
Result.cutoffs.size())
1136 Result.cutoffs.resize(index + 1, 0);
1138 Result.cutoffs[index] = cutoff;
1140 }
else if (ParamName.
starts_with(
"runtime_check")) {
1142 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1146 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1148 ValueString, Params)
1152 Result.runtime_check = runtime_check;
1155 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1166 while (!Params.
empty()) {
1168 std::tie(ParamName, Params) = Params.
split(
';');
1170 if (ParamName ==
"recover") {
1172 }
else if (ParamName ==
"kernel") {
1177 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1182 }
else if (ParamName ==
"eager-checks") {
1183 Result.EagerChecks =
true;
1186 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1196 while (!Params.
empty()) {
1198 std::tie(ParamName, Params) = Params.
split(
';');
1205 formatv(
"invalid argument to AllocToken pass mode "
1212 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1222 while (!Params.
empty()) {
1224 std::tie(ParamName, Params) = Params.
split(
';');
1227 if (ParamName ==
"speculate-blocks") {
1229 }
else if (ParamName ==
"simplify-cond-branch") {
1231 }
else if (ParamName ==
"forward-switch-cond") {
1233 }
else if (ParamName ==
"switch-range-to-icmp") {
1235 }
else if (ParamName ==
"switch-to-arithmetic") {
1237 }
else if (ParamName ==
"switch-to-lookup") {
1239 }
else if (ParamName ==
"keep-loops") {
1241 }
else if (ParamName ==
"hoist-common-insts") {
1243 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1245 }
else if (ParamName ==
"sink-common-insts") {
1247 }
else if (ParamName ==
"speculate-unpredictables") {
1250 APInt BonusInstThreshold;
1253 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1261 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1272 Result.setVerifyFixpoint(
true);
1273 while (!Params.
empty()) {
1275 std::tie(ParamName, Params) = Params.
split(
';');
1278 if (ParamName ==
"verify-fixpoint") {
1281 APInt MaxIterations;
1284 formatv(
"invalid argument to InstCombine pass max-iterations "
1292 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1302 while (!Params.
empty()) {
1304 std::tie(ParamName, Params) = Params.
split(
';');
1307 if (ParamName ==
"interleave-forced-only") {
1309 }
else if (ParamName ==
"vectorize-forced-only") {
1313 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1321 std::pair<bool, bool>
Result = {
false,
true};
1322 while (!Params.
empty()) {
1324 std::tie(ParamName, Params) = Params.
split(
';');
1327 if (ParamName ==
"nontrivial") {
1329 }
else if (ParamName ==
"trivial") {
1333 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1342 while (!Params.
empty()) {
1344 std::tie(ParamName, Params) = Params.
split(
';');
1347 if (ParamName ==
"allowspeculation") {
1351 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1358struct LoopRotateOptions {
1359 bool EnableHeaderDuplication =
true;
1360 bool PrepareForLTO =
false;
1361 bool CheckExitCount =
false;
1365 LoopRotateOptions
Result;
1366 while (!Params.
empty()) {
1368 std::tie(ParamName, Params) = Params.
split(
';');
1371 if (ParamName ==
"header-duplication") {
1373 }
else if (ParamName ==
"prepare-for-lto") {
1375 }
else if (ParamName ==
"check-exit-count") {
1379 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1388 while (!Params.
empty()) {
1390 std::tie(ParamName, Params) = Params.
split(
';');
1393 if (ParamName ==
"split-footer-bb") {
1397 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1408 while (!Params.
empty()) {
1410 std::tie(ParamName, Params) = Params.
split(
';');
1413 if (ParamName ==
"scalar-pre") {
1415 }
else if (ParamName ==
"load-pre") {
1417 }
else if (ParamName ==
"split-backedge-load-pre") {
1419 }
else if (ParamName ==
"memdep") {
1423 }
else if (ParamName ==
"memoryssa") {
1429 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1438 while (!Params.
empty()) {
1440 std::tie(ParamName, Params) = Params.
split(
';');
1443 if (ParamName ==
"func-spec")
1447 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1455 while (!Params.
empty()) {
1457 std::tie(ParamName, Params) = Params.
split(
';');
1462 formatv(
"invalid argument to Scalarizer pass min-bits "
1473 if (ParamName ==
"load-store")
1475 else if (ParamName ==
"variable-insert-extract")
1479 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1489 bool SawCFGOption =
false;
1490 while (!Params.
empty()) {
1492 std::tie(ParamName, Params) = Params.
split(
';');
1494 if (ParamName ==
"modify-cfg") {
1499 SawCFGOption =
true;
1500 }
else if (ParamName ==
"preserve-cfg") {
1505 SawCFGOption =
true;
1506 }
else if (ParamName ==
"aggregate-to-vector") {
1507 Result.AggregateToVector =
true;
1510 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1511 "modify-cfg, or aggregate-to-vector)",
1521parseStackLifetimeOptions(
StringRef Params) {
1523 while (!Params.
empty()) {
1525 std::tie(ParamName, Params) = Params.
split(
';');
1527 if (ParamName ==
"may") {
1529 }
else if (ParamName ==
"must") {
1533 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1542 "DependenceAnalysisPrinter");
1547 "SeparateConstOffsetFromGEP");
1556parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1560 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1568 "MemorySSAPrinterPass");
1573 "SpeculativeExecutionPass");
1578 while (!Params.
empty()) {
1580 std::tie(ParamName, Params) = Params.
split(
';');
1586 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1594parseStructuralHashPrinterPassOptions(
StringRef Params) {
1597 if (Params ==
"detailed")
1599 if (Params ==
"call-target-ignored")
1602 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1608 "WinEHPreparePass");
1613 while (!Params.
empty()) {
1615 std::tie(ParamName, Params) = Params.
split(
';');
1618 if (ParamName ==
"group-by-use")
1620 else if (ParamName ==
"ignore-single-use")
1622 else if (ParamName ==
"merge-const")
1624 else if (ParamName ==
"merge-const-aggressive")
1626 else if (ParamName ==
"merge-external")
1631 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1635 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1644 while (!Params.
empty()) {
1646 std::tie(ParamName, Params) = Params.
split(
';');
1652 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1663 while (!Params.
empty()) {
1665 std::tie(ParamName, Params) = Params.
split(
';');
1668 std::optional<RegAllocFilterFunc>
Filter =
1672 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1681 if (ParamName ==
"no-clear-vregs") {
1687 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1694parseBoundsCheckingOptions(
StringRef Params) {
1696 while (!Params.
empty()) {
1698 std::tie(ParamName, Params) = Params.
split(
';');
1699 if (ParamName ==
"trap") {
1701 }
else if (ParamName ==
"rt") {
1707 }
else if (ParamName ==
"rt-abort") {
1713 }
else if (ParamName ==
"min-rt") {
1719 }
else if (ParamName ==
"min-rt-abort") {
1725 }
else if (ParamName ==
"merge") {
1727 }
else if (ParamName ==
"handler-preserve-all-regs") {
1729 Options.Rt->HandlerPreserveAllRegs =
true;
1733 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1739 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1756 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1758 Param.str().c_str());
1761 if (!
Level.has_value())
1763 "invalid optimization level for expand-ir-insts pass: %s",
1764 Digit.str().c_str());
1771 if (Params.
empty() || Params ==
"all")
1772 return RAGreedyPass::Options();
1776 return RAGreedyPass::Options{*
Filter, Params};
1779 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1785 "MachineSinkingPass");
1789 bool AllowTailMerge =
true;
1790 if (!Params.
empty()) {
1792 if (Params !=
"tail-merge")
1794 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1798 return AllowTailMerge;
1802 bool ClearVirtRegs =
true;
1803 if (!Params.
empty()) {
1805 if (Params !=
"clear-vregs")
1807 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1810 return ClearVirtRegs;
1813struct FatLTOOptions {
1815 bool ThinLTO =
false;
1816 bool EmitSummary =
false;
1821 bool HaveOptLevel =
false;
1822 while (!Params.
empty()) {
1824 std::tie(ParamName, Params) = Params.
split(
';');
1826 if (ParamName ==
"thinlto") {
1828 }
else if (ParamName ==
"emit-summary") {
1829 Result.EmitSummary =
true;
1830 }
else if (std::optional<OptimizationLevel> OptLevel =
1832 Result.OptLevel = *OptLevel;
1833 HaveOptLevel =
true;
1836 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1843 "missing optimization level for fatlto-pre-link pipeline",
1858template <
typename PassManagerT,
typename CallbacksT>
1860 if (!Callbacks.empty()) {
1861 PassManagerT DummyPM;
1862 for (
auto &CB : Callbacks)
1863 if (CB(Name, DummyPM, {}))
1869template <
typename CallbacksT>
1871 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1874 if (Name ==
"module")
1876 if (Name ==
"cgscc")
1878 if (NameNoBracket ==
"function")
1880 if (Name ==
"coro-cond")
1883#define MODULE_PASS(NAME, CREATE_PASS) \
1886#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1887 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1889#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1890 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1892#include "PassRegistry.def"
1897template <
typename CallbacksT>
1900 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1901 if (Name ==
"cgscc")
1903 if (NameNoBracket ==
"function")
1910#define CGSCC_PASS(NAME, CREATE_PASS) \
1913#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1914 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1916#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1917 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1919#include "PassRegistry.def"
1924template <
typename CallbacksT>
1927 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1928 if (NameNoBracket ==
"function")
1930 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1933#define FUNCTION_PASS(NAME, CREATE_PASS) \
1936#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1937 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1939#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1940 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1942#include "PassRegistry.def"
1947template <
typename CallbacksT>
1950 if (Name ==
"machine-function")
1953#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1956#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1958 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1961#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1962 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1965#include "llvm/Passes/MachinePassRegistry.def"
1970template <
typename CallbacksT>
1972 bool &UseMemorySSA) {
1973 UseMemorySSA =
false;
1976 UseMemorySSA =
true;
1980#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1983#include "PassRegistry.def"
1988template <
typename CallbacksT>
1990 bool &UseMemorySSA) {
1991 UseMemorySSA =
false;
1994 UseMemorySSA =
true;
1998#define LOOP_PASS(NAME, CREATE_PASS) \
2001#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2002 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2004#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2005 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2007#include "PassRegistry.def"
2012std::optional<std::vector<PassBuilder::PipelineElement>>
2014 std::vector<PipelineElement> ResultPipeline;
2019 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2020 size_t Pos =
Text.find_first_of(
",()");
2021 Pipeline.push_back({
Text.substr(0, Pos), {}});
2024 if (Pos ==
Text.npos)
2027 char Sep =
Text[Pos];
2035 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2039 assert(Sep ==
')' &&
"Bogus separator!");
2044 if (PipelineStack.
size() == 1)
2045 return std::nullopt;
2048 }
while (
Text.consume_front(
")"));
2056 if (!
Text.consume_front(
","))
2057 return std::nullopt;
2060 if (PipelineStack.
size() > 1)
2062 return std::nullopt;
2064 assert(PipelineStack.
back() == &ResultPipeline &&
2065 "Wrong pipeline at the bottom of the stack!");
2066 return {std::move(ResultPipeline)};
2076 const PipelineElement &
E) {
2077 auto &
Name =
E.Name;
2078 auto &InnerPipeline =
E.InnerPipeline;
2081 if (!InnerPipeline.empty()) {
2082 if (Name ==
"module") {
2084 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2086 MPM.
addPass(std::move(NestedMPM));
2089 if (Name ==
"coro-cond") {
2091 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2093 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2096 if (Name ==
"cgscc") {
2098 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2106 "cannot have a no-rerun module to function adaptor",
2109 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2116 for (
auto &
C : ModulePipelineParsingCallbacks)
2117 if (
C(Name, MPM, InnerPipeline))
2122 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2128#define MODULE_PASS(NAME, CREATE_PASS) \
2129 if (Name == NAME) { \
2130 MPM.addPass(CREATE_PASS); \
2131 return Error::success(); \
2133#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2134 if (checkParametrizedPassName(Name, NAME)) { \
2135 auto Params = parsePassParameters(PARSER, Name, NAME); \
2137 return Params.takeError(); \
2138 MPM.addPass(CREATE_PASS(Params.get())); \
2139 return Error::success(); \
2141#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2142 if (Name == "require<" NAME ">") { \
2144 RequireAnalysisPass< \
2145 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2146 return Error::success(); \
2148 if (Name == "invalidate<" NAME ">") { \
2149 MPM.addPass(InvalidateAnalysisPass< \
2150 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2151 return Error::success(); \
2153#define CGSCC_PASS(NAME, CREATE_PASS) \
2154 if (Name == NAME) { \
2155 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2156 return Error::success(); \
2158#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2159 if (checkParametrizedPassName(Name, NAME)) { \
2160 auto Params = parsePassParameters(PARSER, Name, NAME); \
2162 return Params.takeError(); \
2164 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2165 return Error::success(); \
2167#define FUNCTION_PASS(NAME, CREATE_PASS) \
2168 if (Name == NAME) { \
2169 if constexpr (std::is_constructible_v< \
2170 std::remove_reference_t<decltype(CREATE_PASS)>, \
2171 const TargetMachine &>) { \
2173 return make_error<StringError>( \
2174 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2175 inconvertibleErrorCode()); \
2177 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2178 return Error::success(); \
2180#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2181 if (checkParametrizedPassName(Name, NAME)) { \
2182 auto Params = parsePassParameters(PARSER, Name, NAME); \
2184 return Params.takeError(); \
2185 auto CreatePass = CREATE_PASS; \
2186 if constexpr (std::is_constructible_v< \
2187 std::remove_reference_t<decltype(CreatePass( \
2189 const TargetMachine &, \
2190 std::remove_reference_t<decltype(Params.get())>>) { \
2192 return make_error<StringError>( \
2193 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2194 inconvertibleErrorCode()); \
2197 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2198 return Error::success(); \
2200#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2201 if (Name == NAME) { \
2202 MPM.addPass(createModuleToFunctionPassAdaptor( \
2203 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2204 return Error::success(); \
2206#define LOOP_PASS(NAME, CREATE_PASS) \
2207 if (Name == NAME) { \
2208 MPM.addPass(createModuleToFunctionPassAdaptor( \
2209 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2210 return Error::success(); \
2212#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2213 if (checkParametrizedPassName(Name, NAME)) { \
2214 auto Params = parsePassParameters(PARSER, Name, NAME); \
2216 return Params.takeError(); \
2217 MPM.addPass(createModuleToFunctionPassAdaptor( \
2218 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2219 return Error::success(); \
2221#include "PassRegistry.def"
2223 for (
auto &
C : ModulePipelineParsingCallbacks)
2224 if (
C(Name, MPM, InnerPipeline))
2227 formatv(
"unknown module pass '{}'", Name).str(),
2232 const PipelineElement &
E) {
2233 auto &
Name =
E.Name;
2234 auto &InnerPipeline =
E.InnerPipeline;
2237 if (!InnerPipeline.empty()) {
2238 if (Name ==
"cgscc") {
2240 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2243 CGPM.
addPass(std::move(NestedCGPM));
2248 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2252 std::move(FPM), Params->first, Params->second));
2257 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2264 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2265 if (
C(Name, CGPM, InnerPipeline))
2270 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2275#define CGSCC_PASS(NAME, CREATE_PASS) \
2276 if (Name == NAME) { \
2277 CGPM.addPass(CREATE_PASS); \
2278 return Error::success(); \
2280#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2281 if (checkParametrizedPassName(Name, NAME)) { \
2282 auto Params = parsePassParameters(PARSER, Name, NAME); \
2284 return Params.takeError(); \
2285 CGPM.addPass(CREATE_PASS(Params.get())); \
2286 return Error::success(); \
2288#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2289 if (Name == "require<" NAME ">") { \
2290 CGPM.addPass(RequireAnalysisPass< \
2291 std::remove_reference_t<decltype(CREATE_PASS)>, \
2292 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2293 CGSCCUpdateResult &>()); \
2294 return Error::success(); \
2296 if (Name == "invalidate<" NAME ">") { \
2297 CGPM.addPass(InvalidateAnalysisPass< \
2298 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2299 return Error::success(); \
2301#define FUNCTION_PASS(NAME, CREATE_PASS) \
2302 if (Name == NAME) { \
2303 if constexpr (std::is_constructible_v< \
2304 std::remove_reference_t<decltype(CREATE_PASS)>, \
2305 const TargetMachine &>) { \
2307 return make_error<StringError>( \
2308 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2309 inconvertibleErrorCode()); \
2311 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2312 return Error::success(); \
2314#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2315 if (checkParametrizedPassName(Name, NAME)) { \
2316 auto Params = parsePassParameters(PARSER, Name, NAME); \
2318 return Params.takeError(); \
2319 auto CreatePass = CREATE_PASS; \
2320 if constexpr (std::is_constructible_v< \
2321 std::remove_reference_t<decltype(CreatePass( \
2323 const TargetMachine &, \
2324 std::remove_reference_t<decltype(Params.get())>>) { \
2326 return make_error<StringError>( \
2327 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2328 inconvertibleErrorCode()); \
2331 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2332 return Error::success(); \
2334#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2335 if (Name == NAME) { \
2336 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2337 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2338 return Error::success(); \
2340#define LOOP_PASS(NAME, CREATE_PASS) \
2341 if (Name == NAME) { \
2342 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2343 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2344 return Error::success(); \
2346#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2347 if (checkParametrizedPassName(Name, NAME)) { \
2348 auto Params = parsePassParameters(PARSER, Name, NAME); \
2350 return Params.takeError(); \
2351 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2352 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2353 return Error::success(); \
2355#include "PassRegistry.def"
2357 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2358 if (
C(Name, CGPM, InnerPipeline))
2365 const PipelineElement &
E) {
2366 auto &
Name =
E.Name;
2367 auto &InnerPipeline =
E.InnerPipeline;
2370 if (!InnerPipeline.empty()) {
2371 if (Name ==
"function") {
2373 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2376 FPM.
addPass(std::move(NestedFPM));
2379 if (Name ==
"loop" || Name ==
"loop-mssa") {
2381 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2384 bool UseMemorySSA = (
Name ==
"loop-mssa");
2389 if (Name ==
"machine-function") {
2391 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2397 for (
auto &
C : FunctionPipelineParsingCallbacks)
2398 if (
C(Name, FPM, InnerPipeline))
2403 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2408#define FUNCTION_PASS(NAME, CREATE_PASS) \
2409 if (Name == NAME) { \
2410 if constexpr (std::is_constructible_v< \
2411 std::remove_reference_t<decltype(CREATE_PASS)>, \
2412 const TargetMachine &>) { \
2414 return make_error<StringError>( \
2415 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2416 inconvertibleErrorCode()); \
2418 FPM.addPass(CREATE_PASS); \
2419 return Error::success(); \
2421#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2422 if (checkParametrizedPassName(Name, NAME)) { \
2423 auto Params = parsePassParameters(PARSER, Name, NAME); \
2425 return Params.takeError(); \
2426 auto CreatePass = CREATE_PASS; \
2427 if constexpr (std::is_constructible_v< \
2428 std::remove_reference_t<decltype(CreatePass( \
2430 const TargetMachine &, \
2431 std::remove_reference_t<decltype(Params.get())>>) { \
2433 return make_error<StringError>( \
2434 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2435 inconvertibleErrorCode()); \
2438 FPM.addPass(CREATE_PASS(Params.get())); \
2439 return Error::success(); \
2441#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2442 if (Name == "require<" NAME ">") { \
2443 if constexpr (std::is_constructible_v< \
2444 std::remove_reference_t<decltype(CREATE_PASS)>, \
2445 const TargetMachine &>) { \
2447 return make_error<StringError>( \
2448 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2449 inconvertibleErrorCode()); \
2452 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2454 return Error::success(); \
2456 if (Name == "invalidate<" NAME ">") { \
2457 FPM.addPass(InvalidateAnalysisPass< \
2458 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2459 return Error::success(); \
2465#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2466 if (Name == NAME) { \
2467 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2468 return Error::success(); \
2470#define LOOP_PASS(NAME, CREATE_PASS) \
2471 if (Name == NAME) { \
2472 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2473 return Error::success(); \
2475#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2476 if (checkParametrizedPassName(Name, NAME)) { \
2477 auto Params = parsePassParameters(PARSER, Name, NAME); \
2479 return Params.takeError(); \
2481 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2482 return Error::success(); \
2484#include "PassRegistry.def"
2486 for (
auto &
C : FunctionPipelineParsingCallbacks)
2487 if (
C(Name, FPM, InnerPipeline))
2490 formatv(
"unknown function pass '{}'", Name).str(),
2495 const PipelineElement &
E) {
2496 StringRef
Name =
E.Name;
2497 auto &InnerPipeline =
E.InnerPipeline;
2500 if (!InnerPipeline.empty()) {
2501 if (Name ==
"loop") {
2503 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2506 LPM.addPass(std::move(NestedLPM));
2510 for (
auto &
C : LoopPipelineParsingCallbacks)
2511 if (
C(Name, LPM, InnerPipeline))
2516 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2521#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2522 if (Name == NAME) { \
2523 LPM.addPass(CREATE_PASS); \
2524 return Error::success(); \
2526#define LOOP_PASS(NAME, CREATE_PASS) \
2527 if (Name == NAME) { \
2528 LPM.addPass(CREATE_PASS); \
2529 return Error::success(); \
2531#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2532 if (checkParametrizedPassName(Name, NAME)) { \
2533 auto Params = parsePassParameters(PARSER, Name, NAME); \
2535 return Params.takeError(); \
2536 LPM.addPass(CREATE_PASS(Params.get())); \
2537 return Error::success(); \
2539#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2540 if (Name == "require<" NAME ">") { \
2541 LPM.addPass(RequireAnalysisPass< \
2542 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2543 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2545 return Error::success(); \
2547 if (Name == "invalidate<" NAME ">") { \
2548 LPM.addPass(InvalidateAnalysisPass< \
2549 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2550 return Error::success(); \
2552#include "PassRegistry.def"
2554 for (
auto &
C : LoopPipelineParsingCallbacks)
2555 if (
C(Name, LPM, InnerPipeline))
2562 const PipelineElement &
E) {
2563 StringRef
Name =
E.Name;
2565 if (!
E.InnerPipeline.empty()) {
2566 if (
E.Name ==
"machine-function") {
2568 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2570 MFPM.
addPass(std::move(NestedPM));
2577#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2578 if (Name == NAME) { \
2579 MFPM.addPass(CREATE_PASS); \
2580 return Error::success(); \
2582#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2583 if (Name == NAME) { \
2584 MFPM.addPass(CREATE_PASS); \
2585 return Error::success(); \
2587#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2589 if (checkParametrizedPassName(Name, NAME)) { \
2590 auto Params = parsePassParameters(PARSER, Name, NAME); \
2592 return Params.takeError(); \
2593 MFPM.addPass(CREATE_PASS(Params.get())); \
2594 return Error::success(); \
2596#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2597 if (Name == "require<" NAME ">") { \
2599 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2600 MachineFunction>()); \
2601 return Error::success(); \
2603 if (Name == "invalidate<" NAME ">") { \
2604 MFPM.addPass(InvalidateAnalysisPass< \
2605 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2606 return Error::success(); \
2608#include "llvm/Passes/MachinePassRegistry.def"
2610 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2611 if (
C(Name, MFPM,
E.InnerPipeline))
2614 formatv(
"unknown machine pass '{}'", Name).str(),
2619#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2620 if (Name == NAME) { \
2621 AA.registerModuleAnalysis< \
2622 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2625#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2626 if (Name == NAME) { \
2627 AA.registerFunctionAnalysis< \
2628 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2631#include "PassRegistry.def"
2633 for (
auto &
C : AAParsingCallbacks)
2639Error PassBuilder::parseMachinePassPipeline(
2641 for (
const auto &Element : Pipeline) {
2642 if (
auto Err = parseMachinePass(MFPM, Element))
2650 for (
const auto &Element : Pipeline) {
2651 if (
auto Err = parseLoopPass(LPM, Element))
2657Error PassBuilder::parseFunctionPassPipeline(
2659 for (
const auto &Element : Pipeline) {
2660 if (
auto Err = parseFunctionPass(FPM, Element))
2668 for (
const auto &Element : Pipeline) {
2669 if (
auto Err = parseCGSCCPass(CGPM, Element))
2701 for (
const auto &Element : Pipeline) {
2702 if (
auto Err = parseModulePass(MPM, Element))
2713 auto Pipeline = parsePipelineText(PipelineText);
2714 if (!Pipeline || Pipeline->empty())
2716 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2726 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2728 FunctionPipelineParsingCallbacks)) {
2729 Pipeline = {{
"function", std::move(*Pipeline)}};
2732 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2733 std::move(*Pipeline)}}}};
2734 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2736 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2737 std::move(*Pipeline)}}}};
2739 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2740 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2742 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2743 if (
C(MPM, *Pipeline))
2747 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2749 formatv(
"unknown {} name '{}'",
2750 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2756 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2764 auto Pipeline = parsePipelineText(PipelineText);
2765 if (!Pipeline || Pipeline->empty())
2767 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2773 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2778 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2787 auto Pipeline = parsePipelineText(PipelineText);
2788 if (!Pipeline || Pipeline->empty())
2790 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2796 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2801 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2809 auto Pipeline = parsePipelineText(PipelineText);
2810 if (!Pipeline || Pipeline->empty())
2812 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2815 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2823 auto Pipeline = parsePipelineText(PipelineText);
2824 if (!Pipeline || Pipeline->empty())
2826 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2829 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2838 if (PipelineText ==
"default") {
2843 while (!PipelineText.
empty()) {
2845 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2846 if (!parseAAPassName(
AA, Name))
2848 formatv(
"unknown alias analysis name '{}'", Name).str(),
2855std::optional<RegAllocFilterFunc>
2857 if (FilterName ==
"all")
2859 for (
auto &
C : RegClassFilterParsingCallbacks)
2860 if (
auto F =
C(FilterName))
2862 return std::nullopt;
2873 auto I = PassNames.
begin();
2874 auto End = PassNames.
end();
2881 OS <<
" " << Name <<
'<' << Params <<
">\n";
2888 OS <<
"Module passes:\n";
2889 static constexpr char ModulePassNames[] = {
"\0"
2890#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2891#include "PassRegistry.def"
2895 OS <<
"Module passes with params:\n";
2896 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2897#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2898 NAME "\0" PARAMS "\0"
2899#include "PassRegistry.def"
2903 OS <<
"Module analyses:\n";
2904 static constexpr char ModuleAnalysisNames[] = {
"\0"
2905#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2906#include "PassRegistry.def"
2910 OS <<
"Module alias analyses:\n";
2911 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2912#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2913#include "PassRegistry.def"
2917 OS <<
"CGSCC passes:\n";
2918 static constexpr char CGSCCPassNames[] = {
"\0"
2919#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2920#include "PassRegistry.def"
2924 OS <<
"CGSCC passes with params:\n";
2925 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2926#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2927 NAME "\0" PARAMS "\0"
2928#include "PassRegistry.def"
2932 OS <<
"CGSCC analyses:\n";
2933 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2934#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2935#include "PassRegistry.def"
2939 OS <<
"Function passes:\n";
2940 static constexpr char FunctionPassNames[] = {
"\0"
2941#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2942#include "PassRegistry.def"
2946 OS <<
"Function passes with params:\n";
2947 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2948#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2949 NAME "\0" PARAMS "\0"
2950#include "PassRegistry.def"
2954 OS <<
"Function analyses:\n";
2955 static constexpr char FunctionAnalysisNames[] = {
"\0"
2956#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2957#include "PassRegistry.def"
2961 OS <<
"Function alias analyses:\n";
2962 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2963#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2964#include "PassRegistry.def"
2968 OS <<
"LoopNest passes:\n";
2969 static constexpr char LoopNestPassNames[] = {
"\0"
2970#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2971#include "PassRegistry.def"
2975 OS <<
"Loop passes:\n";
2976 static constexpr char LoopPassNames[] = {
"\0"
2977#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2978#include "PassRegistry.def"
2982 OS <<
"Loop passes with params:\n";
2983 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2984#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2985 NAME "\0" PARAMS "\0"
2986#include "PassRegistry.def"
2990 OS <<
"Loop analyses:\n";
2991 static constexpr char LoopAnalysisNames[] = {
"\0"
2992#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2993#include "PassRegistry.def"
2997 OS <<
"Machine module passes (WIP):\n";
2998 static constexpr char MachineModulePassNames[] = {
"\0"
2999#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
3000#include "llvm/Passes/MachinePassRegistry.def"
3004 OS <<
"Machine function passes (WIP):\n";
3005 static constexpr char MachineFunctionPassNames[] = {
"\0"
3006#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3007#include "llvm/Passes/MachinePassRegistry.def"
3011 OS <<
"Machine function analyses (WIP):\n";
3012 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3013#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3014#include "llvm/Passes/MachinePassRegistry.def"
3022 TopLevelPipelineParsingCallbacks.push_back(
C);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...
This file implements a simple N^2 alias analysis accuracy evaluator.
Provides passes to inlining "always_inline" functions.
This is the interface for LLVM's primary stateless and local alias analysis.
This file contains the declaration of the BreakFalseDepsPass class, used to identify and avoid false ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Contains definition of the base CFIFixup pass.
This file provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
Provides analysis for continuously CSEing during GISel passes.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
Defines an IR pass for CodeGen Prepare.
This file contains the declaration of the MachineKCFI class, which is a Machine Pass that implements ...
#define LLVM_ATTRIBUTE_NOINLINE
LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inl...
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
Analysis that tracks defined/used subregister lanes across COPY instructions and instructions that ge...
This file provides the interface for a simple, fast CSE pass.
This file provides a pass which clones the current module and runs the provided pass pipeline on the ...
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Provides passes for computing function attributes based on interprocedural analyses.
This file provides the interface for the GCOV style profiler pass.
Provides analysis for querying information about KnownBits during GISel passes.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
This is the interface for a simple mod/ref and alias analysis over globals.
Defines an IR pass for the creation of hardware loops.
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder inte...
This file defines passes to print out IR in various granularities.
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file provides the interface for LLVM's Logical Scalar Replacement of Aggregates pass.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
Machine Check Debug Module
This file contains the declaration of the CheckDebugMachineModulePass class, used by the new pass man...
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
This pass performs merges of loads and stores on both sides of a.
This is the interface to build a ModuleSummaryIndex for a module.
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
This file provides the interface for LLVM's Global Value Numbering pass.
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static std::optional< int > parseDevirtPassName(StringRef Name)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameList(StringTable PassNames, raw_ostream &OS)
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static Expected< OptimizationLevel > parseOptLevelParam(StringRef S)
static std::optional< OptimizationLevel > parseOptLevel(StringRef S)
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static std::optional< std::pair< bool, bool > > parseFunctionPipelineName(StringRef Name)
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameListWithParams(StringTable PassNames, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static void setupOptionsForPipelineAlias(PipelineTuningOptions &PTO, OptimizationLevel L)
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
MachineFunction & getMF()
This analysis create MachineFunction for given Function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineFunctionProperties & getProperties() const
Get the function properties.
LLVM_ABI Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
This class provides access to building LLVM's passes.
LLVM_ABI void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
LLVM_ABI AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
LLVM_ABI Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
LLVM_ABI void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
LLVM_ABI std::optional< RegAllocFilterFunc > parseRegAllocFilter(StringRef RegAllocFilterName)
Parse RegAllocFilterName to get RegAllocFilterFunc.
LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
LLVM_ABI PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
LLVM_ABI void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
LLVM_ABI void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
static LLVM_ABI Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
LLVM_ABI void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
LLVM_ABI void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
Tunable parameters for passes in the default pipelines.
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
Check if the string is empty.
char front() const
Get the first character in the string.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
A table of densely packed, null-terminated strings indexed by offset.
constexpr Iterator begin() const
constexpr Iterator end() const
Primary interface to the complete machine description for the target machine.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
Interfaces for registering analysis passes, producing common pass manager configurations,...
Abstract Attribute helper functions.
@ C
The default llvm calling convention, compatible with C.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
@ BasicBlock
Various leaf nodes.
DXILDebugInfoMap run(Module &M)
DropTestKind
Specifies how to drop type tests.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
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