432std::optional<PrintPipelinePassesFormat>
434 return Opts.print_pipeline_passes;
445 for (
char C : Pipeline) {
453 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
483 return MFA ? &MFA->
getMF() :
nullptr;
489class TriggerVerifierErrorPass
495 auto *PtrTy = PointerType::getUnqual(
M.getContext());
497 GlobalValue::LinkageTypes::InternalLinkage,
498 "__bad_alias",
nullptr, &M);
518 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
523class RequireAllMachineFunctionPropertiesPass
531 static MachineFunctionProperties getRequiredProperties() {
532 return MachineFunctionProperties()
534 .setFailsVerification()
539 .setRegBankSelected()
541 .setTiedOpsRewritten()
542 .setTracksDebugUserValues()
543 .setTracksLiveness();
545 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
551 if (S ==
"Os" || S ==
"Oz")
553 Twine(
"The optimization level \"") + S +
554 "\" is no longer supported. Use O2 in conjunction with the " +
555 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
566 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
570 formatv(
"invalid optimization level '{}'", S).str(),
575 std::optional<PipelineTuningOptions> PTO,
576 std::optional<PGOOptions> PGOOpt,
581 .resolve(Context.getLibraryOptions())),
582 PGOOpt(PGOOpt), PIC(PIC), FS(
std::
move(FS)) {
584 TM->registerPassBuilderCallbacks(*
this);
586 PIC->registerClassToPassNameCallback([
this, PIC]() {
590#define MODULE_PASS(NAME, CREATE_PASS) \
591 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
592#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
593 PIC->addClassToPassName(CLASS, NAME);
594#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
595 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
596#define FUNCTION_PASS(NAME, CREATE_PASS) \
597 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
598#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
599 PIC->addClassToPassName(CLASS, NAME);
600#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
601 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
602#define LOOPNEST_PASS(NAME, CREATE_PASS) \
603 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
604#define LOOP_PASS(NAME, CREATE_PASS) \
605 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
606#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
607 PIC->addClassToPassName(CLASS, NAME);
608#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
609 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
610#define CGSCC_PASS(NAME, CREATE_PASS) \
611 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
612#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
613 PIC->addClassToPassName(CLASS, NAME);
614#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
615 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
616#include "PassRegistry.def"
618#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
619 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
620#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
621 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
622#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
624 PIC->addClassToPassName(CLASS, NAME);
625#include "llvm/Passes/MachinePassRegistry.def"
633#define MODULE_CALLBACK(NAME, INVOKE) \
634 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
635 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
637 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
640 INVOKE(PM, L.get()); \
643#include "PassRegistry.def"
651#define MODULE_LTO_CALLBACK(NAME, INVOKE) \
652 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
653 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
655 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
658 INVOKE(PM, L.get(), ThinOrFullLTOPhase::None); \
661#include "PassRegistry.def"
669#define FUNCTION_CALLBACK(NAME, INVOKE) \
670 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
671 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
673 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
676 INVOKE(PM, L.get()); \
679#include "PassRegistry.def"
687#define CGSCC_CALLBACK(NAME, INVOKE) \
688 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
689 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
691 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
694 INVOKE(PM, L.get()); \
697#include "PassRegistry.def"
705#define LOOP_CALLBACK(NAME, INVOKE) \
706 if (PassBuilder::checkParametrizedPassName(Name, NAME)) { \
707 auto L = PassBuilder::parsePassParameters(parseOptLevelParam, Name, NAME); \
709 errs() << NAME ": " << toString(L.takeError()) << '\n'; \
712 INVOKE(PM, L.get()); \
715#include "PassRegistry.def"
721#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
722 MAM.registerPass([&] { return CREATE_PASS; });
723#include "PassRegistry.def"
725 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
730#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
731 CGAM.registerPass([&] { return CREATE_PASS; });
732#include "PassRegistry.def"
734 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
744#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
745 if constexpr (std::is_constructible_v< \
746 std::remove_reference_t<decltype(CREATE_PASS)>, \
747 const TargetMachine &>) { \
749 FAM.registerPass([&] { return CREATE_PASS; }); \
751 FAM.registerPass([&] { return CREATE_PASS; }); \
753#include "PassRegistry.def"
755 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
762#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
763 MFAM.registerPass([&] { return CREATE_PASS; });
764#include "llvm/Passes/MachinePassRegistry.def"
766 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
771#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
772 LAM.registerPass([&] { return CREATE_PASS; });
773#include "PassRegistry.def"
775 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
779static std::optional<std::pair<bool, bool>>
781 std::pair<bool, bool> Params;
782 if (!Name.consume_front(
"function"))
786 if (!Name.consume_front(
"<") || !Name.consume_back(
">"))
788 while (!Name.empty()) {
789 auto [Front, Back] = Name.split(
';');
791 if (Front ==
"eager-inv")
793 else if (Front ==
"no-rerun")
794 Params.second =
true;
802 if (!Name.consume_front(
"devirt<") || !Name.consume_back(
">"))
814 while (!Params.
empty()) {
816 std::tie(ParamName, Params) = Params.
split(
';');
818 if (ParamName == OptionName) {
835 while (!Params.
empty()) {
837 std::tie(ParamName, Params) = Params.
split(
';');
842 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
847 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
851 formatv(
"invalid HardwareLoopPass parameter '{}'", ParamName).str(),
856 if (ParamName ==
"force-hardware-loops") {
858 }
else if (ParamName ==
"force-hardware-loop-phi") {
860 }
else if (ParamName ==
"force-nested-hardware-loop") {
862 }
else if (ParamName ==
"force-hardware-loop-guard") {
866 formatv(
"invalid HardwarePass parameter '{}'", ParamName).str(),
870 return HardwareLoopOpts;
882 "FunctionPropertiesStatisticsPass");
892 Params,
"assume-default-is-flat-addrspace",
"InferAddressSpacesPass");
898 while (!Params.
empty()) {
900 std::tie(ParamName, Params) = Params.
split(
';');
901 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
903 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
910 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
917 if (ParamName ==
"partial") {
919 }
else if (ParamName ==
"peeling") {
921 }
else if (ParamName ==
"profile-peeling") {
923 }
else if (ParamName ==
"runtime") {
925 }
else if (ParamName ==
"upperbound") {
927 }
else if (ParamName ==
"prepare-for-lto") {
931 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
940 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
960 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
969 "EntryExitInstrumenter");
974 "DropUnnecessaryAssumes");
979 "LowerMatrixIntrinsics");
984 while (!Params.
empty()) {
986 std::tie(ParamName, Params) = Params.
split(
';');
989 if (ParamName ==
"preserve-order")
991 else if (ParamName ==
"rename-all")
993 else if (ParamName ==
"fold-all")
995 else if (ParamName ==
"reorder-operands")
999 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1009 while (!Params.
empty()) {
1011 std::tie(ParamName, Params) = Params.
split(
';');
1013 if (ParamName ==
"kernel") {
1014 Result.CompileKernel =
true;
1015 }
else if (ParamName ==
"use-after-scope") {
1016 Result.UseAfterScope =
true;
1019 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1029 while (!Params.
empty()) {
1031 std::tie(ParamName, Params) = Params.
split(
';');
1033 if (ParamName ==
"recover") {
1035 }
else if (ParamName ==
"kernel") {
1036 Result.CompileKernel =
true;
1039 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1048parseDropTypeTestsPassOptions(
StringRef Params) {
1050 while (!Params.
empty()) {
1052 std::tie(ParamName, Params) = Params.
split(
';');
1054 if (ParamName ==
"all") {
1056 }
else if (ParamName ==
"assume") {
1060 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1069 while (!Params.
empty()) {
1071 std::tie(ParamName, Params) = Params.
split(
';');
1073 if (ParamName ==
"thinlto") {
1075 }
else if (ParamName ==
"emit-summary") {
1076 Result.EmitLTOSummary =
true;
1079 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1087parseLowerAllowCheckPassOptions(
StringRef Params) {
1089 while (!Params.
empty()) {
1091 std::tie(ParamName, Params) = Params.
split(
';');
1102 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1109 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1114 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1116 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1117 IndicesStr, CutoffStr)
1121 while (IndicesStr !=
"") {
1123 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1129 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1130 firstIndexStr, IndicesStr)
1137 if (index >=
Result.cutoffs.size())
1138 Result.cutoffs.resize(index + 1, 0);
1140 Result.cutoffs[index] = cutoff;
1142 }
else if (ParamName.
starts_with(
"runtime_check")) {
1144 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1148 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1150 ValueString, Params)
1154 Result.runtime_check = runtime_check;
1157 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1168 while (!Params.
empty()) {
1170 std::tie(ParamName, Params) = Params.
split(
';');
1172 if (ParamName ==
"recover") {
1174 }
else if (ParamName ==
"kernel") {
1179 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1184 }
else if (ParamName ==
"eager-checks") {
1185 Result.EagerChecks =
true;
1188 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1198 while (!Params.
empty()) {
1200 std::tie(ParamName, Params) = Params.
split(
';');
1207 formatv(
"invalid argument to AllocToken pass mode "
1214 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1224 while (!Params.
empty()) {
1226 std::tie(ParamName, Params) = Params.
split(
';');
1229 if (ParamName ==
"speculate-blocks") {
1231 }
else if (ParamName ==
"simplify-cond-branch") {
1233 }
else if (ParamName ==
"forward-switch-cond") {
1235 }
else if (ParamName ==
"switch-range-to-icmp") {
1237 }
else if (ParamName ==
"switch-to-arithmetic") {
1239 }
else if (ParamName ==
"switch-to-lookup") {
1241 }
else if (ParamName ==
"keep-loops") {
1243 }
else if (ParamName ==
"hoist-common-insts") {
1245 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1247 }
else if (ParamName ==
"sink-common-insts") {
1249 }
else if (ParamName ==
"speculate-unpredictables") {
1252 APInt BonusInstThreshold;
1255 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1263 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1274 Result.setVerifyFixpoint(
true);
1275 while (!Params.
empty()) {
1277 std::tie(ParamName, Params) = Params.
split(
';');
1280 if (ParamName ==
"verify-fixpoint") {
1283 APInt MaxIterations;
1286 formatv(
"invalid argument to InstCombine pass max-iterations "
1294 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1304 while (!Params.
empty()) {
1306 std::tie(ParamName, Params) = Params.
split(
';');
1309 if (ParamName ==
"interleave-forced-only") {
1311 }
else if (ParamName ==
"vectorize-forced-only") {
1315 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1323 std::pair<bool, bool>
Result = {
false,
true};
1324 while (!Params.
empty()) {
1326 std::tie(ParamName, Params) = Params.
split(
';');
1329 if (ParamName ==
"nontrivial") {
1331 }
else if (ParamName ==
"trivial") {
1335 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1344 while (!Params.
empty()) {
1346 std::tie(ParamName, Params) = Params.
split(
';');
1349 if (ParamName ==
"allowspeculation") {
1353 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1360struct LoopRotateOptions {
1361 bool EnableHeaderDuplication =
true;
1362 bool PrepareForLTO =
false;
1363 bool CheckExitCount =
false;
1367 LoopRotateOptions
Result;
1368 while (!Params.
empty()) {
1370 std::tie(ParamName, Params) = Params.
split(
';');
1373 if (ParamName ==
"header-duplication") {
1375 }
else if (ParamName ==
"prepare-for-lto") {
1377 }
else if (ParamName ==
"check-exit-count") {
1381 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1390 while (!Params.
empty()) {
1392 std::tie(ParamName, Params) = Params.
split(
';');
1395 if (ParamName ==
"split-footer-bb") {
1399 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1410 while (!Params.
empty()) {
1412 std::tie(ParamName, Params) = Params.
split(
';');
1415 if (ParamName ==
"scalar-pre") {
1417 }
else if (ParamName ==
"load-pre") {
1419 }
else if (ParamName ==
"split-backedge-load-pre") {
1421 }
else if (ParamName ==
"memdep") {
1425 }
else if (ParamName ==
"memoryssa") {
1431 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1440 while (!Params.
empty()) {
1442 std::tie(ParamName, Params) = Params.
split(
';');
1445 if (ParamName ==
"func-spec")
1449 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1457 while (!Params.
empty()) {
1459 std::tie(ParamName, Params) = Params.
split(
';');
1464 formatv(
"invalid argument to Scalarizer pass min-bits "
1475 if (ParamName ==
"load-store")
1477 else if (ParamName ==
"variable-insert-extract")
1481 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1491 bool SawCFGOption =
false;
1492 while (!Params.
empty()) {
1494 std::tie(ParamName, Params) = Params.
split(
';');
1496 if (ParamName ==
"modify-cfg") {
1501 SawCFGOption =
true;
1502 }
else if (ParamName ==
"preserve-cfg") {
1507 SawCFGOption =
true;
1508 }
else if (ParamName ==
"aggregate-to-vector") {
1509 Result.AggregateToVector =
true;
1512 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1513 "modify-cfg, or aggregate-to-vector)",
1523parseStackLifetimeOptions(
StringRef Params) {
1525 while (!Params.
empty()) {
1527 std::tie(ParamName, Params) = Params.
split(
';');
1529 if (ParamName ==
"may") {
1531 }
else if (ParamName ==
"must") {
1535 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1544 "DependenceAnalysisPrinter");
1549 "SeparateConstOffsetFromGEP");
1558parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1562 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1570 "MemorySSAPrinterPass");
1575 "SpeculativeExecutionPass");
1580 while (!Params.
empty()) {
1582 std::tie(ParamName, Params) = Params.
split(
';');
1588 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1596parseStructuralHashPrinterPassOptions(
StringRef Params) {
1599 if (Params ==
"detailed")
1601 if (Params ==
"call-target-ignored")
1604 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1610 while (!Params.
empty()) {
1612 std::tie(ParamName, Params) = Params.
split(
';');
1615 if (ParamName ==
"group-by-use")
1617 else if (ParamName ==
"ignore-single-use")
1619 else if (ParamName ==
"merge-const")
1621 else if (ParamName ==
"merge-const-aggressive")
1623 else if (ParamName ==
"merge-external")
1628 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1632 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1641 while (!Params.
empty()) {
1643 std::tie(ParamName, Params) = Params.
split(
';');
1649 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1660 while (!Params.
empty()) {
1662 std::tie(ParamName, Params) = Params.
split(
';');
1665 std::optional<RegAllocFilterFunc>
Filter =
1669 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1678 if (ParamName ==
"no-clear-vregs") {
1684 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1691parseBoundsCheckingOptions(
StringRef Params) {
1693 while (!Params.
empty()) {
1695 std::tie(ParamName, Params) = Params.
split(
';');
1696 if (ParamName ==
"trap") {
1698 }
else if (ParamName ==
"rt") {
1704 }
else if (ParamName ==
"rt-abort") {
1710 }
else if (ParamName ==
"min-rt") {
1716 }
else if (ParamName ==
"min-rt-abort") {
1722 }
else if (ParamName ==
"merge") {
1724 }
else if (ParamName ==
"handler-preserve-all-regs") {
1726 Options.Rt->HandlerPreserveAllRegs =
true;
1730 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1736 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1753 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1755 Param.str().c_str());
1758 if (!
Level.has_value())
1760 "invalid optimization level for expand-ir-insts pass: %s",
1761 Digit.str().c_str());
1768 if (Params.
empty() || Params ==
"all")
1769 return RAGreedyPass::Options();
1773 return RAGreedyPass::Options{*
Filter, Params};
1776 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1782 "MachineSinkingPass");
1786 bool AllowTailMerge =
true;
1787 if (!Params.
empty()) {
1789 if (Params !=
"tail-merge")
1791 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1795 return AllowTailMerge;
1799 bool ClearVirtRegs =
true;
1800 if (!Params.
empty()) {
1802 if (Params !=
"clear-vregs")
1804 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1807 return ClearVirtRegs;
1810struct FatLTOOptions {
1812 bool ThinLTO =
false;
1813 bool EmitSummary =
false;
1818 bool HaveOptLevel =
false;
1819 while (!Params.
empty()) {
1821 std::tie(ParamName, Params) = Params.
split(
';');
1823 if (ParamName ==
"thinlto") {
1825 }
else if (ParamName ==
"emit-summary") {
1826 Result.EmitSummary =
true;
1827 }
else if (std::optional<OptimizationLevel> OptLevel =
1829 Result.OptLevel = *OptLevel;
1830 HaveOptLevel =
true;
1833 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1840 "missing optimization level for fatlto-pre-link pipeline",
1855template <
typename PassManagerT,
typename CallbacksT>
1857 if (!Callbacks.empty()) {
1858 PassManagerT DummyPM;
1859 for (
auto &CB : Callbacks)
1860 if (CB(Name, DummyPM, {}))
1866template <
typename CallbacksT>
1868 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1871 if (Name ==
"module")
1873 if (Name ==
"cgscc")
1875 if (NameNoBracket ==
"function")
1877 if (Name ==
"coro-cond")
1880#define MODULE_PASS(NAME, CREATE_PASS) \
1883#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1884 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1886#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1887 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1889#include "PassRegistry.def"
1894template <
typename CallbacksT>
1897 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1898 if (Name ==
"cgscc")
1900 if (NameNoBracket ==
"function")
1907#define CGSCC_PASS(NAME, CREATE_PASS) \
1910#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1911 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1913#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1914 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1916#include "PassRegistry.def"
1921template <
typename CallbacksT>
1924 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1925 if (NameNoBracket ==
"function")
1927 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1930#define FUNCTION_PASS(NAME, CREATE_PASS) \
1933#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1934 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1936#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1937 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1939#include "PassRegistry.def"
1944template <
typename CallbacksT>
1947 if (Name ==
"machine-function")
1950#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1953#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1955 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1958#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1959 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1962#include "llvm/Passes/MachinePassRegistry.def"
1967template <
typename CallbacksT>
1969 bool &UseMemorySSA) {
1970 UseMemorySSA =
false;
1973 UseMemorySSA =
true;
1977#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1980#include "PassRegistry.def"
1985template <
typename CallbacksT>
1987 bool &UseMemorySSA) {
1988 UseMemorySSA =
false;
1991 UseMemorySSA =
true;
1995#define LOOP_PASS(NAME, CREATE_PASS) \
1998#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1999 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
2001#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2002 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
2004#include "PassRegistry.def"
2009std::optional<std::vector<PassBuilder::PipelineElement>>
2011 std::vector<PipelineElement> ResultPipeline;
2016 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2017 size_t Pos =
Text.find_first_of(
",()");
2018 Pipeline.push_back({
Text.substr(0, Pos), {}});
2021 if (Pos ==
Text.npos)
2024 char Sep =
Text[Pos];
2032 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2036 assert(Sep ==
')' &&
"Bogus separator!");
2041 if (PipelineStack.
size() == 1)
2042 return std::nullopt;
2045 }
while (
Text.consume_front(
")"));
2053 if (!
Text.consume_front(
","))
2054 return std::nullopt;
2057 if (PipelineStack.
size() > 1)
2059 return std::nullopt;
2061 assert(PipelineStack.
back() == &ResultPipeline &&
2062 "Wrong pipeline at the bottom of the stack!");
2063 return {std::move(ResultPipeline)};
2073 const PipelineElement &
E) {
2074 auto &
Name =
E.Name;
2075 auto &InnerPipeline =
E.InnerPipeline;
2078 if (!InnerPipeline.empty()) {
2079 if (Name ==
"module") {
2081 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2083 MPM.
addPass(std::move(NestedMPM));
2086 if (Name ==
"coro-cond") {
2088 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2090 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2093 if (Name ==
"cgscc") {
2095 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2103 "cannot have a no-rerun module to function adaptor",
2106 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2113 for (
auto &
C : ModulePipelineParsingCallbacks)
2114 if (
C(Name, MPM, InnerPipeline))
2119 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2125#define MODULE_PASS(NAME, CREATE_PASS) \
2126 if (Name == NAME) { \
2127 MPM.addPass(CREATE_PASS); \
2128 return Error::success(); \
2130#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2131 if (checkParametrizedPassName(Name, NAME)) { \
2132 auto Params = parsePassParameters(PARSER, Name, NAME); \
2134 return Params.takeError(); \
2135 MPM.addPass(CREATE_PASS(Params.get())); \
2136 return Error::success(); \
2138#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2139 if (Name == "require<" NAME ">") { \
2141 RequireAnalysisPass< \
2142 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2143 return Error::success(); \
2145 if (Name == "invalidate<" NAME ">") { \
2146 MPM.addPass(InvalidateAnalysisPass< \
2147 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2148 return Error::success(); \
2150#define CGSCC_PASS(NAME, CREATE_PASS) \
2151 if (Name == NAME) { \
2152 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2153 return Error::success(); \
2155#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2156 if (checkParametrizedPassName(Name, NAME)) { \
2157 auto Params = parsePassParameters(PARSER, Name, NAME); \
2159 return Params.takeError(); \
2161 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2162 return Error::success(); \
2164#define FUNCTION_PASS(NAME, CREATE_PASS) \
2165 if (Name == NAME) { \
2166 if constexpr (std::is_constructible_v< \
2167 std::remove_reference_t<decltype(CREATE_PASS)>, \
2168 const TargetMachine &>) { \
2170 return make_error<StringError>( \
2171 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2172 inconvertibleErrorCode()); \
2174 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2175 return Error::success(); \
2177#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2178 if (checkParametrizedPassName(Name, NAME)) { \
2179 auto Params = parsePassParameters(PARSER, Name, NAME); \
2181 return Params.takeError(); \
2182 auto CreatePass = CREATE_PASS; \
2183 if constexpr (std::is_constructible_v< \
2184 std::remove_reference_t<decltype(CreatePass( \
2186 const TargetMachine &, \
2187 std::remove_reference_t<decltype(Params.get())>>) { \
2189 return make_error<StringError>( \
2190 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2191 inconvertibleErrorCode()); \
2194 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2195 return Error::success(); \
2197#define LOOPNEST_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(NAME, CREATE_PASS) \
2204 if (Name == NAME) { \
2205 MPM.addPass(createModuleToFunctionPassAdaptor( \
2206 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2207 return Error::success(); \
2209#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2210 if (checkParametrizedPassName(Name, NAME)) { \
2211 auto Params = parsePassParameters(PARSER, Name, NAME); \
2213 return Params.takeError(); \
2214 MPM.addPass(createModuleToFunctionPassAdaptor( \
2215 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2216 return Error::success(); \
2218#include "PassRegistry.def"
2220 for (
auto &
C : ModulePipelineParsingCallbacks)
2221 if (
C(Name, MPM, InnerPipeline))
2224 formatv(
"unknown module pass '{}'", Name).str(),
2229 const PipelineElement &
E) {
2230 auto &
Name =
E.Name;
2231 auto &InnerPipeline =
E.InnerPipeline;
2234 if (!InnerPipeline.empty()) {
2235 if (Name ==
"cgscc") {
2237 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2240 CGPM.
addPass(std::move(NestedCGPM));
2245 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2249 std::move(FPM), Params->first, Params->second));
2254 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2261 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2262 if (
C(Name, CGPM, InnerPipeline))
2267 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2272#define CGSCC_PASS(NAME, CREATE_PASS) \
2273 if (Name == NAME) { \
2274 CGPM.addPass(CREATE_PASS); \
2275 return Error::success(); \
2277#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2278 if (checkParametrizedPassName(Name, NAME)) { \
2279 auto Params = parsePassParameters(PARSER, Name, NAME); \
2281 return Params.takeError(); \
2282 CGPM.addPass(CREATE_PASS(Params.get())); \
2283 return Error::success(); \
2285#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2286 if (Name == "require<" NAME ">") { \
2287 CGPM.addPass(RequireAnalysisPass< \
2288 std::remove_reference_t<decltype(CREATE_PASS)>, \
2289 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2290 CGSCCUpdateResult &>()); \
2291 return Error::success(); \
2293 if (Name == "invalidate<" NAME ">") { \
2294 CGPM.addPass(InvalidateAnalysisPass< \
2295 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2296 return Error::success(); \
2298#define FUNCTION_PASS(NAME, CREATE_PASS) \
2299 if (Name == NAME) { \
2300 if constexpr (std::is_constructible_v< \
2301 std::remove_reference_t<decltype(CREATE_PASS)>, \
2302 const TargetMachine &>) { \
2304 return make_error<StringError>( \
2305 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2306 inconvertibleErrorCode()); \
2308 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2309 return Error::success(); \
2311#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2312 if (checkParametrizedPassName(Name, NAME)) { \
2313 auto Params = parsePassParameters(PARSER, Name, NAME); \
2315 return Params.takeError(); \
2316 auto CreatePass = CREATE_PASS; \
2317 if constexpr (std::is_constructible_v< \
2318 std::remove_reference_t<decltype(CreatePass( \
2320 const TargetMachine &, \
2321 std::remove_reference_t<decltype(Params.get())>>) { \
2323 return make_error<StringError>( \
2324 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2325 inconvertibleErrorCode()); \
2328 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2329 return Error::success(); \
2331#define LOOPNEST_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(NAME, CREATE_PASS) \
2338 if (Name == NAME) { \
2339 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2340 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2341 return Error::success(); \
2343#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2344 if (checkParametrizedPassName(Name, NAME)) { \
2345 auto Params = parsePassParameters(PARSER, Name, NAME); \
2347 return Params.takeError(); \
2348 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2349 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2350 return Error::success(); \
2352#include "PassRegistry.def"
2354 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2355 if (
C(Name, CGPM, InnerPipeline))
2362 const PipelineElement &
E) {
2363 auto &
Name =
E.Name;
2364 auto &InnerPipeline =
E.InnerPipeline;
2367 if (!InnerPipeline.empty()) {
2368 if (Name ==
"function") {
2370 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2373 FPM.
addPass(std::move(NestedFPM));
2376 if (Name ==
"loop" || Name ==
"loop-mssa") {
2378 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2381 bool UseMemorySSA = (
Name ==
"loop-mssa");
2386 if (Name ==
"machine-function") {
2388 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2394 for (
auto &
C : FunctionPipelineParsingCallbacks)
2395 if (
C(Name, FPM, InnerPipeline))
2400 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2405#define FUNCTION_PASS(NAME, CREATE_PASS) \
2406 if (Name == NAME) { \
2407 if constexpr (std::is_constructible_v< \
2408 std::remove_reference_t<decltype(CREATE_PASS)>, \
2409 const TargetMachine &>) { \
2411 return make_error<StringError>( \
2412 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2413 inconvertibleErrorCode()); \
2415 FPM.addPass(CREATE_PASS); \
2416 return Error::success(); \
2418#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2419 if (checkParametrizedPassName(Name, NAME)) { \
2420 auto Params = parsePassParameters(PARSER, Name, NAME); \
2422 return Params.takeError(); \
2423 auto CreatePass = CREATE_PASS; \
2424 if constexpr (std::is_constructible_v< \
2425 std::remove_reference_t<decltype(CreatePass( \
2427 const TargetMachine &, \
2428 std::remove_reference_t<decltype(Params.get())>>) { \
2430 return make_error<StringError>( \
2431 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2432 inconvertibleErrorCode()); \
2435 FPM.addPass(CREATE_PASS(Params.get())); \
2436 return Error::success(); \
2438#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2439 if (Name == "require<" NAME ">") { \
2440 if constexpr (std::is_constructible_v< \
2441 std::remove_reference_t<decltype(CREATE_PASS)>, \
2442 const TargetMachine &>) { \
2444 return make_error<StringError>( \
2445 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2446 inconvertibleErrorCode()); \
2449 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2451 return Error::success(); \
2453 if (Name == "invalidate<" NAME ">") { \
2454 FPM.addPass(InvalidateAnalysisPass< \
2455 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2456 return Error::success(); \
2462#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2463 if (Name == NAME) { \
2464 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2465 return Error::success(); \
2467#define LOOP_PASS(NAME, CREATE_PASS) \
2468 if (Name == NAME) { \
2469 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2470 return Error::success(); \
2472#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2473 if (checkParametrizedPassName(Name, NAME)) { \
2474 auto Params = parsePassParameters(PARSER, Name, NAME); \
2476 return Params.takeError(); \
2478 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2479 return Error::success(); \
2481#include "PassRegistry.def"
2483 for (
auto &
C : FunctionPipelineParsingCallbacks)
2484 if (
C(Name, FPM, InnerPipeline))
2487 formatv(
"unknown function pass '{}'", Name).str(),
2492 const PipelineElement &
E) {
2493 StringRef
Name =
E.Name;
2494 auto &InnerPipeline =
E.InnerPipeline;
2497 if (!InnerPipeline.empty()) {
2498 if (Name ==
"loop") {
2500 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2503 LPM.addPass(std::move(NestedLPM));
2507 for (
auto &
C : LoopPipelineParsingCallbacks)
2508 if (
C(Name, LPM, InnerPipeline))
2513 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2518#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2519 if (Name == NAME) { \
2520 LPM.addPass(CREATE_PASS); \
2521 return Error::success(); \
2523#define LOOP_PASS(NAME, CREATE_PASS) \
2524 if (Name == NAME) { \
2525 LPM.addPass(CREATE_PASS); \
2526 return Error::success(); \
2528#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2529 if (checkParametrizedPassName(Name, NAME)) { \
2530 auto Params = parsePassParameters(PARSER, Name, NAME); \
2532 return Params.takeError(); \
2533 LPM.addPass(CREATE_PASS(Params.get())); \
2534 return Error::success(); \
2536#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2537 if (Name == "require<" NAME ">") { \
2538 LPM.addPass(RequireAnalysisPass< \
2539 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2540 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2542 return Error::success(); \
2544 if (Name == "invalidate<" NAME ">") { \
2545 LPM.addPass(InvalidateAnalysisPass< \
2546 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2547 return Error::success(); \
2549#include "PassRegistry.def"
2551 for (
auto &
C : LoopPipelineParsingCallbacks)
2552 if (
C(Name, LPM, InnerPipeline))
2559 const PipelineElement &
E) {
2560 StringRef
Name =
E.Name;
2562 if (!
E.InnerPipeline.empty()) {
2563 if (
E.Name ==
"machine-function") {
2565 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2567 MFPM.
addPass(std::move(NestedPM));
2574#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2575 if (Name == NAME) { \
2576 MFPM.addPass(CREATE_PASS); \
2577 return Error::success(); \
2579#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2580 if (Name == NAME) { \
2581 MFPM.addPass(CREATE_PASS); \
2582 return Error::success(); \
2584#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2586 if (checkParametrizedPassName(Name, NAME)) { \
2587 auto Params = parsePassParameters(PARSER, Name, NAME); \
2589 return Params.takeError(); \
2590 MFPM.addPass(CREATE_PASS(Params.get())); \
2591 return Error::success(); \
2593#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2594 if (Name == "require<" NAME ">") { \
2596 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2597 MachineFunction>()); \
2598 return Error::success(); \
2600 if (Name == "invalidate<" NAME ">") { \
2601 MFPM.addPass(InvalidateAnalysisPass< \
2602 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2603 return Error::success(); \
2605#include "llvm/Passes/MachinePassRegistry.def"
2607 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2608 if (
C(Name, MFPM,
E.InnerPipeline))
2611 formatv(
"unknown machine pass '{}'", Name).str(),
2616#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2617 if (Name == NAME) { \
2618 AA.registerModuleAnalysis< \
2619 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2622#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2623 if (Name == NAME) { \
2624 AA.registerFunctionAnalysis< \
2625 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2628#include "PassRegistry.def"
2630 for (
auto &
C : AAParsingCallbacks)
2636Error PassBuilder::parseMachinePassPipeline(
2638 for (
const auto &Element : Pipeline) {
2639 if (
auto Err = parseMachinePass(MFPM, Element))
2647 for (
const auto &Element : Pipeline) {
2648 if (
auto Err = parseLoopPass(LPM, Element))
2654Error PassBuilder::parseFunctionPassPipeline(
2656 for (
const auto &Element : Pipeline) {
2657 if (
auto Err = parseFunctionPass(FPM, Element))
2665 for (
const auto &Element : Pipeline) {
2666 if (
auto Err = parseCGSCCPass(CGPM, Element))
2698 for (
const auto &Element : Pipeline) {
2699 if (
auto Err = parseModulePass(MPM, Element))
2710 auto Pipeline = parsePipelineText(PipelineText);
2711 if (!Pipeline || Pipeline->empty())
2713 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2723 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2725 FunctionPipelineParsingCallbacks)) {
2726 Pipeline = {{
"function", std::move(*Pipeline)}};
2729 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2730 std::move(*Pipeline)}}}};
2731 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2733 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2734 std::move(*Pipeline)}}}};
2736 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2737 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2739 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2740 if (
C(MPM, *Pipeline))
2744 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2746 formatv(
"unknown {} name '{}'",
2747 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2753 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2761 auto Pipeline = parsePipelineText(PipelineText);
2762 if (!Pipeline || Pipeline->empty())
2764 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2770 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2775 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2784 auto Pipeline = parsePipelineText(PipelineText);
2785 if (!Pipeline || Pipeline->empty())
2787 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2793 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2798 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2806 auto Pipeline = parsePipelineText(PipelineText);
2807 if (!Pipeline || Pipeline->empty())
2809 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2812 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2820 auto Pipeline = parsePipelineText(PipelineText);
2821 if (!Pipeline || Pipeline->empty())
2823 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2826 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2835 if (PipelineText ==
"default") {
2840 while (!PipelineText.
empty()) {
2842 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2843 if (!parseAAPassName(
AA, Name))
2845 formatv(
"unknown alias analysis name '{}'", Name).str(),
2852std::optional<RegAllocFilterFunc>
2854 if (FilterName ==
"all")
2856 for (
auto &
C : RegClassFilterParsingCallbacks)
2857 if (
auto F =
C(FilterName))
2859 return std::nullopt;
2870 auto I = PassNames.
begin();
2871 auto End = PassNames.
end();
2878 OS <<
" " << Name <<
'<' << Params <<
">\n";
2885 OS <<
"Module passes:\n";
2886 static constexpr char ModulePassNames[] = {
"\0"
2887#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2888#include "PassRegistry.def"
2892 OS <<
"Module passes with params:\n";
2893 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2894#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2895 NAME "\0" PARAMS "\0"
2896#include "PassRegistry.def"
2900 OS <<
"Module analyses:\n";
2901 static constexpr char ModuleAnalysisNames[] = {
"\0"
2902#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2903#include "PassRegistry.def"
2907 OS <<
"Module alias analyses:\n";
2908 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2909#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2910#include "PassRegistry.def"
2914 OS <<
"CGSCC passes:\n";
2915 static constexpr char CGSCCPassNames[] = {
"\0"
2916#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2917#include "PassRegistry.def"
2921 OS <<
"CGSCC passes with params:\n";
2922 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2923#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2924 NAME "\0" PARAMS "\0"
2925#include "PassRegistry.def"
2929 OS <<
"CGSCC analyses:\n";
2930 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2931#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2932#include "PassRegistry.def"
2936 OS <<
"Function passes:\n";
2937 static constexpr char FunctionPassNames[] = {
"\0"
2938#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2939#include "PassRegistry.def"
2943 OS <<
"Function passes with params:\n";
2944 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2945#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2946 NAME "\0" PARAMS "\0"
2947#include "PassRegistry.def"
2951 OS <<
"Function analyses:\n";
2952 static constexpr char FunctionAnalysisNames[] = {
"\0"
2953#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2954#include "PassRegistry.def"
2958 OS <<
"Function alias analyses:\n";
2959 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2960#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2961#include "PassRegistry.def"
2965 OS <<
"LoopNest passes:\n";
2966 static constexpr char LoopNestPassNames[] = {
"\0"
2967#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2968#include "PassRegistry.def"
2972 OS <<
"Loop passes:\n";
2973 static constexpr char LoopPassNames[] = {
"\0"
2974#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2975#include "PassRegistry.def"
2979 OS <<
"Loop passes with params:\n";
2980 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2981#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2982 NAME "\0" PARAMS "\0"
2983#include "PassRegistry.def"
2987 OS <<
"Loop analyses:\n";
2988 static constexpr char LoopAnalysisNames[] = {
"\0"
2989#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2990#include "PassRegistry.def"
2994 OS <<
"Machine module passes (WIP):\n";
2995 static constexpr char MachineModulePassNames[] = {
"\0"
2996#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2997#include "llvm/Passes/MachinePassRegistry.def"
3001 OS <<
"Machine function passes (WIP):\n";
3002 static constexpr char MachineFunctionPassNames[] = {
"\0"
3003#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
3004#include "llvm/Passes/MachinePassRegistry.def"
3008 OS <<
"Machine function analyses (WIP):\n";
3009 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3010#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3011#include "llvm/Passes/MachinePassRegistry.def"
3019 TopLevelPipelineParsingCallbacks.push_back(
C);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AggressiveInstCombiner - Combine expression patterns to form expressions with fewer,...
This file implements a simple N^2 alias analysis accuracy evaluator.
Provides passes to inlining "always_inline" functions.
This is the interface for LLVM's primary stateless and local alias analysis.
This file contains the declaration of the BreakFalseDepsPass class, used to identify and avoid false ...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Contains definition of the base CFIFixup pass.
This file provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
Provides analysis for continuously CSEing during GISel passes.
This file provides interfaces used to build and manipulate a call graph, which is a very useful tool ...
Defines an IR pass for CodeGen Prepare.
This file contains the declaration of the MachineKCFI class, which is a Machine Pass that implements ...
#define LLVM_ATTRIBUTE_NOINLINE
LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inl...
This file declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
Analysis that tracks defined/used subregister lanes across COPY instructions and instructions that ge...
This file provides the interface for a simple, fast CSE pass.
This file provides a pass which clones the current module and runs the provided pass pipeline on the ...
Super simple passes to force specific function attrs from the commandline into the IR for debugging p...
Provides passes for computing function attributes based on interprocedural analyses.
This file provides the interface for the GCOV style profiler pass.
Provides analysis for querying information about KnownBits during GISel passes.
This file provides the interface for the GVNHoist pass.
This file provides the interface for the GVNSink pass.
This file provides the interface for LLVM's Global Value Numbering pass which eliminates fully redund...
This is the interface for a simple mod/ref and alias analysis over globals.
Defines an IR pass for the creation of hardware loops.
AcceleratorCodeSelection - Identify all functions reachable from a kernel, removing those that are un...
This file defines the IR2Vec vocabulary analysis(IR2VecVocabAnalysis), the core ir2vec::Embedder inte...
This file defines passes to print out IR in various granularities.
This file declares the IRTranslator pass.
This header defines various interfaces for pass management in LLVM.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file provides the interface for LLVM's Logical Scalar Replacement of Aggregates pass.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
This file defines the MIR2Vec framework for generating Machine IR embeddings.
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(Mod->getContext(), 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...
MachineRegisterInfo & MRI
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file contains the declaration of the ResetMachineFunctionPass class.
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
This is an important class for using LLVM in a threaded context.
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 Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
LLVM_ABI PassBuilder(LLVMContext &Context, TargetMachine *TM=nullptr, std::optional< PipelineTuningOptions > PTO=std::nullopt, std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
The pipelines read the library options of Context, which must outlive the PassBuilder.
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 std::optional< PrintPipelinePassesFormat > getPrintPipelinePasses() const
The format -print-pipeline-passes requests, or std::nullopt if it is not given.
LLVM_ABI void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
static LLVM_ABI Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
LLVM_ABI void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
LLVM_ABI void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
LLVM_ABI void registerFunctionAnalyses(FunctionAnalysisManager &FAM)
Registers all available function analysis passes.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
LLVM_ATTRIBUTE_MINSIZE std::enable_if_t<!std::is_same_v< PassT, PassManager > > addPass(PassT &&Pass)
Tunable parameters for passes in the default pipelines.
bool SLPVectorization
Tuning option to enable/disable slp loop vectorization, set based on opt level.
bool LoopVectorization
Tuning option to enable/disable loop vectorization, set based on opt level.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
Get the contents as an std::string.
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
constexpr bool empty() const
Check if the string is empty.
char front() const
Get the first character in the string.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
A table of densely packed, null-terminated strings indexed by offset.
constexpr Iterator begin() const
constexpr Iterator end() const
Primary interface to the complete machine description for the target machine.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
self_iterator getIterator()
This class implements an extremely fast bulk output stream that can only output to a stream.
Interfaces for registering analysis passes, producing common pass manager configurations,...
Abstract Attribute helper functions.
std::optional< CodeGenOptLevel > getLevel(int OL)
Get the Level identified by the integer OL.
@ BasicBlock
Various leaf nodes.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
DropTestKind
Specifies how to drop type tests.
@ All
Drop only llvm.assumes using type test value.
This is an optimization pass for GlobalISel generic memory operations.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
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...
@ End
Run the machine verifier once, at the end of the pipeline.
const PassesOptions & getPassesOptions(const LLVMContext &C)
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