427std::optional<PrintPipelinePassesFormat>
429 return Opts.print_pipeline_passes;
440 for (
char C : Pipeline) {
448 assert(IndentLevel >= 0 &&
"Invalid pipeline string!");
478 return MFA ? &MFA->
getMF() :
nullptr;
484class TriggerVerifierErrorPass
490 auto *PtrTy = PointerType::getUnqual(
M.getContext());
492 GlobalValue::LinkageTypes::InternalLinkage,
493 "__bad_alias",
nullptr, &M);
513 static StringRef
name() {
return "TriggerVerifierErrorPass"; }
518class RequireAllMachineFunctionPropertiesPass
526 static MachineFunctionProperties getRequiredProperties() {
527 return MachineFunctionProperties()
529 .setFailsVerification()
534 .setRegBankSelected()
536 .setTiedOpsRewritten()
537 .setTracksDebugUserValues()
538 .setTracksLiveness();
540 static StringRef
name() {
return "RequireAllMachineFunctionPropertiesPass"; }
546 if (S ==
"Os" || S ==
"Oz")
548 Twine(
"The optimization level \"") + S +
549 "\" is no longer supported. Use O2 in conjunction with the " +
550 (S ==
"Os" ?
"optsize" :
"minsize") +
" attribute instead.");
561 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(S);
565 formatv(
"invalid optimization level '{}'", S).str(),
570 std::optional<PGOOptions> PGOOpt,
573 : Opts(PassesOptions::
Global), TM(TM), PTO(PTO), PGOOpt(PGOOpt), PIC(PIC),
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");
884 Params,
"assume-default-is-flat-addrspace",
"InferAddressSpacesPass");
890 while (!Params.
empty()) {
892 std::tie(ParamName, Params) = Params.
split(
';');
893 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
895 UnrollOpts.
setOptLevel(
static_cast<int>(*OptLevel));
902 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
909 if (ParamName ==
"partial") {
911 }
else if (ParamName ==
"peeling") {
913 }
else if (ParamName ==
"profile-peeling") {
915 }
else if (ParamName ==
"runtime") {
917 }
else if (ParamName ==
"upperbound") {
919 }
else if (ParamName ==
"prepare-for-lto") {
923 formatv(
"invalid LoopUnrollPass parameter '{}'", ParamName).str(),
932 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
952 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
961 "EntryExitInstrumenter");
966 "DropUnnecessaryAssumes");
971 "LowerMatrixIntrinsics");
976 while (!Params.
empty()) {
978 std::tie(ParamName, Params) = Params.
split(
';');
981 if (ParamName ==
"preserve-order")
983 else if (ParamName ==
"rename-all")
985 else if (ParamName ==
"fold-all")
987 else if (ParamName ==
"reorder-operands")
991 formatv(
"invalid normalize pass parameter '{}'", ParamName).str(),
1001 while (!Params.
empty()) {
1003 std::tie(ParamName, Params) = Params.
split(
';');
1005 if (ParamName ==
"kernel") {
1006 Result.CompileKernel =
true;
1007 }
else if (ParamName ==
"use-after-scope") {
1008 Result.UseAfterScope =
true;
1011 formatv(
"invalid AddressSanitizer pass parameter '{}'", ParamName)
1021 while (!Params.
empty()) {
1023 std::tie(ParamName, Params) = Params.
split(
';');
1025 if (ParamName ==
"recover") {
1027 }
else if (ParamName ==
"kernel") {
1028 Result.CompileKernel =
true;
1031 formatv(
"invalid HWAddressSanitizer pass parameter '{}'", ParamName)
1040parseDropTypeTestsPassOptions(
StringRef Params) {
1042 while (!Params.
empty()) {
1044 std::tie(ParamName, Params) = Params.
split(
';');
1046 if (ParamName ==
"all") {
1048 }
else if (ParamName ==
"assume") {
1052 formatv(
"invalid DropTypeTestsPass parameter '{}'", ParamName).str(),
1061 while (!Params.
empty()) {
1063 std::tie(ParamName, Params) = Params.
split(
';');
1065 if (ParamName ==
"thinlto") {
1067 }
else if (ParamName ==
"emit-summary") {
1068 Result.EmitLTOSummary =
true;
1071 formatv(
"invalid EmbedBitcode pass parameter '{}'", ParamName).str(),
1079parseLowerAllowCheckPassOptions(
StringRef Params) {
1081 while (!Params.
empty()) {
1083 std::tie(ParamName, Params) = Params.
split(
';');
1094 std::tie(IndicesStr, CutoffStr) = ParamName.
split(
"]=");
1101 formatv(
"invalid LowerAllowCheck pass cutoffs parameter '{}' ({})",
1106 if (!IndicesStr.
consume_front(
"cutoffs[") || IndicesStr ==
"")
1108 formatv(
"invalid LowerAllowCheck pass index parameter '{}' ({})",
1109 IndicesStr, CutoffStr)
1113 while (IndicesStr !=
"") {
1115 std::tie(firstIndexStr, IndicesStr) = IndicesStr.
split(
'|');
1121 "invalid LowerAllowCheck pass index parameter '{}' ({}) {}",
1122 firstIndexStr, IndicesStr)
1129 if (index >=
Result.cutoffs.size())
1130 Result.cutoffs.resize(index + 1, 0);
1132 Result.cutoffs[index] = cutoff;
1134 }
else if (ParamName.
starts_with(
"runtime_check")) {
1136 std::tie(std::ignore, ValueString) = ParamName.
split(
"=");
1140 formatv(
"invalid LowerAllowCheck pass runtime_check parameter '{}' "
1142 ValueString, Params)
1146 Result.runtime_check = runtime_check;
1149 formatv(
"invalid LowerAllowCheck pass parameter '{}'", ParamName)
1160 while (!Params.
empty()) {
1162 std::tie(ParamName, Params) = Params.
split(
';');
1164 if (ParamName ==
"recover") {
1166 }
else if (ParamName ==
"kernel") {
1171 formatv(
"invalid argument to MemorySanitizer pass track-origins "
1176 }
else if (ParamName ==
"eager-checks") {
1177 Result.EagerChecks =
true;
1180 formatv(
"invalid MemorySanitizer pass parameter '{}'", ParamName)
1190 while (!Params.
empty()) {
1192 std::tie(ParamName, Params) = Params.
split(
';');
1199 formatv(
"invalid argument to AllocToken pass mode "
1206 formatv(
"invalid AllocToken pass parameter '{}'", ParamName).str(),
1216 while (!Params.
empty()) {
1218 std::tie(ParamName, Params) = Params.
split(
';');
1221 if (ParamName ==
"speculate-blocks") {
1223 }
else if (ParamName ==
"simplify-cond-branch") {
1225 }
else if (ParamName ==
"forward-switch-cond") {
1227 }
else if (ParamName ==
"switch-range-to-icmp") {
1229 }
else if (ParamName ==
"switch-to-arithmetic") {
1231 }
else if (ParamName ==
"switch-to-lookup") {
1233 }
else if (ParamName ==
"keep-loops") {
1235 }
else if (ParamName ==
"hoist-common-insts") {
1237 }
else if (ParamName ==
"hoist-loads-stores-with-cond-faulting") {
1239 }
else if (ParamName ==
"sink-common-insts") {
1241 }
else if (ParamName ==
"speculate-unpredictables") {
1244 APInt BonusInstThreshold;
1247 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
1255 formatv(
"invalid SimplifyCFG pass parameter '{}'", ParamName).str(),
1266 Result.setVerifyFixpoint(
true);
1267 while (!Params.
empty()) {
1269 std::tie(ParamName, Params) = Params.
split(
';');
1272 if (ParamName ==
"verify-fixpoint") {
1275 APInt MaxIterations;
1278 formatv(
"invalid argument to InstCombine pass max-iterations "
1286 formatv(
"invalid InstCombine pass parameter '{}'", ParamName).str(),
1296 while (!Params.
empty()) {
1298 std::tie(ParamName, Params) = Params.
split(
';');
1301 if (ParamName ==
"interleave-forced-only") {
1303 }
else if (ParamName ==
"vectorize-forced-only") {
1307 formatv(
"invalid LoopVectorize parameter '{}'", ParamName).str(),
1315 std::pair<bool, bool>
Result = {
false,
true};
1316 while (!Params.
empty()) {
1318 std::tie(ParamName, Params) = Params.
split(
';');
1321 if (ParamName ==
"nontrivial") {
1323 }
else if (ParamName ==
"trivial") {
1327 formatv(
"invalid LoopUnswitch pass parameter '{}'", ParamName).str(),
1336 while (!Params.
empty()) {
1338 std::tie(ParamName, Params) = Params.
split(
';');
1341 if (ParamName ==
"allowspeculation") {
1345 formatv(
"invalid LICM pass parameter '{}'", ParamName).str(),
1352struct LoopRotateOptions {
1353 bool EnableHeaderDuplication =
true;
1354 bool PrepareForLTO =
false;
1355 bool CheckExitCount =
false;
1359 LoopRotateOptions
Result;
1360 while (!Params.
empty()) {
1362 std::tie(ParamName, Params) = Params.
split(
';');
1365 if (ParamName ==
"header-duplication") {
1367 }
else if (ParamName ==
"prepare-for-lto") {
1369 }
else if (ParamName ==
"check-exit-count") {
1373 formatv(
"invalid LoopRotate pass parameter '{}'", ParamName).str(),
1382 while (!Params.
empty()) {
1384 std::tie(ParamName, Params) = Params.
split(
';');
1387 if (ParamName ==
"split-footer-bb") {
1391 formatv(
"invalid MergedLoadStoreMotion pass parameter '{}'",
1402 while (!Params.
empty()) {
1404 std::tie(ParamName, Params) = Params.
split(
';');
1407 if (ParamName ==
"scalar-pre") {
1409 }
else if (ParamName ==
"load-pre") {
1411 }
else if (ParamName ==
"split-backedge-load-pre") {
1413 }
else if (ParamName ==
"memdep") {
1417 }
else if (ParamName ==
"memoryssa") {
1423 formatv(
"invalid GVN pass parameter '{}'", ParamName).str(),
1432 while (!Params.
empty()) {
1434 std::tie(ParamName, Params) = Params.
split(
';');
1437 if (ParamName ==
"func-spec")
1441 formatv(
"invalid IPSCCP pass parameter '{}'", ParamName).str(),
1449 while (!Params.
empty()) {
1451 std::tie(ParamName, Params) = Params.
split(
';');
1456 formatv(
"invalid argument to Scalarizer pass min-bits "
1467 if (ParamName ==
"load-store")
1469 else if (ParamName ==
"variable-insert-extract")
1473 formatv(
"invalid Scalarizer pass parameter '{}'", ParamName).str(),
1483 bool SawCFGOption =
false;
1484 while (!Params.
empty()) {
1486 std::tie(ParamName, Params) = Params.
split(
';');
1488 if (ParamName ==
"modify-cfg") {
1493 SawCFGOption =
true;
1494 }
else if (ParamName ==
"preserve-cfg") {
1499 SawCFGOption =
true;
1500 }
else if (ParamName ==
"aggregate-to-vector") {
1501 Result.AggregateToVector =
true;
1504 formatv(
"invalid SROA pass parameter '{}' (expected preserve-cfg, "
1505 "modify-cfg, or aggregate-to-vector)",
1515parseStackLifetimeOptions(
StringRef Params) {
1517 while (!Params.
empty()) {
1519 std::tie(ParamName, Params) = Params.
split(
';');
1521 if (ParamName ==
"may") {
1523 }
else if (ParamName ==
"must") {
1527 formatv(
"invalid StackLifetime parameter '{}'", ParamName).str(),
1536 "DependenceAnalysisPrinter");
1541 "SeparateConstOffsetFromGEP");
1550parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1554 formatv(
"invalid function-simplification parameter '{}'", Params).str(),
1562 "MemorySSAPrinterPass");
1567 "SpeculativeExecutionPass");
1572 while (!Params.
empty()) {
1574 std::tie(ParamName, Params) = Params.
split(
';');
1580 formatv(
"invalid MemProfUse pass parameter '{}'", ParamName).str(),
1588parseStructuralHashPrinterPassOptions(
StringRef Params) {
1591 if (Params ==
"detailed")
1593 if (Params ==
"call-target-ignored")
1596 formatv(
"invalid structural hash printer parameter '{}'", Params).str(),
1602 while (!Params.
empty()) {
1604 std::tie(ParamName, Params) = Params.
split(
';');
1607 if (ParamName ==
"group-by-use")
1609 else if (ParamName ==
"ignore-single-use")
1611 else if (ParamName ==
"merge-const")
1613 else if (ParamName ==
"merge-const-aggressive")
1615 else if (ParamName ==
"merge-external")
1620 formatv(
"invalid GlobalMergePass parameter '{}'", ParamName).str(),
1624 formatv(
"invalid global-merge pass parameter '{}'", Params).str(),
1633 while (!Params.
empty()) {
1635 std::tie(ParamName, Params) = Params.
split(
';');
1641 formatv(
"invalid Internalize pass parameter '{}'", ParamName).str(),
1652 while (!Params.
empty()) {
1654 std::tie(ParamName, Params) = Params.
split(
';');
1657 std::optional<RegAllocFilterFunc>
Filter =
1661 formatv(
"invalid regallocfast register filter '{}'", ParamName)
1670 if (ParamName ==
"no-clear-vregs") {
1676 formatv(
"invalid regallocfast pass parameter '{}'", ParamName).str(),
1683parseBoundsCheckingOptions(
StringRef Params) {
1685 while (!Params.
empty()) {
1687 std::tie(ParamName, Params) = Params.
split(
';');
1688 if (ParamName ==
"trap") {
1690 }
else if (ParamName ==
"rt") {
1696 }
else if (ParamName ==
"rt-abort") {
1702 }
else if (ParamName ==
"min-rt") {
1708 }
else if (ParamName ==
"min-rt-abort") {
1714 }
else if (ParamName ==
"merge") {
1716 }
else if (ParamName ==
"handler-preserve-all-regs") {
1718 Options.Rt->HandlerPreserveAllRegs =
true;
1722 std::tie(ParamEQ, Val) = ParamName.
split(
'=');
1728 formatv(
"invalid BoundsChecking pass parameter '{}'", ParamName)
1745 if (!
Prefix.empty() || Digit.getAsInteger(10,
N))
1747 Param.str().c_str());
1750 if (!
Level.has_value())
1752 "invalid optimization level for expand-ir-insts pass: %s",
1753 Digit.str().c_str());
1760 if (Params.
empty() || Params ==
"all")
1761 return RAGreedyPass::Options();
1765 return RAGreedyPass::Options{*
Filter, Params};
1768 formatv(
"invalid regallocgreedy register filter '{}'", Params).str(),
1774 "MachineSinkingPass");
1778 bool AllowTailMerge =
true;
1779 if (!Params.
empty()) {
1781 if (Params !=
"tail-merge")
1783 formatv(
"invalid MachineBlockPlacementPass parameter '{}'", Params)
1787 return AllowTailMerge;
1791 bool ClearVirtRegs =
true;
1792 if (!Params.
empty()) {
1794 if (Params !=
"clear-vregs")
1796 formatv(
"invalid VirtRegRewriter pass parameter '{}'", Params).str(),
1799 return ClearVirtRegs;
1802struct FatLTOOptions {
1804 bool ThinLTO =
false;
1805 bool EmitSummary =
false;
1810 bool HaveOptLevel =
false;
1811 while (!Params.
empty()) {
1813 std::tie(ParamName, Params) = Params.
split(
';');
1815 if (ParamName ==
"thinlto") {
1817 }
else if (ParamName ==
"emit-summary") {
1818 Result.EmitSummary =
true;
1819 }
else if (std::optional<OptimizationLevel> OptLevel =
1821 Result.OptLevel = *OptLevel;
1822 HaveOptLevel =
true;
1825 formatv(
"invalid fatlto-pre-link pass parameter '{}'", ParamName)
1832 "missing optimization level for fatlto-pre-link pipeline",
1847template <
typename PassManagerT,
typename CallbacksT>
1849 if (!Callbacks.empty()) {
1850 PassManagerT DummyPM;
1851 for (
auto &CB : Callbacks)
1852 if (CB(Name, DummyPM, {}))
1858template <
typename CallbacksT>
1860 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1863 if (Name ==
"module")
1865 if (Name ==
"cgscc")
1867 if (NameNoBracket ==
"function")
1869 if (Name ==
"coro-cond")
1872#define MODULE_PASS(NAME, CREATE_PASS) \
1875#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1876 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1878#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1879 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1881#include "PassRegistry.def"
1886template <
typename CallbacksT>
1889 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1890 if (Name ==
"cgscc")
1892 if (NameNoBracket ==
"function")
1899#define CGSCC_PASS(NAME, CREATE_PASS) \
1902#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1903 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1905#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1906 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1908#include "PassRegistry.def"
1913template <
typename CallbacksT>
1916 StringRef NameNoBracket = Name.take_until([](
char C) {
return C ==
'<'; });
1917 if (NameNoBracket ==
"function")
1919 if (Name ==
"loop" || Name ==
"loop-mssa" || Name ==
"machine-function")
1922#define FUNCTION_PASS(NAME, CREATE_PASS) \
1925#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1926 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1928#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1929 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1931#include "PassRegistry.def"
1936template <
typename CallbacksT>
1939 if (Name ==
"machine-function")
1942#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1945#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
1947 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1950#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1951 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1954#include "llvm/Passes/MachinePassRegistry.def"
1959template <
typename CallbacksT>
1961 bool &UseMemorySSA) {
1962 UseMemorySSA =
false;
1965 UseMemorySSA =
true;
1969#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1972#include "PassRegistry.def"
1977template <
typename CallbacksT>
1979 bool &UseMemorySSA) {
1980 UseMemorySSA =
false;
1983 UseMemorySSA =
true;
1987#define LOOP_PASS(NAME, CREATE_PASS) \
1990#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1991 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1993#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1994 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1996#include "PassRegistry.def"
2001std::optional<std::vector<PassBuilder::PipelineElement>>
2003 std::vector<PipelineElement> ResultPipeline;
2008 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
2009 size_t Pos =
Text.find_first_of(
",()");
2010 Pipeline.push_back({
Text.substr(0, Pos), {}});
2013 if (Pos ==
Text.npos)
2016 char Sep =
Text[Pos];
2024 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
2028 assert(Sep ==
')' &&
"Bogus separator!");
2033 if (PipelineStack.
size() == 1)
2034 return std::nullopt;
2037 }
while (
Text.consume_front(
")"));
2045 if (!
Text.consume_front(
","))
2046 return std::nullopt;
2049 if (PipelineStack.
size() > 1)
2051 return std::nullopt;
2053 assert(PipelineStack.
back() == &ResultPipeline &&
2054 "Wrong pipeline at the bottom of the stack!");
2055 return {std::move(ResultPipeline)};
2065 const PipelineElement &
E) {
2066 auto &
Name =
E.Name;
2067 auto &InnerPipeline =
E.InnerPipeline;
2070 if (!InnerPipeline.empty()) {
2071 if (Name ==
"module") {
2073 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2075 MPM.
addPass(std::move(NestedMPM));
2078 if (Name ==
"coro-cond") {
2080 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
2082 MPM.
addPass(CoroConditionalWrapper(std::move(NestedMPM)));
2085 if (Name ==
"cgscc") {
2087 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
2095 "cannot have a no-rerun module to function adaptor",
2098 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2105 for (
auto &
C : ModulePipelineParsingCallbacks)
2106 if (
C(Name, MPM, InnerPipeline))
2111 formatv(
"invalid use of '{}' pass as module pipeline", Name).str(),
2117#define MODULE_PASS(NAME, CREATE_PASS) \
2118 if (Name == NAME) { \
2119 MPM.addPass(CREATE_PASS); \
2120 return Error::success(); \
2122#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2123 if (checkParametrizedPassName(Name, NAME)) { \
2124 auto Params = parsePassParameters(PARSER, Name, NAME); \
2126 return Params.takeError(); \
2127 MPM.addPass(CREATE_PASS(Params.get())); \
2128 return Error::success(); \
2130#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
2131 if (Name == "require<" NAME ">") { \
2133 RequireAnalysisPass< \
2134 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
2135 return Error::success(); \
2137 if (Name == "invalidate<" NAME ">") { \
2138 MPM.addPass(InvalidateAnalysisPass< \
2139 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2140 return Error::success(); \
2142#define CGSCC_PASS(NAME, CREATE_PASS) \
2143 if (Name == NAME) { \
2144 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
2145 return Error::success(); \
2147#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2148 if (checkParametrizedPassName(Name, NAME)) { \
2149 auto Params = parsePassParameters(PARSER, Name, NAME); \
2151 return Params.takeError(); \
2153 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
2154 return Error::success(); \
2156#define FUNCTION_PASS(NAME, CREATE_PASS) \
2157 if (Name == NAME) { \
2158 if constexpr (std::is_constructible_v< \
2159 std::remove_reference_t<decltype(CREATE_PASS)>, \
2160 const TargetMachine &>) { \
2162 return make_error<StringError>( \
2163 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2164 inconvertibleErrorCode()); \
2166 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
2167 return Error::success(); \
2169#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2170 if (checkParametrizedPassName(Name, NAME)) { \
2171 auto Params = parsePassParameters(PARSER, Name, NAME); \
2173 return Params.takeError(); \
2174 auto CreatePass = CREATE_PASS; \
2175 if constexpr (std::is_constructible_v< \
2176 std::remove_reference_t<decltype(CreatePass( \
2178 const TargetMachine &, \
2179 std::remove_reference_t<decltype(Params.get())>>) { \
2181 return make_error<StringError>( \
2182 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2183 inconvertibleErrorCode()); \
2186 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2187 return Error::success(); \
2189#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2190 if (Name == NAME) { \
2191 MPM.addPass(createModuleToFunctionPassAdaptor( \
2192 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2193 return Error::success(); \
2195#define LOOP_PASS(NAME, CREATE_PASS) \
2196 if (Name == NAME) { \
2197 MPM.addPass(createModuleToFunctionPassAdaptor( \
2198 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2199 return Error::success(); \
2201#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2202 if (checkParametrizedPassName(Name, NAME)) { \
2203 auto Params = parsePassParameters(PARSER, Name, NAME); \
2205 return Params.takeError(); \
2206 MPM.addPass(createModuleToFunctionPassAdaptor( \
2207 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2208 return Error::success(); \
2210#include "PassRegistry.def"
2212 for (
auto &
C : ModulePipelineParsingCallbacks)
2213 if (
C(Name, MPM, InnerPipeline))
2216 formatv(
"unknown module pass '{}'", Name).str(),
2221 const PipelineElement &
E) {
2222 auto &
Name =
E.Name;
2223 auto &InnerPipeline =
E.InnerPipeline;
2226 if (!InnerPipeline.empty()) {
2227 if (Name ==
"cgscc") {
2229 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2232 CGPM.
addPass(std::move(NestedCGPM));
2237 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
2241 std::move(FPM), Params->first, Params->second));
2246 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
2253 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2254 if (
C(Name, CGPM, InnerPipeline))
2259 formatv(
"invalid use of '{}' pass as cgscc pipeline", Name).str(),
2264#define CGSCC_PASS(NAME, CREATE_PASS) \
2265 if (Name == NAME) { \
2266 CGPM.addPass(CREATE_PASS); \
2267 return Error::success(); \
2269#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2270 if (checkParametrizedPassName(Name, NAME)) { \
2271 auto Params = parsePassParameters(PARSER, Name, NAME); \
2273 return Params.takeError(); \
2274 CGPM.addPass(CREATE_PASS(Params.get())); \
2275 return Error::success(); \
2277#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
2278 if (Name == "require<" NAME ">") { \
2279 CGPM.addPass(RequireAnalysisPass< \
2280 std::remove_reference_t<decltype(CREATE_PASS)>, \
2281 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
2282 CGSCCUpdateResult &>()); \
2283 return Error::success(); \
2285 if (Name == "invalidate<" NAME ">") { \
2286 CGPM.addPass(InvalidateAnalysisPass< \
2287 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2288 return Error::success(); \
2290#define FUNCTION_PASS(NAME, CREATE_PASS) \
2291 if (Name == NAME) { \
2292 if constexpr (std::is_constructible_v< \
2293 std::remove_reference_t<decltype(CREATE_PASS)>, \
2294 const TargetMachine &>) { \
2296 return make_error<StringError>( \
2297 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2298 inconvertibleErrorCode()); \
2300 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
2301 return Error::success(); \
2303#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2304 if (checkParametrizedPassName(Name, NAME)) { \
2305 auto Params = parsePassParameters(PARSER, Name, NAME); \
2307 return Params.takeError(); \
2308 auto CreatePass = CREATE_PASS; \
2309 if constexpr (std::is_constructible_v< \
2310 std::remove_reference_t<decltype(CreatePass( \
2312 const TargetMachine &, \
2313 std::remove_reference_t<decltype(Params.get())>>) { \
2315 return make_error<StringError>( \
2316 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2317 inconvertibleErrorCode()); \
2320 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
2321 return Error::success(); \
2323#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2324 if (Name == NAME) { \
2325 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2326 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2327 return Error::success(); \
2329#define LOOP_PASS(NAME, CREATE_PASS) \
2330 if (Name == NAME) { \
2331 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2332 createFunctionToLoopPassAdaptor(CREATE_PASS, false))); \
2333 return Error::success(); \
2335#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2336 if (checkParametrizedPassName(Name, NAME)) { \
2337 auto Params = parsePassParameters(PARSER, Name, NAME); \
2339 return Params.takeError(); \
2340 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
2341 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false))); \
2342 return Error::success(); \
2344#include "PassRegistry.def"
2346 for (
auto &
C : CGSCCPipelineParsingCallbacks)
2347 if (
C(Name, CGPM, InnerPipeline))
2354 const PipelineElement &
E) {
2355 auto &
Name =
E.Name;
2356 auto &InnerPipeline =
E.InnerPipeline;
2359 if (!InnerPipeline.empty()) {
2360 if (Name ==
"function") {
2362 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
2365 FPM.
addPass(std::move(NestedFPM));
2368 if (Name ==
"loop" || Name ==
"loop-mssa") {
2370 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
2373 bool UseMemorySSA = (
Name ==
"loop-mssa");
2378 if (Name ==
"machine-function") {
2380 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
2386 for (
auto &
C : FunctionPipelineParsingCallbacks)
2387 if (
C(Name, FPM, InnerPipeline))
2392 formatv(
"invalid use of '{}' pass as function pipeline", Name).str(),
2397#define FUNCTION_PASS(NAME, CREATE_PASS) \
2398 if (Name == NAME) { \
2399 if constexpr (std::is_constructible_v< \
2400 std::remove_reference_t<decltype(CREATE_PASS)>, \
2401 const TargetMachine &>) { \
2403 return make_error<StringError>( \
2404 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2405 inconvertibleErrorCode()); \
2407 FPM.addPass(CREATE_PASS); \
2408 return Error::success(); \
2410#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2411 if (checkParametrizedPassName(Name, NAME)) { \
2412 auto Params = parsePassParameters(PARSER, Name, NAME); \
2414 return Params.takeError(); \
2415 auto CreatePass = CREATE_PASS; \
2416 if constexpr (std::is_constructible_v< \
2417 std::remove_reference_t<decltype(CreatePass( \
2419 const TargetMachine &, \
2420 std::remove_reference_t<decltype(Params.get())>>) { \
2422 return make_error<StringError>( \
2423 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2424 inconvertibleErrorCode()); \
2427 FPM.addPass(CREATE_PASS(Params.get())); \
2428 return Error::success(); \
2430#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2431 if (Name == "require<" NAME ">") { \
2432 if constexpr (std::is_constructible_v< \
2433 std::remove_reference_t<decltype(CREATE_PASS)>, \
2434 const TargetMachine &>) { \
2436 return make_error<StringError>( \
2437 formatv("pass '{0}' requires TargetMachine", Name).str(), \
2438 inconvertibleErrorCode()); \
2441 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2443 return Error::success(); \
2445 if (Name == "invalidate<" NAME ">") { \
2446 FPM.addPass(InvalidateAnalysisPass< \
2447 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2448 return Error::success(); \
2454#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2455 if (Name == NAME) { \
2456 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2457 return Error::success(); \
2459#define LOOP_PASS(NAME, CREATE_PASS) \
2460 if (Name == NAME) { \
2461 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false)); \
2462 return Error::success(); \
2464#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2465 if (checkParametrizedPassName(Name, NAME)) { \
2466 auto Params = parsePassParameters(PARSER, Name, NAME); \
2468 return Params.takeError(); \
2470 createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), false)); \
2471 return Error::success(); \
2473#include "PassRegistry.def"
2475 for (
auto &
C : FunctionPipelineParsingCallbacks)
2476 if (
C(Name, FPM, InnerPipeline))
2479 formatv(
"unknown function pass '{}'", Name).str(),
2484 const PipelineElement &
E) {
2485 StringRef
Name =
E.Name;
2486 auto &InnerPipeline =
E.InnerPipeline;
2489 if (!InnerPipeline.empty()) {
2490 if (Name ==
"loop") {
2492 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
2495 LPM.addPass(std::move(NestedLPM));
2499 for (
auto &
C : LoopPipelineParsingCallbacks)
2500 if (
C(Name, LPM, InnerPipeline))
2505 formatv(
"invalid use of '{}' pass as loop pipeline", Name).str(),
2510#define LOOPNEST_PASS(NAME, CREATE_PASS) \
2511 if (Name == NAME) { \
2512 LPM.addPass(CREATE_PASS); \
2513 return Error::success(); \
2515#define LOOP_PASS(NAME, CREATE_PASS) \
2516 if (Name == NAME) { \
2517 LPM.addPass(CREATE_PASS); \
2518 return Error::success(); \
2520#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2521 if (checkParametrizedPassName(Name, NAME)) { \
2522 auto Params = parsePassParameters(PARSER, Name, NAME); \
2524 return Params.takeError(); \
2525 LPM.addPass(CREATE_PASS(Params.get())); \
2526 return Error::success(); \
2528#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
2529 if (Name == "require<" NAME ">") { \
2530 LPM.addPass(RequireAnalysisPass< \
2531 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
2532 LoopAnalysisManager, LoopStandardAnalysisResults &, \
2534 return Error::success(); \
2536 if (Name == "invalidate<" NAME ">") { \
2537 LPM.addPass(InvalidateAnalysisPass< \
2538 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2539 return Error::success(); \
2541#include "PassRegistry.def"
2543 for (
auto &
C : LoopPipelineParsingCallbacks)
2544 if (
C(Name, LPM, InnerPipeline))
2551 const PipelineElement &
E) {
2552 StringRef
Name =
E.Name;
2554 if (!
E.InnerPipeline.empty()) {
2555 if (
E.Name ==
"machine-function") {
2557 if (
auto Err = parseMachinePassPipeline(NestedPM,
E.InnerPipeline))
2559 MFPM.
addPass(std::move(NestedPM));
2566#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
2567 if (Name == NAME) { \
2568 MFPM.addPass(CREATE_PASS); \
2569 return Error::success(); \
2571#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
2572 if (Name == NAME) { \
2573 MFPM.addPass(CREATE_PASS); \
2574 return Error::success(); \
2576#define MACHINE_FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, \
2578 if (checkParametrizedPassName(Name, NAME)) { \
2579 auto Params = parsePassParameters(PARSER, Name, NAME); \
2581 return Params.takeError(); \
2582 MFPM.addPass(CREATE_PASS(Params.get())); \
2583 return Error::success(); \
2585#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
2586 if (Name == "require<" NAME ">") { \
2588 RequireAnalysisPass<std::remove_reference_t<decltype(CREATE_PASS)>, \
2589 MachineFunction>()); \
2590 return Error::success(); \
2592 if (Name == "invalidate<" NAME ">") { \
2593 MFPM.addPass(InvalidateAnalysisPass< \
2594 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
2595 return Error::success(); \
2597#include "llvm/Passes/MachinePassRegistry.def"
2599 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
2600 if (
C(Name, MFPM,
E.InnerPipeline))
2603 formatv(
"unknown machine pass '{}'", Name).str(),
2608#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2609 if (Name == NAME) { \
2610 AA.registerModuleAnalysis< \
2611 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2614#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
2615 if (Name == NAME) { \
2616 AA.registerFunctionAnalysis< \
2617 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
2620#include "PassRegistry.def"
2622 for (
auto &
C : AAParsingCallbacks)
2628Error PassBuilder::parseMachinePassPipeline(
2630 for (
const auto &Element : Pipeline) {
2631 if (
auto Err = parseMachinePass(MFPM, Element))
2639 for (
const auto &Element : Pipeline) {
2640 if (
auto Err = parseLoopPass(LPM, Element))
2646Error PassBuilder::parseFunctionPassPipeline(
2648 for (
const auto &Element : Pipeline) {
2649 if (
auto Err = parseFunctionPass(FPM, Element))
2657 for (
const auto &Element : Pipeline) {
2658 if (
auto Err = parseCGSCCPass(CGPM, Element))
2690 for (
const auto &Element : Pipeline) {
2691 if (
auto Err = parseModulePass(MPM, Element))
2702 auto Pipeline = parsePipelineText(PipelineText);
2703 if (!Pipeline || Pipeline->empty())
2705 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2715 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2717 FunctionPipelineParsingCallbacks)) {
2718 Pipeline = {{
"function", std::move(*Pipeline)}};
2721 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2722 std::move(*Pipeline)}}}};
2723 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2725 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2726 std::move(*Pipeline)}}}};
2728 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2729 Pipeline = {{
"function", {{
"machine-function", std::move(*Pipeline)}}}};
2731 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2732 if (
C(MPM, *Pipeline))
2736 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2738 formatv(
"unknown {} name '{}'",
2739 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2745 if (
auto Err = parseModulePassPipeline(MPM, *Pipeline))
2753 auto Pipeline = parsePipelineText(PipelineText);
2754 if (!Pipeline || Pipeline->empty())
2756 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2762 formatv(
"unknown cgscc pass '{}' in pipeline '{}'", FirstName,
2767 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2776 auto Pipeline = parsePipelineText(PipelineText);
2777 if (!Pipeline || Pipeline->empty())
2779 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2785 formatv(
"unknown function pass '{}' in pipeline '{}'", FirstName,
2790 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2798 auto Pipeline = parsePipelineText(PipelineText);
2799 if (!Pipeline || Pipeline->empty())
2801 formatv(
"invalid pipeline '{}'", PipelineText).str(),
2804 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2812 auto Pipeline = parsePipelineText(PipelineText);
2813 if (!Pipeline || Pipeline->empty())
2815 formatv(
"invalid machine pass pipeline '{}'", PipelineText).str(),
2818 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2827 if (PipelineText ==
"default") {
2832 while (!PipelineText.
empty()) {
2834 std::tie(Name, PipelineText) = PipelineText.
split(
',');
2835 if (!parseAAPassName(
AA, Name))
2837 formatv(
"unknown alias analysis name '{}'", Name).str(),
2844std::optional<RegAllocFilterFunc>
2846 if (FilterName ==
"all")
2848 for (
auto &
C : RegClassFilterParsingCallbacks)
2849 if (
auto F =
C(FilterName))
2851 return std::nullopt;
2862 auto I = PassNames.
begin();
2863 auto End = PassNames.
end();
2870 OS <<
" " << Name <<
'<' << Params <<
">\n";
2877 OS <<
"Module passes:\n";
2878 static constexpr char ModulePassNames[] = {
"\0"
2879#define MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2880#include "PassRegistry.def"
2884 OS <<
"Module passes with params:\n";
2885 static constexpr char ModulePassNamesWithParams[] = {
"\0"
2886#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2887 NAME "\0" PARAMS "\0"
2888#include "PassRegistry.def"
2892 OS <<
"Module analyses:\n";
2893 static constexpr char ModuleAnalysisNames[] = {
"\0"
2894#define MODULE_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2895#include "PassRegistry.def"
2899 OS <<
"Module alias analyses:\n";
2900 static constexpr char ModuleAliasAnalysisNames[] = {
"\0"
2901#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2902#include "PassRegistry.def"
2906 OS <<
"CGSCC passes:\n";
2907 static constexpr char CGSCCPassNames[] = {
"\0"
2908#define CGSCC_PASS(NAME, CREATE_PASS) NAME "\0"
2909#include "PassRegistry.def"
2913 OS <<
"CGSCC passes with params:\n";
2914 static constexpr char CGSCCPassNamesWithParams[] = {
"\0"
2915#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2916 NAME "\0" PARAMS "\0"
2917#include "PassRegistry.def"
2921 OS <<
"CGSCC analyses:\n";
2922 static constexpr char CGSCCAnalysisNames[] = {
"\0"
2923#define CGSCC_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2924#include "PassRegistry.def"
2928 OS <<
"Function passes:\n";
2929 static constexpr char FunctionPassNames[] = {
"\0"
2930#define FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2931#include "PassRegistry.def"
2935 OS <<
"Function passes with params:\n";
2936 static constexpr char FunctionPassNamesWithParams[] = {
"\0"
2937#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2938 NAME "\0" PARAMS "\0"
2939#include "PassRegistry.def"
2943 OS <<
"Function analyses:\n";
2944 static constexpr char FunctionAnalysisNames[] = {
"\0"
2945#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2946#include "PassRegistry.def"
2950 OS <<
"Function alias analyses:\n";
2951 static constexpr char FunctionAliasAnalysisNames[] = {
"\0"
2952#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2953#include "PassRegistry.def"
2957 OS <<
"LoopNest passes:\n";
2958 static constexpr char LoopNestPassNames[] = {
"\0"
2959#define LOOPNEST_PASS(NAME, CREATE_PASS) NAME "\0"
2960#include "PassRegistry.def"
2964 OS <<
"Loop passes:\n";
2965 static constexpr char LoopPassNames[] = {
"\0"
2966#define LOOP_PASS(NAME, CREATE_PASS) NAME "\0"
2967#include "PassRegistry.def"
2971 OS <<
"Loop passes with params:\n";
2972 static constexpr char LoopPassNamesWithParams[] = {
"\0"
2973#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2974 NAME "\0" PARAMS "\0"
2975#include "PassRegistry.def"
2979 OS <<
"Loop analyses:\n";
2980 static constexpr char LoopAnalysisNames[] = {
"\0"
2981#define LOOP_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
2982#include "PassRegistry.def"
2986 OS <<
"Machine module passes (WIP):\n";
2987 static constexpr char MachineModulePassNames[] = {
"\0"
2988#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) NAME "\0"
2989#include "llvm/Passes/MachinePassRegistry.def"
2993 OS <<
"Machine function passes (WIP):\n";
2994 static constexpr char MachineFunctionPassNames[] = {
"\0"
2995#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) NAME "\0"
2996#include "llvm/Passes/MachinePassRegistry.def"
3000 OS <<
"Machine function analyses (WIP):\n";
3001 static constexpr char MachineFunctionAnalysisNames[] = {
"\0"
3002#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) NAME "\0"
3003#include "llvm/Passes/MachinePassRegistry.def"
3011 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.
Machine Check Debug Module
This file contains the declaration of the CheckDebugMachineModulePass class, used by the new pass man...
This file exposes an interface to building/using memory SSA to walk memory instructions using a use/d...
This pass performs merges of loads and stores on both sides of a.
This is the interface to build a ModuleSummaryIndex for a module.
Contains a collection of routines for determining if a given instruction is guaranteed to execute if ...
This file provides the interface for LLVM's Global Value Numbering pass.
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This header enumerates the LLVM-provided high-level optimization levels.
This file provides the interface for IR based instrumentation passes ( (profile-gen,...
CGSCCAnalysisManager CGAM
FunctionAnalysisManager FAM
ModuleAnalysisManager MAM
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC)
static bool isModulePassName(StringRef Name, CallbacksT &Callbacks)
static bool callbacksAcceptPassName(StringRef Name, CallbacksT &Callbacks)
Tests whether registered callbacks will accept a given pass name.
static std::optional< int > parseDevirtPassName(StringRef Name)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameList(StringTable PassNames, raw_ostream &OS)
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static Expected< OptimizationLevel > parseOptLevelParam(StringRef S)
static std::optional< OptimizationLevel > parseOptLevel(StringRef S)
static bool isLoopPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static std::optional< std::pair< bool, bool > > parseFunctionPipelineName(StringRef Name)
static bool isCGSCCPassName(StringRef Name, CallbacksT &Callbacks)
static LLVM_ATTRIBUTE_NOINLINE void printPassNameListWithParams(StringTable PassNames, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static void setupOptionsForPipelineAlias(PipelineTuningOptions &PTO, OptimizationLevel L)
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
This file describes the interface of the MachineFunctionPass responsible for assigning the generic vi...
This pass is required to take advantage of the interprocedural register allocation infrastructure.
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
This file contains the declaration of the ResetMachineFunctionPass class.
This file provides the interface for LLVM's Scalar Replacement of Aggregates pass.
This file provides the interface for the pseudo probe implementation for AutoFDO.
This file provides the interface for the sampled PGO loader pass.
This is the interface for a SCEV-based alias analysis.
This pass converts vector operations into scalar operations (or, optionally, operations on smaller ve...
This is the interface for a metadata-based scoped no-alias analysis.
This file contains the declaration of the SelectOptimizePass class, its corresponding pass name is se...
This file provides the interface for the pass responsible for both simplifying and canonicalizing the...
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This pass strips convergence intrinsics and operand bundles as those are only useful when modifying t...
Target-Independent Code Generator Pass Configuration Options pass.
This is the interface for a metadata-based TBAA.
static const char PassName[]
A manager for alias analyses.
Class for arbitrary precision integers.
uint64_t getZExtValue() const
Get zero extended value.
int64_t getSExtValue() const
Get sign extended value.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction; assumes that the block is well-formed.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
static LLVM_ABI GlobalAlias * create(Type *Ty, unsigned AddressSpace, LinkageTypes Linkage, const Twine &Name, Constant *Aliasee, Module *Parent)
If a parent module is specified, the alias is automatically inserted into the end of the specified mo...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
MachineFunction & getMF()
This analysis create MachineFunction for given Function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineFunctionProperties & getProperties() const
Get the function properties.
LLVM_ABI Register createGenericVirtualRegister(LLT Ty, StringRef Name="")
Create and return a new generic virtual register with low-level type Ty.
This class provides access to building LLVM's passes.
LLVM_ABI void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
LLVM_ABI AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
LLVM_ABI Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
LLVM_ABI void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
LLVM_ABI std::optional< RegAllocFilterFunc > parseRegAllocFilter(StringRef RegAllocFilterName)
Parse RegAllocFilterName to get RegAllocFilterFunc.
LLVM_ABI void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
LLVM_ABI PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr, IntrusiveRefCntPtr< vfs::FileSystem > FS=vfs::getRealFileSystem())
LLVM_ABI Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
void registerPipelineParsingCallback(const std::function< bool(StringRef Name, CGSCCPassManager &, ArrayRef< PipelineElement >)> &C)
{{@ Register pipeline parsing callbacks with this pass builder instance.
LLVM_ABI void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
LLVM_ABI 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.
@ Global
Append to llvm.global_dtors.
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.
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