410 "Print string describing the pipeline (best-effort only).\n"
411 " - =text\tPrint a '-passes' compatible string describing the "
413 " - =tree\tPrint a tree-like structure describing the pipeline."));
417 std::optional<PrintPipelinePassesFormat> &Val) {
418 std::optional<PrintPipelinePassesFormat>
Format =
427 "'{0}' value invalid for print-pipeline-passes argument!", Arg));
441 for (
char C : Pipeline) {
449 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
479 return MFA ? &MFA->
getMF() :
nullptr;
485class TriggerVerifierErrorPass
491 auto *PtrTy = PointerType::getUnqual(
M.getContext());
493 GlobalValue::LinkageTypes::InternalLinkage,
494 "__bad_alias",
nullptr, &M);
514 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
519class RequireAllMachineFunctionPropertiesPass
527 static MachineFunctionProperties getRequiredProperties() {
528 return MachineFunctionProperties()
530 .setFailsVerification()
535 .setRegBankSelected()
537 .setTiedOpsRewritten()
538 .setTracksDebugUserValues()
539 .setTracksLiveness();
541 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
547 if (S ==
"Os" || S ==
"Oz")
549 Twine(
"The optimization level \"") + S +
550 "\" is no longer supported. Use O2 in conjunction with the " +
551 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
562 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
566 formatv(
"invalid optimization level '{}'", S).str(),
571 std::optional<PGOOptions> PGOOpt,
574 : TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
576 TM->registerPassBuilderCallbacks(*
this);
578 PIC->registerClassToPassNameCallback([
this, PIC]() {
582#define MODULE_PASS(NAME, CREATE_PASS) \
583 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
584#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
585 PIC->addClassToPassName(CLASS, NAME);
586#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
587 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
588#define FUNCTION_PASS(NAME, CREATE_PASS) \
589 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
590#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
591 PIC->addClassToPassName(CLASS, NAME);
592#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
593 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
594#define LOOPNEST_PASS(NAME, CREATE_PASS) \
595 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
596#define LOOP_PASS(NAME, CREATE_PASS) \
597 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
598#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
599 PIC->addClassToPassName(CLASS, NAME);
600#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
601 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
602#define CGSCC_PASS(NAME, CREATE_PASS) \
603 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
604#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
605 PIC->addClassToPassName(CLASS, NAME);
606#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
607 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
608#include "PassRegistry.def"
610#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
611 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
612#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
613 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
614#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
616 PIC->addClassToPassName(CLASS, NAME);
617#include "llvm/Passes/MachinePassRegistry.def"
625#define MODULE_CALLBACK(NAME, INVOKE) \
626 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
627 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
629 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
632 INVOKE(PM, L.get()); \
635#include "PassRegistry.def"
643#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
644 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
645 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
647 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
650 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
653#include "PassRegistry.def"
661#define FUNCTION_CALLBACK(NAME, INVOKE) \
662 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
663 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
665 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
668 INVOKE(PM, L.get()); \
671#include "PassRegistry.def"
679#define CGSCC_CALLBACK(NAME, INVOKE) \
680 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
681 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
683 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
686 INVOKE(PM, L.get()); \
689#include "PassRegistry.def"
697#define LOOP_CALLBACK(NAME, INVOKE) \
698 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
699 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
701 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
704 INVOKE(PM, L.get()); \
707#include "PassRegistry.def"
713#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
714 MAM.registerPass([&] { return CREATE_PASS; });
715#include "PassRegistry.def"
717 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
722#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
723 CGAM.registerPass([&] { return CREATE_PASS; });
724#include "PassRegistry.def"
726 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
736#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
737 if constexpr (std::is_constructible_v< \
738 std::remove_reference_t<decltype(CREATE_PASS)>, \
739 const TargetMachine &>) { \
741 FAM.registerPass([&] { return CREATE_PASS; }); \
743 FAM.registerPass([&] { return CREATE_PASS; }); \
745#include "PassRegistry.def"
747 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
754#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
755 MFAM.registerPass([&] { return CREATE_PASS; });
756#include "llvm/Passes/MachinePassRegistry.def"
758 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
763#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
764 LAM.registerPass([&] { return CREATE_PASS; });
765#include "PassRegistry.def"
767 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
771static std::optional<std::pair<bool, bool>>
773 std::pair<bool, bool> Params;
774 if (!Name.consume_front(
"function"))
778 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
780 while (!Name.empty()) {
781 auto [Front, Back] = Name.split(
';');
783 if (Front ==
"eager-inv")
785 else if (Front ==
"no-rerun")
786 Params.second =
true;
794 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
806 while (!Params.
empty()) {
808 std::tie(ParamName, Params) = Params.
split(
';');
810 if (ParamName == OptionName) {
827 while (!Params.
empty()) {
829 std::tie(ParamName, Params) = Params.
split(
';');
834 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
839 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
843 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
848 if (ParamName ==
"force-hardware-loops") {
850 }
else if (ParamName ==
"force-hardware-loop-phi") {
852 }
else if (ParamName ==
"force-nested-hardware-loop") {
854 }
else if (ParamName ==
"force-hardware-loop-guard") {
858 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
862 return HardwareLoopOpts;
874 "FunctionPropertiesStatisticsPass");
885 while (!Params.
empty()) {
887 std::tie(ParamName, Params) = Params.
split(
';');
888 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
890 UnrollOpts.
setOptLevel(OptLevel->getSpeedupLevel());
897 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
904 if (ParamName ==
"partial") {
906 }
else if (ParamName ==
"peeling") {
908 }
else if (ParamName ==
"profile-peeling") {
910 }
else if (ParamName ==
"runtime") {
912 }
else if (ParamName ==
"upperbound") {
916 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
925 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
945 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
954 "EntryExitInstrumenter");
959 "DropUnnecessaryAssumes");
968 "LowerMatrixIntrinsics");
973 while (!Params.
empty()) {
975 std::tie(ParamName, Params) = Params.
split(
';');
978 if (ParamName ==
"preserve-order")
980 else if (ParamName ==
"rename-all")
982 else if (ParamName ==
"fold-all")
984 else if (ParamName ==
"reorder-operands")
988 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
998 while (!Params.
empty()) {
1000 std::tie(ParamName, Params) = Params.
split(
';');
1002 if (ParamName ==
"kernel") {
1003 Result.CompileKernel =
true;
1004 }
else if (ParamName ==
"use-after-scope") {
1005 Result.UseAfterScope =
true;
1008 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1018 while (!Params.
empty()) {
1020 std::tie(ParamName, Params) = Params.
split(
';');
1022 if (ParamName ==
"recover") {
1024 }
else if (ParamName ==
"kernel") {
1025 Result.CompileKernel =
true;
1028 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1037parseDropTypeTestsPassOptions(
StringRef Params) {
1039 while (!Params.
empty()) {
1041 std::tie(ParamName, Params) = Params.
split(
';');
1043 if (ParamName ==
"all") {
1045 }
else if (ParamName ==
"assume") {
1049 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1058 while (!Params.
empty()) {
1060 std::tie(ParamName, Params) = Params.
split(
';');
1062 if (ParamName ==
"thinlto") {
1064 }
else if (ParamName ==
"emit-summary") {
1065 Result.EmitLTOSummary =
true;
1068 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1076parseLowerAllowCheckPassOptions(
StringRef Params) {
1078 while (!Params.
empty()) {
1080 std::tie(ParamName, Params) = Params.
split(
';');
1091 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1098 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1103 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1105 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1106 IndicesStr, CutoffStr)
1110 while (IndicesStr !=
"") {
1112 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1118 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1119 firstIndexStr, IndicesStr)
1126 if (index >=
Result.cutoffs.size())
1127 Result.cutoffs.resize(index + 1, 0);
1129 Result.cutoffs[index] = cutoff;
1131 }
else if (ParamName.
starts_with(
"runtime_check")) {
1133 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1137 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1139 ValueString, Params)
1143 Result.runtime_check = runtime_check;
1146 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1157 while (!Params.
empty()) {
1159 std::tie(ParamName, Params) = Params.
split(
';');
1161 if (ParamName ==
"recover") {
1163 }
else if (ParamName ==
"kernel") {
1168 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1173 }
else if (ParamName ==
"eager-checks") {
1174 Result.EagerChecks =
true;
1177 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1187 while (!Params.
empty()) {
1189 std::tie(ParamName, Params) = Params.
split(
';');
1196 formatv(
"invalid argument to AllocToken pass mode "
1203 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1213 while (!Params.
empty()) {
1215 std::tie(ParamName, Params) = Params.
split(
';');
1218 if (ParamName ==
"speculate-blocks") {
1220 }
else if (ParamName ==
"simplify-cond-branch") {
1222 }
else if (ParamName ==
"forward-switch-cond") {
1224 }
else if (ParamName ==
"switch-range-to-icmp") {
1226 }
else if (ParamName ==
"switch-to-arithmetic") {
1228 }
else if (ParamName ==
"switch-to-lookup") {
1230 }
else if (ParamName ==
"keep-loops") {
1232 }
else if (ParamName ==
"hoist-common-insts") {
1234 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1236 }
else if (ParamName ==
"sink-common-insts") {
1238 }
else if (ParamName ==
"speculate-unpredictables") {
1241 APInt BonusInstThreshold;
1244 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1252 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1263 Result.setVerifyFixpoint(
true);
1264 while (!Params.
empty()) {
1266 std::tie(ParamName, Params) = Params.
split(
';');
1269 if (ParamName ==
"verify-fixpoint") {
1272 APInt MaxIterations;
1275 formatv(
"invalid argument to InstCombine pass max-iterations "
1283 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1293 while (!Params.
empty()) {
1295 std::tie(ParamName, Params) = Params.
split(
';');
1298 if (ParamName ==
"interleave-forced-only") {
1300 }
else if (ParamName ==
"vectorize-forced-only") {
1304 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1312 std::pair<bool, bool>
Result = {
false,
true};
1313 while (!Params.
empty()) {
1315 std::tie(ParamName, Params) = Params.
split(
';');
1318 if (ParamName ==
"nontrivial") {
1320 }
else if (ParamName ==
"trivial") {
1324 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1333 while (!Params.
empty()) {
1335 std::tie(ParamName, Params) = Params.
split(
';');
1338 if (ParamName ==
"allowspeculation") {
1342 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1349struct LoopRotateOptions {
1350 bool EnableHeaderDuplication =
true;
1351 bool PrepareForLTO =
false;
1352 bool CheckExitCount =
false;
1356 LoopRotateOptions
Result;
1357 while (!Params.
empty()) {
1359 std::tie(ParamName, Params) = Params.
split(
';');
1362 if (ParamName ==
"header-duplication") {
1364 }
else if (ParamName ==
"prepare-for-lto") {
1366 }
else if (ParamName ==
"check-exit-count") {
1370 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1379 while (!Params.
empty()) {
1381 std::tie(ParamName, Params) = Params.
split(
';');
1384 if (ParamName ==
"split-footer-bb") {
1388 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1399 while (!Params.
empty()) {
1401 std::tie(ParamName, Params) = Params.
split(
';');
1404 if (ParamName ==
"scalar-pre") {
1406 }
else if (ParamName ==
"load-pre") {
1408 }
else if (ParamName ==
"split-backedge-load-pre") {
1410 }
else if (ParamName ==
"memdep") {
1414 }
else if (ParamName ==
"memoryssa") {
1420 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1429 while (!Params.
empty()) {
1431 std::tie(ParamName, Params) = Params.
split(
';');
1434 if (ParamName ==
"func-spec")
1438 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1446 while (!Params.
empty()) {
1448 std::tie(ParamName, Params) = Params.
split(
';');
1453 formatv(
"invalid argument to Scalarizer pass min-bits "
1464 if (ParamName ==
"load-store")
1466 else if (ParamName ==
"variable-insert-extract")
1470 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1480 bool SawCFGOption =
false;
1481 while (!Params.
empty()) {
1483 std::tie(ParamName, Params) = Params.
split(
';');
1485 if (ParamName ==
"modify-cfg") {
1490 SawCFGOption =
true;
1491 }
else if (ParamName ==
"preserve-cfg") {
1496 SawCFGOption =
true;
1497 }
else if (ParamName ==
"aggregate-to-vector") {
1498 Result.AggregateToVector =
true;
1501 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1502 "modify-cfg, or aggregate-to-vector)",
1512parseStackLifetimeOptions(
StringRef Params) {
1514 while (!Params.
empty()) {
1516 std::tie(ParamName, Params) = Params.
split(
';');
1518 if (ParamName ==
"may") {
1520 }
else if (ParamName ==
"must") {
1524 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1533 "DependenceAnalysisPrinter");
1538 "SeparateConstOffsetFromGEP");
1547parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1551 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1559 "MemorySSAPrinterPass");
1564 "SpeculativeExecutionPass");
1569 while (!Params.
empty()) {
1571 std::tie(ParamName, Params) = Params.
split(
';');
1577 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1585parseStructuralHashPrinterPassOptions(
StringRef Params) {
1588 if (Params ==
"detailed")
1590 if (Params ==
"call-target-ignored")
1593 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1599 "WinEHPreparePass");
1604 while (!Params.
empty()) {
1606 std::tie(ParamName, Params) = Params.
split(
';');
1609 if (ParamName ==
"group-by-use")
1611 else if (ParamName ==
"ignore-single-use")
1613 else if (ParamName ==
"merge-const")
1615 else if (ParamName ==
"merge-const-aggressive")
1617 else if (ParamName ==
"merge-external")
1622 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1626 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1635 while (!Params.
empty()) {
1637 std::tie(ParamName, Params) = Params.
split(
';');
1643 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1654 while (!Params.
empty()) {
1656 std::tie(ParamName, Params) = Params.
split(
';');
1659 std::optional<RegAllocFilterFunc>
Filter =
1663 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1672 if (ParamName ==
"no-clear-vregs") {
1678 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1685parseBoundsCheckingOptions(
StringRef Params) {
1687 while (!Params.
empty()) {
1689 std::tie(ParamName, Params) = Params.
split(
';');
1690 if (ParamName ==
"trap") {
1692 }
else if (ParamName ==
"rt") {
1698 }
else if (ParamName ==
"rt-abort") {
1704 }
else if (ParamName ==
"min-rt") {
1710 }
else if (ParamName ==
"min-rt-abort") {
1716 }
else if (ParamName ==
"merge") {
1718 }
else if (ParamName ==
"handler-preserve-all-regs") {
1720 Options.Rt->HandlerPreserveAllRegs =
true;
1724 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1730 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1747 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1749 Param.str().c_str());
1752 if (!
Level.has_value())
1754 "invalid optimization level for expand-ir-insts pass: %s",
1755 Digit.str().c_str());
1762 if (Params.
empty() || Params ==
"all")
1763 return RAGreedyPass::Options();
1767 return RAGreedyPass::Options{*
Filter, Params};
1770 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1776 "MachineSinkingPass");
1780 bool AllowTailMerge =
true;
1781 if (!Params.
empty()) {
1783 if (Params !=
"tail-merge")
1785 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1789 return AllowTailMerge;
1793 bool ClearVirtRegs =
true;
1794 if (!Params.
empty()) {
1796 if (Params !=
"clear-vregs")
1798 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1801 return ClearVirtRegs;
1804struct FatLTOOptions {
1805 OptimizationLevel OptLevel;
1806 bool ThinLTO =
false;
1807 bool EmitSummary =
false;
1812 bool HaveOptLevel =
false;
1813 while (!Params.
empty()) {
1815 std::tie(ParamName, Params) = Params.
split(
';');
1817 if (ParamName ==
"thinlto") {
1819 }
else if (ParamName ==
"emit-summary") {
1820 Result.EmitSummary =
true;
1821 }
else if (std::optional<OptimizationLevel> OptLevel =
1823 Result.OptLevel = *OptLevel;
1824 HaveOptLevel =
true;
1827 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1834 "missing optimization level for fatlto-pre-link pipeline",
1849template <
typename PassManagerT,
typename CallbacksT>
1851 if (!Callbacks.empty()) {
1852 PassManagerT DummyPM;
1853 for (
auto &CB : Callbacks)
1854 if (CB(Name, DummyPM, {}))
1860template <
typename CallbacksT>
1862 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1865 if (Name ==
"module")
1867 if (Name ==
"cgscc")
1869 if (NameNoBracket ==
"function")
1871 if (Name ==
"coro-cond")
1874#define MODULE_PASS(NAME, CREATE_PASS) \
1877#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1878 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1880#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1881 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1883#include "PassRegistry.def"
1888template <
typename CallbacksT>
1891 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1892 if (Name ==
"cgscc")
1894 if (NameNoBracket ==
"function")
1901#define CGSCC_PASS(NAME, CREATE_PASS) \
1904#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1905 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1907#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1908 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1910#include "PassRegistry.def"
1915template <
typename CallbacksT>
1918 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1919 if (NameNoBracket ==
"function")
1921 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1924#define FUNCTION_PASS(NAME, CREATE_PASS) \
1927#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1928 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1930#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1931 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1933#include "PassRegistry.def"
1938template <
typename CallbacksT>
1941 if (Name ==
"machine-function")
1944#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1947#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1949 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1952#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1953 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1956#include "llvm/Passes/MachinePassRegistry.def"
1961template <
typename CallbacksT>
1963 bool &UseMemorySSA) {
1964 UseMemorySSA =
false;
1967 UseMemorySSA =
true;
1971#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1974#include "PassRegistry.def"
1979template <
typename CallbacksT>
1981 bool &UseMemorySSA) {
1982 UseMemorySSA =
false;
1985 UseMemorySSA =
true;
1989#define LOOP_PASS(NAME, CREATE_PASS) \
1992#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1993 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1995#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1996 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1998#include "PassRegistry.def"
2003std::optional<std::vector<PassBuilder::PipelineElement>>
2005 std::vector<PipelineElement> ResultPipeline;
2010 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2011 size_t Pos =
Text.find_first_of(
",()");
2012 Pipeline.push_back({
Text.substr(0, Pos), {}});
2015 if (Pos ==
Text.npos)
2018 char Sep =
Text[Pos];
2026 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2030 assert(Sep ==
')' &&
"Bogus separator!");
2035 if (PipelineStack.
size() == 1)
2036 return std::nullopt;
2039 }
while (
Text.consume_front(
")"));
2047 if (!
Text.consume_front(
","))
2048 return std::nullopt;
2051 if (PipelineStack.
size() > 1)
2053 return std::nullopt;
2055 assert(PipelineStack.
back() == &ResultPipeline &&
2056 "Wrong pipeline at the bottom of the stack!");
2057 return {std::move(ResultPipeline)};
2067 const PipelineElement &
E) {
2068 auto &
Name =
E.Name;
2069 auto &InnerPipeline =
E.InnerPipeline;
2072 if (!InnerPipeline.empty()) {
2073 if (Name ==
"module") {
2075 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2077 MPM.
addPass(std::move(NestedMPM));
2080 if (Name ==
"coro-cond") {
2082 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2084 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2087 if (Name ==
"cgscc") {
2089 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2097 "cannot have a no-rerun module to function adaptor",
2100 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2107 for (
auto &
C : ModulePipelineParsingCallbacks)
2108 if (
C(Name, MPM, InnerPipeline))
2113 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2119#define MODULE_PASS(NAME, CREATE_PASS) \
2120 if (Name == NAME) { \
2121 MPM.addPass(CREATE_PASS); \
2122 return Error::success(); \
2124#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2125 if (checkParametrizedPassName(Name, NAME)) { \
2126 auto Params = parsePassParameters(PARSER, Name, NAME); \
2128 return Params.takeError(); \
2129 MPM.addPass(CREATE_PASS(Params.get())); \
2130 return Error::success(); \
2132#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2133 if (Name == "require<" NAME ">") { \
2135 RequireAnalysisPass< \
2136 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2137 return Error::success(); \
2139 if (Name == "invalidate<" NAME ">") { \
2140 MPM.addPass(InvalidateAnalysisPass< \
2141 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2142 return Error::success(); \
2144#define CGSCC_PASS(NAME, CREATE_PASS) \
2145 if (Name == NAME) { \
2146 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2147 return Error::success(); \
2149#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2150 if (checkParametrizedPassName(Name, NAME)) { \
2151 auto Params = parsePassParameters(PARSER, Name, NAME); \
2153 return Params.takeError(); \
2155 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2156 return Error::success(); \
2158#define FUNCTION_PASS(NAME, CREATE_PASS) \
2159 if (Name == NAME) { \
2160 if constexpr (std::is_constructible_v< \
2161 std::remove_reference_t<decltype(CREATE_PASS)>, \
2162 const TargetMachine &>) { \
2164 return make_error<StringError>( \
2165 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2166 inconvertibleErrorCode()); \
2168 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2169 return Error::success(); \
2171#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2172 if (checkParametrizedPassName(Name, NAME)) { \
2173 auto Params = parsePassParameters(PARSER, Name, NAME); \
2175 return Params.takeError(); \
2176 auto CreatePass = CREATE_PASS; \
2177 if constexpr (std::is_constructible_v< \
2178 std::remove_reference_t<decltype(CreatePass( \
2180 const TargetMachine &, \
2181 std::remove_reference_t<decltype(Params.get())>>) { \
2183 return make_error<StringError>( \
2184 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2185 inconvertibleErrorCode()); \
2188 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2189 return Error::success(); \
2191#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2192 if (Name == NAME) { \
2193 MPM.addPass(createModuleToFunctionPassAdaptor( \
2194 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2195 return Error::success(); \
2197#define LOOP_PASS(NAME, CREATE_PASS) \
2198 if (Name == NAME) { \
2199 MPM.addPass(createModuleToFunctionPassAdaptor( \
2200 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2201 return Error::success(); \
2203#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2204 if (checkParametrizedPassName(Name, NAME)) { \
2205 auto Params = parsePassParameters(PARSER, Name, NAME); \
2207 return Params.takeError(); \
2208 MPM.addPass(createModuleToFunctionPassAdaptor( \
2209 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2210 return Error::success(); \
2212#include "PassRegistry.def"
2214 for (
auto &
C : ModulePipelineParsingCallbacks)
2215 if (
C(Name, MPM, InnerPipeline))
2218 formatv(
"unknown module pass '{}'", Name).str(),
2223 const PipelineElement &
E) {
2224 auto &
Name =
E.Name;
2225 auto &InnerPipeline =
E.InnerPipeline;
2228 if (!InnerPipeline.empty()) {
2229 if (Name ==
"cgscc") {
2231 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2234 CGPM.
addPass(std::move(NestedCGPM));
2239 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2243 std::move(FPM), Params->first, Params->second));
2248 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2255 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2256 if (
C(Name, CGPM, InnerPipeline))
2261 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2266#define CGSCC_PASS(NAME, CREATE_PASS) \
2267 if (Name == NAME) { \
2268 CGPM.addPass(CREATE_PASS); \
2269 return Error::success(); \
2271#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2272 if (checkParametrizedPassName(Name, NAME)) { \
2273 auto Params = parsePassParameters(PARSER, Name, NAME); \
2275 return Params.takeError(); \
2276 CGPM.addPass(CREATE_PASS(Params.get())); \
2277 return Error::success(); \
2279#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2280 if (Name == "require<" NAME ">") { \
2281 CGPM.addPass(RequireAnalysisPass< \
2282 std::remove_reference_t<decltype(CREATE_PASS)>, \
2283 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2284 CGSCCUpdateResult &>()); \
2285 return Error::success(); \
2287 if (Name == "invalidate<" NAME ">") { \
2288 CGPM.addPass(InvalidateAnalysisPass< \
2289 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2290 return Error::success(); \
2292#define FUNCTION_PASS(NAME, CREATE_PASS) \
2293 if (Name == NAME) { \
2294 if constexpr (std::is_constructible_v< \
2295 std::remove_reference_t<decltype(CREATE_PASS)>, \
2296 const TargetMachine &>) { \
2298 return make_error<StringError>( \
2299 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2300 inconvertibleErrorCode()); \
2302 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2303 return Error::success(); \
2305#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2306 if (checkParametrizedPassName(Name, NAME)) { \
2307 auto Params = parsePassParameters(PARSER, Name, NAME); \
2309 return Params.takeError(); \
2310 auto CreatePass = CREATE_PASS; \
2311 if constexpr (std::is_constructible_v< \
2312 std::remove_reference_t<decltype(CreatePass( \
2314 const TargetMachine &, \
2315 std::remove_reference_t<decltype(Params.get())>>) { \
2317 return make_error<StringError>( \
2318 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2319 inconvertibleErrorCode()); \
2322 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2323 return Error::success(); \
2325#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2326 if (Name == NAME) { \
2327 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2328 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2329 return Error::success(); \
2331#define LOOP_PASS(NAME, CREATE_PASS) \
2332 if (Name == NAME) { \
2333 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2334 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2335 return Error::success(); \
2337#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2338 if (checkParametrizedPassName(Name, NAME)) { \
2339 auto Params = parsePassParameters(PARSER, Name, NAME); \
2341 return Params.takeError(); \
2342 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2343 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2344 return Error::success(); \
2346#include "PassRegistry.def"
2348 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2349 if (
C(Name, CGPM, InnerPipeline))
2356 const PipelineElement &
E) {
2357 auto &
Name =
E.Name;
2358 auto &InnerPipeline =
E.InnerPipeline;
2361 if (!InnerPipeline.empty()) {
2362 if (Name ==
"function") {
2364 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2367 FPM.
addPass(std::move(NestedFPM));
2370 if (Name ==
"loop" || Name ==
"loop-mssa") {
2372 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2375 bool UseMemorySSA = (
Name ==
"loop-mssa");
2380 if (Name ==
"machine-function") {
2382 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2388 for (
auto &
C : FunctionPipelineParsingCallbacks)
2389 if (
C(Name, FPM, InnerPipeline))
2394 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2399#define FUNCTION_PASS(NAME, CREATE_PASS) \
2400 if (Name == NAME) { \
2401 if constexpr (std::is_constructible_v< \
2402 std::remove_reference_t<decltype(CREATE_PASS)>, \
2403 const TargetMachine &>) { \
2405 return make_error<StringError>( \
2406 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2407 inconvertibleErrorCode()); \
2409 FPM.addPass(CREATE_PASS); \
2410 return Error::success(); \
2412#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2413 if (checkParametrizedPassName(Name, NAME)) { \
2414 auto Params = parsePassParameters(PARSER, Name, NAME); \
2416 return Params.takeError(); \
2417 auto CreatePass = CREATE_PASS; \
2418 if constexpr (std::is_constructible_v< \
2419 std::remove_reference_t<decltype(CreatePass( \
2421 const TargetMachine &, \
2422 std::remove_reference_t<decltype(Params.get())>>) { \
2424 return make_error<StringError>( \
2425 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2426 inconvertibleErrorCode()); \
2429 FPM.addPass(CREATE_PASS(Params.get())); \
2430 return Error::success(); \
2432#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2433 if (Name == "require<" NAME ">") { \
2434 if constexpr (std::is_constructible_v< \
2435 std::remove_reference_t<decltype(CREATE_PASS)>, \
2436 const TargetMachine &>) { \
2438 return make_error<StringError>( \
2439 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2440 inconvertibleErrorCode()); \
2443 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2445 return Error::success(); \
2447 if (Name == "invalidate<" NAME ">") { \
2448 FPM.addPass(InvalidateAnalysisPass< \
2449 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2450 return Error::success(); \
2456#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2457 if (Name == NAME) { \
2458 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2459 return Error::success(); \
2461#define LOOP_PASS(NAME, CREATE_PASS) \
2462 if (Name == NAME) { \
2463 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2464 return Error::success(); \
2466#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2467 if (checkParametrizedPassName(Name, NAME)) { \
2468 auto Params = parsePassParameters(PARSER, Name, NAME); \
2470 return Params.takeError(); \
2472 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2473 return Error::success(); \
2475#include "PassRegistry.def"
2477 for (
auto &
C : FunctionPipelineParsingCallbacks)
2478 if (
C(Name, FPM, InnerPipeline))
2481 formatv(
"unknown function pass '{}'", Name).str(),
2486 const PipelineElement &
E) {
2487 StringRef
Name =
E.Name;
2488 auto &InnerPipeline =
E.InnerPipeline;
2491 if (!InnerPipeline.empty()) {
2492 if (Name ==
"loop") {
2494 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2497 LPM.addPass(std::move(NestedLPM));
2501 for (
auto &
C : LoopPipelineParsingCallbacks)
2502 if (
C(Name, LPM, InnerPipeline))
2507 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2512#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2513 if (Name == NAME) { \
2514 LPM.addPass(CREATE_PASS); \
2515 return Error::success(); \
2517#define LOOP_PASS(NAME, CREATE_PASS) \
2518 if (Name == NAME) { \
2519 LPM.addPass(CREATE_PASS); \
2520 return Error::success(); \
2522#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2523 if (checkParametrizedPassName(Name, NAME)) { \
2524 auto Params = parsePassParameters(PARSER, Name, NAME); \
2526 return Params.takeError(); \
2527 LPM.addPass(CREATE_PASS(Params.get())); \
2528 return Error::success(); \
2530#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2531 if (Name == "require<" NAME ">") { \
2532 LPM.addPass(RequireAnalysisPass< \
2533 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2534 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2536 return Error::success(); \
2538 if (Name == "invalidate<" NAME ">") { \
2539 LPM.addPass(InvalidateAnalysisPass< \
2540 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2541 return Error::success(); \
2543#include "PassRegistry.def"
2545 for (
auto &
C : LoopPipelineParsingCallbacks)
2546 if (
C(Name, LPM, InnerPipeline))
2553 const PipelineElement &
E) {
2554 StringRef
Name =
E.Name;
2556 if (!
E.InnerPipeline.empty()) {
2557 if (
E.Name ==
"machine-function") {
2559 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2561 MFPM.
addPass(std::move(NestedPM));
2568#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2569 if (Name == NAME) { \
2570 MFPM.addPass(CREATE_PASS); \
2571 return Error::success(); \
2573#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2574 if (Name == NAME) { \
2575 MFPM.addPass(CREATE_PASS); \
2576 return Error::success(); \
2578#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2580 if (checkParametrizedPassName(Name, NAME)) { \
2581 auto Params = parsePassParameters(PARSER, Name, NAME); \
2583 return Params.takeError(); \
2584 MFPM.addPass(CREATE_PASS(Params.get())); \
2585 return Error::success(); \
2587#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2588 if (Name == "require<" NAME ">") { \
2590 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2591 MachineFunction>()); \
2592 return Error::success(); \
2594 if (Name == "invalidate<" NAME ">") { \
2595 MFPM.addPass(InvalidateAnalysisPass< \
2596 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2597 return Error::success(); \
2599#include "llvm/Passes/MachinePassRegistry.def"
2601 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2602 if (
C(Name, MFPM,
E.InnerPipeline))
2605 formatv(
"unknown machine pass '{}'", Name).str(),
2610#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2611 if (Name == NAME) { \
2612 AA.registerModuleAnalysis< \
2613 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2616#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2617 if (Name == NAME) { \
2618 AA.registerFunctionAnalysis< \
2619 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2622#include "PassRegistry.def"
2624 for (
auto &
C : AAParsingCallbacks)
2630Error PassBuilder::parseMachinePassPipeline(
2632 for (
const auto &Element : Pipeline) {
2633 if (
auto Err = parseMachinePass(MFPM, Element))
2641 for (
const auto &Element : Pipeline) {
2642 if (
auto Err = parseLoopPass(LPM, Element))
2648Error PassBuilder::parseFunctionPassPipeline(
2650 for (
const auto &Element : Pipeline) {
2651 if (
auto Err = parseFunctionPass(FPM, Element))
2659 for (
const auto &Element : Pipeline) {
2660 if (
auto Err = parseCGSCCPass(CGPM, Element))
2692 for (
const auto &Element : Pipeline) {
2693 if (
auto Err = parseModulePass(MPM, Element))
2704 auto Pipeline = parsePipelineText(PipelineText);
2705 if (!Pipeline || Pipeline->empty())
2707 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2717 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2719 FunctionPipelineParsingCallbacks)) {
2720 Pipeline = {{
"function", std::move(*Pipeline)}};
2723 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2724 std::move(*Pipeline)}}}};
2725 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2727 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2728 std::move(*Pipeline)}}}};
2730 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2731 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2733 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2734 if (
C(MPM, *Pipeline))
2738 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2740 formatv(
"unknown {} name '{}'",
2741 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2747 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2755 auto Pipeline = parsePipelineText(PipelineText);
2756 if (!Pipeline || Pipeline->empty())
2758 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2764 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2769 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2778 auto Pipeline = parsePipelineText(PipelineText);
2779 if (!Pipeline || Pipeline->empty())
2781 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2787 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2792 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2800 auto Pipeline = parsePipelineText(PipelineText);
2801 if (!Pipeline || Pipeline->empty())
2803 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2806 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2814 auto Pipeline = parsePipelineText(PipelineText);
2815 if (!Pipeline || Pipeline->empty())
2817 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2820 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2829 if (PipelineText ==
"default") {
2834 while (!PipelineText.
empty()) {
2836 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2837 if (!parseAAPassName(
AA, Name))
2839 formatv(
"unknown alias analysis name '{}'", Name).str(),
2846std::optional<RegAllocFilterFunc>
2848 if (FilterName ==
"all")
2850 for (
auto &
C : RegClassFilterParsingCallbacks)
2851 if (
auto F =
C(FilterName))
2853 return std::nullopt;
2864 auto I = PassNames.
begin();
2865 auto End = PassNames.
end();
2873 OS <<
" " << Name <<
'<' << Params <<
">\n";
2880 OS <<
"Module passes:\n";
2881 static constexpr char ModulePassNames[] = {
"\0"
2882#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2883#include "PassRegistry.def"
2887 OS <<
"Module passes with params:\n";
2888 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2889#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2890 NAME "\0" PARAMS "\0"
2891#include "PassRegistry.def"
2895 OS <<
"Module analyses:\n";
2896 static constexpr char ModuleAnalysisNames[] = {
"\0"
2897#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2898#include "PassRegistry.def"
2902 OS <<
"Module alias analyses:\n";
2903 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2904#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2905#include "PassRegistry.def"
2909 OS <<
"CGSCC passes:\n";
2910 static constexpr char CGSCCPassNames[] = {
"\0"
2911#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2912#include "PassRegistry.def"
2916 OS <<
"CGSCC passes with params:\n";
2917 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2918#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2919 NAME "\0" PARAMS "\0"
2920#include "PassRegistry.def"
2924 OS <<
"CGSCC analyses:\n";
2925 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2926#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2927#include "PassRegistry.def"
2931 OS <<
"Function passes:\n";
2932 static constexpr char FunctionPassNames[] = {
"\0"
2933#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2934#include "PassRegistry.def"
2938 OS <<
"Function passes with params:\n";
2939 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2940#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2941 NAME "\0" PARAMS "\0"
2942#include "PassRegistry.def"
2946 OS <<
"Function analyses:\n";
2947 static constexpr char FunctionAnalysisNames[] = {
"\0"
2948#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2949#include "PassRegistry.def"
2953 OS <<
"Function alias analyses:\n";
2954 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2955#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2956#include "PassRegistry.def"
2960 OS <<
"LoopNest passes:\n";
2961 static constexpr char LoopNestPassNames[] = {
"\0"
2962#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2963#include "PassRegistry.def"
2967 OS <<
"Loop passes:\n";
2968 static constexpr char LoopPassNames[] = {
"\0"
2969#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2970#include "PassRegistry.def"
2974 OS <<
"Loop passes with params:\n";
2975 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2976#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2977 NAME "\0" PARAMS "\0"
2978#include "PassRegistry.def"
2982 OS <<
"Loop analyses:\n";
2983 static constexpr char LoopAnalysisNames[] = {
"\0"
2984#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2985#include "PassRegistry.def"
2989 OS <<
"Machine module passes (WIP):\n";
2990 static constexpr char MachineModulePassNames[] = {
"\0"
2991#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2992#include "llvm/Passes/MachinePassRegistry.def"
2996 OS <<
"Machine function passes (WIP):\n";
2997 static constexpr char MachineFunctionPassNames[] = {
"\0"
2998#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2999#include "llvm/Passes/MachinePassRegistry.def"
3003 OS <<
"Machine function analyses (WIP):\n";
3004 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3005#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3006#include "llvm/Passes/MachinePassRegistry.def"
3014 TopLevelPipelineParsingCallbacks.push_back(
C);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...
This file implements a simple N^2 alias analysis accuracy evaluator.
Provides passes to inlining "always_inline" functions.
This is the interface for LLVM's primary stateless and local alias analysis.
This file contains the declaration of the BreakFalseDepsPass class, used to identify and avoid false ...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Contains definition of the base CFIFixup pass.
This file provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
Provides analysis for continuously CSEing during GISel passes.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
Defines an IR pass for CodeGen Prepare.
This file contains the declaration of the MachineKCFI class, which is a Machine Pass that implements ...
#define LLVM_ATTRIBUTE_NOINLINE
LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inl...
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
Analysis that tracks defined/used subregister lanes across COPY instructions and instructions that ge...
This file provides the interface for a simple, fast CSE pass.
This file provides a pass which clones the current module and runs the provided pass pipeline on the ...
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Provides passes for computing function attributes based on interprocedural analyses.
This file provides the interface for the GCOV style profiler pass.
Provides analysis for querying information about KnownBits during GISel passes.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
This is the interface for a simple mod/ref and alias analysis over globals.
Defines an IR pass for the creation of hardware loops.
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder inte...
This file defines passes to print out IR in various granularities.
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
Machine Check Debug Module
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
This pass performs merges of loads and stores on both sides of a.
This is the interface to build a ModuleSummaryIndex for a module.
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
This file provides the interface for LLVM's Global Value Numbering pass.
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static std::optional< int > parseDevirtPassName(StringRef Name)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameList(StringTable PassNames, raw_ostream &OS)
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static Expected< OptimizationLevel > parseOptLevelParam(StringRef S)
static std::optional< OptimizationLevel > parseOptLevel(StringRef S)
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static std::optional< std::pair< bool, bool > > parseFunctionPipelineName(StringRef Name)
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameListWithParams(StringTable PassNames, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static void setupOptionsForPipelineAlias(PipelineTuningOptions &PTO, OptimizationLevel L)
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
MachineFunction & getMF()
This analysis create MachineFunction for given Function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineFunctionProperties & getProperties() const
Get the function properties.
LLVM_ABI Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
static LLVM_ABI const OptimizationLevel O3
Optimize for fast execution as much as possible.
static LLVM_ABI const OptimizationLevel O0
Disable as many optimizations as possible.
static LLVM_ABI const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
static LLVM_ABI const OptimizationLevel O1
Optimize quickly without destroying debuggability.
This class provides access to building LLVM's passes.
LLVM_ABI void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
LLVM_ABI AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
LLVM_ABI Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
LLVM_ABI void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
LLVM_ABI std::optional< RegAllocFilterFunc > parseRegAllocFilter(StringRef RegAllocFilterName)
Parse RegAllocFilterName to get RegAllocFilterFunc.
LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
LLVM_ABI PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
LLVM_ABI void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
LLVM_ABI void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
static LLVM_ABI Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
LLVM_ABI void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
LLVM_ABI void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
Tunable parameters for passes in the default pipelines.
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
Check if the string is empty.
char front() const
Get the first character in the string.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
A table of densely packed, null-terminated strings indexed by offset.
constexpr Iterator begin() const
constexpr Iterator end() const
Primary interface to the complete machine description for the target machine.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
Interfaces for registering analysis passes, producing common pass manager configurations,...
Abstract Attribute helper functions.
@ C
The default llvm calling convention, compatible with C.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
@ BasicBlock
Various leaf nodes.
DXILDebugInfoMap run(Module &M)
DropTestKind
Specifies how to drop type tests.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI cl::opt< std::optional< PrintPipelinePassesFormat >, false, PrintPipelinePassesFormatParser > PrintPipelinePasses
Common option used by multiple tools to print pipeline passes.
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
DevirtSCCRepeatedPass createDevirtSCCRepeatedPass(CGSCCPassT &&Pass, int MaxIterations)
A function to deduce a function pass type and wrap it in the templated adaptor.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
LLVM_ABI std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
InnerAnalysisManagerProxy< LoopAnalysisManager, Function > LoopAnalysisManagerFunctionProxy
A proxy from a LoopAnalysisManager to a Function.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
PassManager< LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, CGSCCUpdateResult & > CGSCCPassManager
The CGSCC pass manager.
AnalysisManager< LazyCallGraph::SCC, LazyCallGraph & > CGSCCAnalysisManager
The CGSCC analysis manager.
AnalysisManager< Loop, LoopStandardAnalysisResults & > LoopAnalysisManager
The loop analysis manager.
PassManager< Loop, LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater & > LoopPassManager
The Loop pass manager.
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function pass type and wrap it in the templated adaptor.
auto formatv(bool Validate, const char *Fmt, Ts &&...Vals)
FunctionToLoopPassAdaptor createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
CGSCCToFunctionPassAdaptor createCGSCCToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false, bool NoRerun=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
FunctionToMachineFunctionPassAdaptor createFunctionToMachineFunctionPassAdaptor(MachineFunctionPassT &&Pass)
PassManager< Module > ModulePassManager
Convenience typedef for a pass manager over modules.
FunctionAddr VTableAddr Count
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
InnerAnalysisManagerProxy< CGSCCAnalysisManager, Module > CGSCCAnalysisManagerModuleProxy
A proxy from a CGSCCAnalysisManager to a Module.
PassManager< Function > FunctionPassManager
Convenience typedef for a pass manager over functions.
MFPropsModifier(PassT &P, MachineFunction &MF) -> MFPropsModifier< PassT >
LLVM_ABI void printFormattedPipelinePasses(raw_ostream &OS, StringRef Pipeline, PrintPipelinePassesFormat Format=PrintPipelinePassesFormat::Text)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
PassManager< MachineFunction > MachineFunctionPassManager
Convenience typedef for a pass manager over functions.
LLVM_ABI bool applyDebugifyMetadataToMachineFunction(DIBuilder &DIB, Function &F, llvm::function_ref< MachineFunction *(Function &)> GetMF)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
LLVM_ABI std::optional< AllocTokenMode > getAllocTokenModeFromString(StringRef Name)
Returns the AllocTokenMode from its canonical string name; if an invalid name was provided returns nu...
PrintPipelinePassesFormat
@ Detailed
Hash with opcode only.
@ CallTargetIgnored
Hash with opcode and operands.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
LLVM_ABI void reportFatalUsageError(Error Err)
Report a fatal error that does not indicate a bug in LLVM.
Implement std::hash so that hash_code can be used in STL containers.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A set of parameters to control various transforms performed by GVN pass.
HardwareLoopOptions & setForceNested(bool Force)
HardwareLoopOptions & setDecrement(unsigned Count)
HardwareLoopOptions & setForceGuard(bool Force)
HardwareLoopOptions & setForce(bool Force)
HardwareLoopOptions & setCounterBitwidth(unsigned Width)
HardwareLoopOptions & setForcePhi(bool Force)
A set of parameters to control various transforms performed by IPSCCP pass.
A set of parameters used to control various transforms performed by the LoopUnroll pass.
LoopUnrollOptions & setPeeling(bool Peeling)
Enables or disables loop peeling.
LoopUnrollOptions & setOptLevel(int O)
LoopUnrollOptions & setPartial(bool Partial)
Enables or disables partial unrolling.
LoopUnrollOptions & setFullUnrollMaxCount(unsigned O)
LoopUnrollOptions & setUpperBound(bool UpperBound)
Enables or disables the use of trip count upper bound in loop unrolling.
LoopUnrollOptions & setRuntime(bool Runtime)
Enables or disables unrolling of loops with runtime trip count.
LoopUnrollOptions & setProfileBasedPeeling(int O)
LoopVectorizeOptions & setVectorizeOnlyWhenForced(bool Value)
LoopVectorizeOptions & setInterleaveOnlyWhenForced(bool Value)
A CRTP mix-in for passes that can be skipped.
RegAllocFilterFunc Filter