303 "^(default|thinlto-pre-link|thinlto|lto-pre-link|lto)<(O[0123sz])>$");
307 "print-pipeline-passes",
308 cl::desc(
"Print a '-passes' compatible string describing the pipeline "
309 "(best-effort only)."));
325bool shouldPopulateClassToPassNames() {
333class TriggerCrashPass :
public PassInfoMixin<TriggerCrashPass> {
344class TriggerVerifierErrorPass
352 GlobalValue::LinkageTypes::InternalLinkage,
353 "__bad_alias",
nullptr, &M);
365 static StringRef name() {
return "TriggerVerifierErrorPass"; }
370class RequireAllMachineFunctionPropertiesPass
371 :
public PassInfoMixin<RequireAllMachineFunctionPropertiesPass> {
379 MFProps.
set(MachineFunctionProperties::Property::FailedISel);
380 MFProps.
set(MachineFunctionProperties::Property::FailsVerification);
381 MFProps.
set(MachineFunctionProperties::Property::IsSSA);
382 MFProps.
set(MachineFunctionProperties::Property::Legalized);
383 MFProps.
set(MachineFunctionProperties::Property::NoPHIs);
384 MFProps.
set(MachineFunctionProperties::Property::NoVRegs);
385 MFProps.
set(MachineFunctionProperties::Property::RegBankSelected);
386 MFProps.
set(MachineFunctionProperties::Property::Selected);
387 MFProps.
set(MachineFunctionProperties::Property::TiedOpsRewritten);
388 MFProps.
set(MachineFunctionProperties::Property::TracksDebugUserValues);
389 MFProps.
set(MachineFunctionProperties::Property::TracksLiveness);
392 static StringRef name() {
return "RequireAllMachineFunctionPropertiesPass"; }
398 std::optional<PGOOptions> PGOOpt,
400 :
TM(
TM), PTO(PTO), PGOOpt(PGOOpt),
PIC(
PIC) {
401 bool ShouldPopulateClassToPassNames =
PIC && shouldPopulateClassToPassNames();
403 TM->registerPassBuilderCallbacks(*
this, ShouldPopulateClassToPassNames);
404 if (ShouldPopulateClassToPassNames) {
405#define MODULE_PASS(NAME, CREATE_PASS) \
406 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
407#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
408 PIC->addClassToPassName(CLASS, NAME);
409#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
410 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
411#define FUNCTION_PASS(NAME, CREATE_PASS) \
412 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
413#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
414 PIC->addClassToPassName(CLASS, NAME);
415#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
416 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
417#define LOOPNEST_PASS(NAME, CREATE_PASS) \
418 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
419#define LOOP_PASS(NAME, CREATE_PASS) \
420 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
421#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
422 PIC->addClassToPassName(CLASS, NAME);
423#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
424 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
425#define CGSCC_PASS(NAME, CREATE_PASS) \
426 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
427#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
428 PIC->addClassToPassName(CLASS, NAME);
429#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
430 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
431#include "PassRegistry.def"
433#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
434 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
435#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
436 PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
437#include "llvm/Passes/MachinePassRegistry.def"
442#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
443 MAM.registerPass([&] { return CREATE_PASS; });
444#include "PassRegistry.def"
446 for (
auto &
C : ModuleAnalysisRegistrationCallbacks)
451#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
452 CGAM.registerPass([&] { return CREATE_PASS; });
453#include "PassRegistry.def"
455 for (
auto &
C : CGSCCAnalysisRegistrationCallbacks)
465#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
466 FAM.registerPass([&] { return CREATE_PASS; });
467#include "PassRegistry.def"
469 for (
auto &
C : FunctionAnalysisRegistrationCallbacks)
476#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
477 MFAM.registerPass([&] { return CREATE_PASS; });
478#include "llvm/Passes/MachinePassRegistry.def"
480 for (
auto &
C : MachineFunctionAnalysisRegistrationCallbacks)
485#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
486 LAM.registerPass([&] { return CREATE_PASS; });
487#include "PassRegistry.def"
489 for (
auto &
C : LoopAnalysisRegistrationCallbacks)
494 if (!
Name.consume_front(
"repeat<") || !
Name.consume_back(
">"))
497 if (
Name.getAsInteger(0, Count) || Count <= 0)
502static std::optional<std::pair<bool, bool>>
504 std::pair<bool, bool> Params;
505 if (!
Name.consume_front(
"function"))
509 if (!
Name.consume_front(
"<") || !
Name.consume_back(
">"))
511 while (!
Name.empty()) {
512 auto [Front, Back] =
Name.split(
';');
514 if (Front ==
"eager-inv")
516 else if (Front ==
"no-rerun")
517 Params.second =
true;
525 if (!
Name.consume_front(
"devirt<") || !
Name.consume_back(
">"))
528 if (
Name.getAsInteger(0, Count) || Count < 0)
548 while (!Params.
empty()) {
550 std::tie(ParamName, Params) = Params.
split(
';');
552 if (ParamName == OptionName) {
555 return make_error<StringError>(
570 while (!Params.
empty()) {
572 std::tie(ParamName, Params) = Params.
split(
';');
576 return make_error<StringError>(
577 formatv(
"invalid HardwareLoopPass parameter '{0}' ", ParamName).str(),
582 if (ParamName.
consume_front(
"hardware-loop-counter-bitwidth=")) {
585 return make_error<StringError>(
586 formatv(
"invalid HardwareLoopPass parameter '{0}' ", ParamName).str(),
591 if (ParamName ==
"force-hardware-loops") {
593 }
else if (ParamName ==
"force-hardware-loop-phi") {
595 }
else if (ParamName ==
"force-nested-hardware-loop") {
597 }
else if (ParamName ==
"force-hardware-loop-guard") {
600 return make_error<StringError>(
601 formatv(
"invalid HardwarePass parameter '{0}' ", ParamName).str(),
605 return HardwareLoopOpts;
611 while (!Params.
empty()) {
613 std::tie(ParamName, Params) = Params.
split(
';');
614 std::optional<OptimizationLevel> OptLevel =
parseOptLevel(ParamName);
616 if (OptLevel && !OptLevel->isOptimizingForSize()) {
617 UnrollOpts.
setOptLevel(OptLevel->getSpeedupLevel());
623 return make_error<StringError>(
624 formatv(
"invalid LoopUnrollPass parameter '{0}' ", ParamName).str(),
631 if (ParamName ==
"partial") {
633 }
else if (ParamName ==
"peeling") {
635 }
else if (ParamName ==
"profile-peeling") {
637 }
else if (ParamName ==
"runtime") {
639 }
else if (ParamName ==
"upperbound") {
642 return make_error<StringError>(
643 formatv(
"invalid LoopUnrollPass parameter '{0}' ", ParamName).str(),
652 Params,
"vfe-linkage-unit-visibility",
"GlobalDCE");
672 Params,
"skip-non-recursive-function-attrs",
"PostOrderFunctionAttrs");
681 return make_error<StringError>(
682 formatv(
"too many CFGuardPass parameters '{0}' ", Params).str(),
685 if (Param ==
"check")
687 if (Param ==
"dispatch")
690 return make_error<StringError>(
691 formatv(
"invalid CFGuardPass mechanism: '{0}' ", Param).str(),
701 "EntryExitInstrumenter");
710 "LowerMatrixIntrinsics");
715 while (!Params.
empty()) {
717 std::tie(ParamName, Params) = Params.
split(
';');
719 if (ParamName ==
"kernel") {
720 Result.CompileKernel =
true;
722 return make_error<StringError>(
723 formatv(
"invalid AddressSanitizer pass parameter '{0}' ", ParamName)
733 while (!Params.
empty()) {
735 std::tie(ParamName, Params) = Params.
split(
';');
737 if (ParamName ==
"recover") {
739 }
else if (ParamName ==
"kernel") {
740 Result.CompileKernel =
true;
742 return make_error<StringError>(
743 formatv(
"invalid HWAddressSanitizer pass parameter '{0}' ", ParamName)
753 while (!Params.
empty()) {
755 std::tie(ParamName, Params) = Params.
split(
';');
757 if (ParamName ==
"thinlto") {
759 }
else if (ParamName ==
"emit-summary") {
760 Result.EmitLTOSummary =
true;
762 return make_error<StringError>(
763 formatv(
"invalid EmbedBitcode pass parameter '{0}' ", ParamName)
773 while (!Params.
empty()) {
775 std::tie(ParamName, Params) = Params.
split(
';');
777 if (ParamName ==
"recover") {
779 }
else if (ParamName ==
"kernel") {
783 return make_error<StringError>(
784 formatv(
"invalid argument to MemorySanitizer pass track-origins "
789 }
else if (ParamName ==
"eager-checks") {
790 Result.EagerChecks =
true;
792 return make_error<StringError>(
793 formatv(
"invalid MemorySanitizer pass parameter '{0}' ", ParamName)
804 while (!Params.
empty()) {
806 std::tie(ParamName, Params) = Params.
split(
';');
809 if (ParamName ==
"speculate-blocks") {
811 }
else if (ParamName ==
"simplify-cond-branch") {
813 }
else if (ParamName ==
"forward-switch-cond") {
815 }
else if (ParamName ==
"switch-range-to-icmp") {
817 }
else if (ParamName ==
"switch-to-lookup") {
819 }
else if (ParamName ==
"keep-loops") {
821 }
else if (ParamName ==
"hoist-common-insts") {
823 }
else if (ParamName ==
"sink-common-insts") {
826 APInt BonusInstThreshold;
828 return make_error<StringError>(
829 formatv(
"invalid argument to SimplifyCFG pass bonus-threshold "
835 return make_error<StringError>(
836 formatv(
"invalid SimplifyCFG pass parameter '{0}' ", ParamName).str(),
847 Result.setVerifyFixpoint(
true);
848 while (!Params.
empty()) {
850 std::tie(ParamName, Params) = Params.
split(
';');
853 if (ParamName ==
"use-loop-info") {
855 }
else if (ParamName ==
"verify-fixpoint") {
860 return make_error<StringError>(
861 formatv(
"invalid argument to InstCombine pass max-iterations "
867 return make_error<StringError>(
868 formatv(
"invalid InstCombine pass parameter '{0}' ", ParamName).str(),
878 while (!Params.
empty()) {
880 std::tie(ParamName, Params) = Params.
split(
';');
883 if (ParamName ==
"interleave-forced-only") {
885 }
else if (ParamName ==
"vectorize-forced-only") {
888 return make_error<StringError>(
889 formatv(
"invalid LoopVectorize parameter '{0}' ", ParamName).str(),
897 std::pair<bool, bool>
Result = {
false,
true};
898 while (!Params.
empty()) {
900 std::tie(ParamName, Params) = Params.
split(
';');
903 if (ParamName ==
"nontrivial") {
905 }
else if (ParamName ==
"trivial") {
908 return make_error<StringError>(
909 formatv(
"invalid LoopUnswitch pass parameter '{0}' ", ParamName)
919 while (!Params.
empty()) {
921 std::tie(ParamName, Params) = Params.
split(
';');
924 if (ParamName ==
"allowspeculation") {
927 return make_error<StringError>(
928 formatv(
"invalid LICM pass parameter '{0}' ", ParamName).str(),
936 std::pair<bool, bool>
Result = {
true,
false};
937 while (!Params.
empty()) {
939 std::tie(ParamName, Params) = Params.
split(
';');
942 if (ParamName ==
"header-duplication") {
944 }
else if (ParamName ==
"prepare-for-lto") {
947 return make_error<StringError>(
948 formatv(
"invalid LoopRotate pass parameter '{0}' ", ParamName).str(),
957 while (!Params.
empty()) {
959 std::tie(ParamName, Params) = Params.
split(
';');
962 if (ParamName ==
"split-footer-bb") {
965 return make_error<StringError>(
966 formatv(
"invalid MergedLoadStoreMotion pass parameter '{0}' ",
977 while (!Params.
empty()) {
979 std::tie(ParamName, Params) = Params.
split(
';');
982 if (ParamName ==
"pre") {
984 }
else if (ParamName ==
"load-pre") {
986 }
else if (ParamName ==
"split-backedge-load-pre") {
988 }
else if (ParamName ==
"memdep") {
991 return make_error<StringError>(
992 formatv(
"invalid GVN pass parameter '{0}' ", ParamName).str(),
1001 while (!Params.
empty()) {
1003 std::tie(ParamName, Params) = Params.
split(
';');
1006 if (ParamName ==
"func-spec")
1009 return make_error<StringError>(
1010 formatv(
"invalid IPSCCP pass parameter '{0}' ", ParamName).str(),
1017 if (Params.
empty() || Params ==
"modify-cfg")
1019 if (Params ==
"preserve-cfg")
1021 return make_error<StringError>(
1022 formatv(
"invalid SROA pass parameter '{0}' (either preserve-cfg or "
1023 "modify-cfg can be specified)",
1030parseStackLifetimeOptions(
StringRef Params) {
1032 while (!Params.
empty()) {
1034 std::tie(ParamName, Params) = Params.
split(
';');
1036 if (ParamName ==
"may") {
1038 }
else if (ParamName ==
"must") {
1041 return make_error<StringError>(
1042 formatv(
"invalid StackLifetime parameter '{0}' ", ParamName).str(),
1051 "DependenceAnalysisPrinter");
1056 "SeparateConstOffsetFromGEP");
1060parseFunctionSimplificationPipelineOptions(
StringRef Params) {
1063 return make_error<StringError>(
1064 formatv(
"invalid function-simplification parameter '{0}' ", Params)
1073 "MemorySSAPrinterPass");
1078 "SpeculativeExecutionPass");
1083 while (!Params.
empty()) {
1085 std::tie(ParamName, Params) = Params.
split(
';');
1090 return make_error<StringError>(
1091 formatv(
"invalid MemProfUse pass parameter '{0}' ", ParamName).str(),
1100 "StructuralHashPrinterPass");
1105 "WinEHPreparePass");
1110 while (!Params.
empty()) {
1112 std::tie(ParamName, Params) = Params.
split(
';');
1115 if (ParamName ==
"group-by-use")
1117 else if (ParamName ==
"ignore-single-use")
1119 else if (ParamName ==
"merge-const")
1121 else if (ParamName ==
"merge-external")
1125 return make_error<StringError>(
1126 formatv(
"invalid GlobalMergePass parameter '{0}' ", ParamName)
1139 return Name.starts_with(
"default") ||
Name.starts_with(
"thinlto") ||
1140 Name.starts_with(
"lto");
1151template <
typename PassManagerT,
typename CallbacksT>
1153 if (!Callbacks.empty()) {
1154 PassManagerT DummyPM;
1155 for (
auto &CB : Callbacks)
1156 if (CB(
Name, DummyPM, {}))
1162template <
typename CallbacksT>
1168 StringRef NameNoBracket =
Name.take_until([](
char C) {
return C ==
'<'; });
1171 if (
Name ==
"module")
1173 if (
Name ==
"cgscc")
1175 if (NameNoBracket ==
"function")
1177 if (
Name ==
"coro-cond")
1184#define MODULE_PASS(NAME, CREATE_PASS) \
1187#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1188 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1190#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1191 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1193#include "PassRegistry.def"
1195 return callbacksAcceptPassName<ModulePassManager>(
Name, Callbacks);
1198template <
typename CallbacksT>
1201 StringRef NameNoBracket =
Name.take_until([](
char C) {
return C ==
'<'; });
1202 if (
Name ==
"cgscc")
1204 if (NameNoBracket ==
"function")
1213#define CGSCC_PASS(NAME, CREATE_PASS) \
1216#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1217 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1219#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1220 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1222#include "PassRegistry.def"
1224 return callbacksAcceptPassName<CGSCCPassManager>(
Name, Callbacks);
1227template <
typename CallbacksT>
1230 StringRef NameNoBracket =
Name.take_until([](
char C) {
return C ==
'<'; });
1231 if (NameNoBracket ==
"function")
1233 if (
Name ==
"loop" ||
Name ==
"loop-mssa")
1240#define FUNCTION_PASS(NAME, CREATE_PASS) \
1243#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1244 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1246#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1247 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1249#include "PassRegistry.def"
1251 return callbacksAcceptPassName<FunctionPassManager>(
Name, Callbacks);
1254template <
typename CallbacksT>
1257 if (
Name ==
"machine-function")
1264#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1267#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1268 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1271#include "llvm/Passes/MachinePassRegistry.def"
1273 return callbacksAcceptPassName<MachineFunctionPassManager>(
Name, Callbacks);
1276template <
typename CallbacksT>
1278 bool &UseMemorySSA) {
1279 UseMemorySSA =
false;
1286 UseMemorySSA =
true;
1290#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1293#include "PassRegistry.def"
1295 return callbacksAcceptPassName<LoopPassManager>(
Name, Callbacks);
1298template <
typename CallbacksT>
1300 bool &UseMemorySSA) {
1301 UseMemorySSA =
false;
1308 UseMemorySSA =
true;
1312#define LOOP_PASS(NAME, CREATE_PASS) \
1315#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1316 if (PassBuilder::checkParametrizedPassName(Name, NAME)) \
1318#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1319 if (Name == "require<" NAME ">" || Name == "invalidate<" NAME ">") \
1321#include "PassRegistry.def"
1323 return callbacksAcceptPassName<LoopPassManager>(
Name, Callbacks);
1326std::optional<std::vector<PassBuilder::PipelineElement>>
1327PassBuilder::parsePipelineText(
StringRef Text) {
1328 std::vector<PipelineElement> ResultPipeline;
1333 std::vector<PipelineElement> &Pipeline = *PipelineStack.
back();
1334 size_t Pos =
Text.find_first_of(
",()");
1335 Pipeline.push_back({
Text.substr(0, Pos), {}});
1338 if (Pos ==
Text.npos)
1341 char Sep =
Text[Pos];
1349 PipelineStack.
push_back(&Pipeline.back().InnerPipeline);
1353 assert(Sep ==
')' &&
"Bogus separator!");
1358 if (PipelineStack.
size() == 1)
1359 return std::nullopt;
1362 }
while (
Text.consume_front(
")"));
1370 if (!
Text.consume_front(
","))
1371 return std::nullopt;
1374 if (PipelineStack.
size() > 1)
1376 return std::nullopt;
1378 assert(PipelineStack.
back() == &ResultPipeline &&
1379 "Wrong pipeline at the bottom of the stack!");
1380 return {std::move(ResultPipeline)};
1384 const PipelineElement &E) {
1385 auto &
Name = E.Name;
1386 auto &InnerPipeline = E.InnerPipeline;
1389 if (!InnerPipeline.empty()) {
1390 if (
Name ==
"module") {
1392 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
1397 if (
Name ==
"coro-cond") {
1399 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
1404 if (
Name ==
"cgscc") {
1406 if (
auto Err = parseCGSCCPassPipeline(CGPM, InnerPipeline))
1411 if (
Name ==
"machine-function") {
1413 if (
auto Err = parseMachinePassPipeline(MFPM, InnerPipeline))
1420 return make_error<StringError>(
1421 "cannot have a no-rerun module to function adaptor",
1424 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
1432 if (
auto Err = parseModulePassPipeline(NestedMPM, InnerPipeline))
1438 for (
auto &
C : ModulePipelineParsingCallbacks)
1443 return make_error<StringError>(
1444 formatv(
"invalid use of '{0}' pass as module pipeline",
Name).str(),
1453 return make_error<StringError>(
1454 formatv(
"unknown default pipeline alias '{0}'",
Name).str(),
1457 assert(Matches.
size() == 3 &&
"Must capture two matched strings!");
1469 if (Matches[1] ==
"default") {
1471 }
else if (Matches[1] ==
"thinlto-pre-link") {
1473 }
else if (Matches[1] ==
"thinlto") {
1475 }
else if (Matches[1] ==
"lto-pre-link") {
1484 assert(Matches[1] ==
"lto" &&
"Not one of the matched options!");
1491#define MODULE_PASS(NAME, CREATE_PASS) \
1492 if (Name == NAME) { \
1493 MPM.addPass(CREATE_PASS); \
1494 return Error::success(); \
1496#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1497 if (checkParametrizedPassName(Name, NAME)) { \
1498 auto Params = parsePassParameters(PARSER, Name, NAME); \
1500 return Params.takeError(); \
1501 MPM.addPass(CREATE_PASS(Params.get())); \
1502 return Error::success(); \
1504#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
1505 if (Name == "require<" NAME ">") { \
1507 RequireAnalysisPass< \
1508 std::remove_reference_t<decltype(CREATE_PASS)>, Module>()); \
1509 return Error::success(); \
1511 if (Name == "invalidate<" NAME ">") { \
1512 MPM.addPass(InvalidateAnalysisPass< \
1513 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
1514 return Error::success(); \
1516#define CGSCC_PASS(NAME, CREATE_PASS) \
1517 if (Name == NAME) { \
1518 MPM.addPass(createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS)); \
1519 return Error::success(); \
1521#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1522 if (checkParametrizedPassName(Name, NAME)) { \
1523 auto Params = parsePassParameters(PARSER, Name, NAME); \
1525 return Params.takeError(); \
1527 createModuleToPostOrderCGSCCPassAdaptor(CREATE_PASS(Params.get()))); \
1528 return Error::success(); \
1530#define FUNCTION_PASS(NAME, CREATE_PASS) \
1531 if (Name == NAME) { \
1532 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS)); \
1533 return Error::success(); \
1535#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1536 if (checkParametrizedPassName(Name, NAME)) { \
1537 auto Params = parsePassParameters(PARSER, Name, NAME); \
1539 return Params.takeError(); \
1540 MPM.addPass(createModuleToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
1541 return Error::success(); \
1543#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1544 if (Name == NAME) { \
1545 MPM.addPass(createModuleToFunctionPassAdaptor( \
1546 createFunctionToLoopPassAdaptor(CREATE_PASS, false, false))); \
1547 return Error::success(); \
1549#define LOOP_PASS(NAME, CREATE_PASS) \
1550 if (Name == NAME) { \
1551 MPM.addPass(createModuleToFunctionPassAdaptor( \
1552 createFunctionToLoopPassAdaptor(CREATE_PASS, false, false))); \
1553 return Error::success(); \
1555#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1556 if (checkParametrizedPassName(Name, NAME)) { \
1557 auto Params = parsePassParameters(PARSER, Name, NAME); \
1559 return Params.takeError(); \
1561 createModuleToFunctionPassAdaptor(createFunctionToLoopPassAdaptor( \
1562 CREATE_PASS(Params.get()), false, false))); \
1563 return Error::success(); \
1565#include "PassRegistry.def"
1567 for (
auto &
C : ModulePipelineParsingCallbacks)
1570 return make_error<StringError>(
1576 const PipelineElement &E) {
1577 auto &
Name = E.Name;
1578 auto &InnerPipeline = E.InnerPipeline;
1581 if (!InnerPipeline.empty()) {
1582 if (
Name ==
"cgscc") {
1584 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
1587 CGPM.
addPass(std::move(NestedCGPM));
1592 if (
auto Err = parseFunctionPassPipeline(FPM, InnerPipeline))
1596 std::move(FPM), Params->first, Params->second));
1601 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
1608 if (
auto Err = parseCGSCCPassPipeline(NestedCGPM, InnerPipeline))
1615 for (
auto &
C : CGSCCPipelineParsingCallbacks)
1616 if (
C(
Name, CGPM, InnerPipeline))
1620 return make_error<StringError>(
1621 formatv(
"invalid use of '{0}' pass as cgscc pipeline",
Name).str(),
1626#define CGSCC_PASS(NAME, CREATE_PASS) \
1627 if (Name == NAME) { \
1628 CGPM.addPass(CREATE_PASS); \
1629 return Error::success(); \
1631#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1632 if (checkParametrizedPassName(Name, NAME)) { \
1633 auto Params = parsePassParameters(PARSER, Name, NAME); \
1635 return Params.takeError(); \
1636 CGPM.addPass(CREATE_PASS(Params.get())); \
1637 return Error::success(); \
1639#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
1640 if (Name == "require<" NAME ">") { \
1641 CGPM.addPass(RequireAnalysisPass< \
1642 std::remove_reference_t<decltype(CREATE_PASS)>, \
1643 LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &, \
1644 CGSCCUpdateResult &>()); \
1645 return Error::success(); \
1647 if (Name == "invalidate<" NAME ">") { \
1648 CGPM.addPass(InvalidateAnalysisPass< \
1649 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
1650 return Error::success(); \
1652#define FUNCTION_PASS(NAME, CREATE_PASS) \
1653 if (Name == NAME) { \
1654 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS)); \
1655 return Error::success(); \
1657#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1658 if (checkParametrizedPassName(Name, NAME)) { \
1659 auto Params = parsePassParameters(PARSER, Name, NAME); \
1661 return Params.takeError(); \
1662 CGPM.addPass(createCGSCCToFunctionPassAdaptor(CREATE_PASS(Params.get()))); \
1663 return Error::success(); \
1665#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1666 if (Name == NAME) { \
1667 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
1668 createFunctionToLoopPassAdaptor(CREATE_PASS, false, false))); \
1669 return Error::success(); \
1671#define LOOP_PASS(NAME, CREATE_PASS) \
1672 if (Name == NAME) { \
1673 CGPM.addPass(createCGSCCToFunctionPassAdaptor( \
1674 createFunctionToLoopPassAdaptor(CREATE_PASS, false, false))); \
1675 return Error::success(); \
1677#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1678 if (checkParametrizedPassName(Name, NAME)) { \
1679 auto Params = parsePassParameters(PARSER, Name, NAME); \
1681 return Params.takeError(); \
1683 createCGSCCToFunctionPassAdaptor(createFunctionToLoopPassAdaptor( \
1684 CREATE_PASS(Params.get()), false, false))); \
1685 return Error::success(); \
1687#include "PassRegistry.def"
1689 for (
auto &
C : CGSCCPipelineParsingCallbacks)
1690 if (
C(
Name, CGPM, InnerPipeline))
1692 return make_error<StringError>(
1698 const PipelineElement &E) {
1699 auto &
Name = E.Name;
1700 auto &InnerPipeline = E.InnerPipeline;
1703 if (!InnerPipeline.empty()) {
1704 if (
Name ==
"function") {
1706 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
1709 FPM.
addPass(std::move(NestedFPM));
1712 if (
Name ==
"loop" ||
Name ==
"loop-mssa") {
1714 if (
auto Err = parseLoopPassPipeline(LPM, InnerPipeline))
1717 bool UseMemorySSA = (
Name ==
"loop-mssa");
1719 return Pipeline.Name.contains(
"simple-loop-unswitch");
1721 bool UseBPI =
llvm::any_of(InnerPipeline, [](
auto Pipeline) {
1722 return Pipeline.Name ==
"loop-predication";
1730 if (
auto Err = parseFunctionPassPipeline(NestedFPM, InnerPipeline))
1736 for (
auto &
C : FunctionPipelineParsingCallbacks)
1737 if (
C(
Name, FPM, InnerPipeline))
1741 return make_error<StringError>(
1742 formatv(
"invalid use of '{0}' pass as function pipeline",
Name).str(),
1747#define FUNCTION_PASS(NAME, CREATE_PASS) \
1748 if (Name == NAME) { \
1749 FPM.addPass(CREATE_PASS); \
1750 return Error::success(); \
1752#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1753 if (checkParametrizedPassName(Name, NAME)) { \
1754 auto Params = parsePassParameters(PARSER, Name, NAME); \
1756 return Params.takeError(); \
1757 FPM.addPass(CREATE_PASS(Params.get())); \
1758 return Error::success(); \
1760#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
1761 if (Name == "require<" NAME ">") { \
1763 RequireAnalysisPass< \
1764 std::remove_reference_t<decltype(CREATE_PASS)>, Function>()); \
1765 return Error::success(); \
1767 if (Name == "invalidate<" NAME ">") { \
1768 FPM.addPass(InvalidateAnalysisPass< \
1769 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
1770 return Error::success(); \
1776#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1777 if (Name == NAME) { \
1778 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false, false)); \
1779 return Error::success(); \
1781#define LOOP_PASS(NAME, CREATE_PASS) \
1782 if (Name == NAME) { \
1783 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS, false, false)); \
1784 return Error::success(); \
1786#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1787 if (checkParametrizedPassName(Name, NAME)) { \
1788 auto Params = parsePassParameters(PARSER, Name, NAME); \
1790 return Params.takeError(); \
1791 FPM.addPass(createFunctionToLoopPassAdaptor(CREATE_PASS(Params.get()), \
1793 return Error::success(); \
1795#include "PassRegistry.def"
1797 for (
auto &
C : FunctionPipelineParsingCallbacks)
1798 if (
C(
Name, FPM, InnerPipeline))
1800 return make_error<StringError>(
1801 formatv(
"unknown function pass '{0}'",
Name).str(),
1806 const PipelineElement &E) {
1808 auto &InnerPipeline = E.InnerPipeline;
1811 if (!InnerPipeline.empty()) {
1812 if (
Name ==
"loop") {
1814 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
1817 LPM.
addPass(std::move(NestedLPM));
1822 if (
auto Err = parseLoopPassPipeline(NestedLPM, InnerPipeline))
1828 for (
auto &
C : LoopPipelineParsingCallbacks)
1829 if (
C(
Name, LPM, InnerPipeline))
1833 return make_error<StringError>(
1834 formatv(
"invalid use of '{0}' pass as loop pipeline",
Name).str(),
1839#define LOOPNEST_PASS(NAME, CREATE_PASS) \
1840 if (Name == NAME) { \
1841 LPM.addPass(CREATE_PASS); \
1842 return Error::success(); \
1844#define LOOP_PASS(NAME, CREATE_PASS) \
1845 if (Name == NAME) { \
1846 LPM.addPass(CREATE_PASS); \
1847 return Error::success(); \
1849#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
1850 if (checkParametrizedPassName(Name, NAME)) { \
1851 auto Params = parsePassParameters(PARSER, Name, NAME); \
1853 return Params.takeError(); \
1854 LPM.addPass(CREATE_PASS(Params.get())); \
1855 return Error::success(); \
1857#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
1858 if (Name == "require<" NAME ">") { \
1859 LPM.addPass(RequireAnalysisPass< \
1860 std::remove_reference_t<decltype(CREATE_PASS)>, Loop, \
1861 LoopAnalysisManager, LoopStandardAnalysisResults &, \
1863 return Error::success(); \
1865 if (Name == "invalidate<" NAME ">") { \
1866 LPM.addPass(InvalidateAnalysisPass< \
1867 std::remove_reference_t<decltype(CREATE_PASS)>>()); \
1868 return Error::success(); \
1870#include "PassRegistry.def"
1872 for (
auto &
C : LoopPipelineParsingCallbacks)
1873 if (
C(
Name, LPM, InnerPipeline))
1875 return make_error<StringError>(
formatv(
"unknown loop pass '{0}'",
Name).str(),
1880 const PipelineElement &E) {
1882 if (!E.InnerPipeline.empty())
1883 return make_error<StringError>(
"invalid pipeline",
1886#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) \
1887 if (Name == NAME) { \
1888 MFPM.addPass(CREATE_PASS); \
1889 return Error::success(); \
1891#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) \
1892 if (Name == NAME) { \
1893 MFPM.addPass(CREATE_PASS); \
1894 return Error::success(); \
1896#include "llvm/Passes/MachinePassRegistry.def"
1898 for (
auto &
C : MachineFunctionPipelineParsingCallbacks)
1899 if (
C(
Name, MFPM, E.InnerPipeline))
1901 return make_error<StringError>(
1902 formatv(
"unknown machine pass '{0}'",
Name).str(),
1907#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
1908 if (Name == NAME) { \
1909 AA.registerModuleAnalysis< \
1910 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
1913#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
1914 if (Name == NAME) { \
1915 AA.registerFunctionAnalysis< \
1916 std::remove_reference_t<decltype(CREATE_PASS)>>(); \
1919#include "PassRegistry.def"
1921 for (
auto &
C : AAParsingCallbacks)
1927Error PassBuilder::parseMachinePassPipeline(
1929 for (
const auto &Element : Pipeline) {
1930 if (
auto Err = parseMachinePass(MFPM, Element))
1938 for (
const auto &Element : Pipeline) {
1939 if (
auto Err = parseLoopPass(LPM, Element))
1945Error PassBuilder::parseFunctionPassPipeline(
1947 for (
const auto &Element : Pipeline) {
1948 if (
auto Err = parseFunctionPass(FPM, Element))
1956 for (
const auto &Element : Pipeline) {
1957 if (
auto Err = parseCGSCCPass(CGPM, Element))
1987 for (
const auto &Element : Pipeline) {
1988 if (
auto Err = parseModulePass(
MPM, Element))
1999 auto Pipeline = parsePipelineText(PipelineText);
2000 if (!Pipeline || Pipeline->empty())
2001 return make_error<StringError>(
2002 formatv(
"invalid pipeline '{0}'", PipelineText).str(),
2012 Pipeline = {{
"cgscc", std::move(*Pipeline)}};
2014 FunctionPipelineParsingCallbacks)) {
2015 Pipeline = {{
"function", std::move(*Pipeline)}};
2018 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2019 std::move(*Pipeline)}}}};
2020 }
else if (
isLoopPassName(FirstName, LoopPipelineParsingCallbacks,
2022 Pipeline = {{
"function", {{UseMemorySSA ?
"loop-mssa" :
"loop",
2023 std::move(*Pipeline)}}}};
2025 FirstName, MachineFunctionPipelineParsingCallbacks)) {
2026 Pipeline = {{
"machine-function", std::move(*Pipeline)}};
2028 for (
auto &
C : TopLevelPipelineParsingCallbacks)
2029 if (
C(
MPM, *Pipeline))
2033 auto &InnerPipeline = Pipeline->front().InnerPipeline;
2034 return make_error<StringError>(
2035 formatv(
"unknown {0} name '{1}'",
2036 (InnerPipeline.empty() ?
"pass" :
"pipeline"), FirstName)
2042 if (
auto Err = parseModulePassPipeline(
MPM, *Pipeline))
2050 auto Pipeline = parsePipelineText(PipelineText);
2051 if (!Pipeline || Pipeline->empty())
2052 return make_error<StringError>(
2053 formatv(
"invalid pipeline '{0}'", PipelineText).str(),
2058 return make_error<StringError>(
2059 formatv(
"unknown cgscc pass '{0}' in pipeline '{1}'", FirstName,
2064 if (
auto Err = parseCGSCCPassPipeline(CGPM, *Pipeline))
2073 auto Pipeline = parsePipelineText(PipelineText);
2074 if (!Pipeline || Pipeline->empty())
2075 return make_error<StringError>(
2076 formatv(
"invalid pipeline '{0}'", PipelineText).str(),
2081 return make_error<StringError>(
2082 formatv(
"unknown function pass '{0}' in pipeline '{1}'", FirstName,
2087 if (
auto Err = parseFunctionPassPipeline(FPM, *Pipeline))
2095 auto Pipeline = parsePipelineText(PipelineText);
2096 if (!Pipeline || Pipeline->empty())
2097 return make_error<StringError>(
2098 formatv(
"invalid pipeline '{0}'", PipelineText).str(),
2101 if (
auto Err = parseLoopPassPipeline(CGPM, *Pipeline))
2109 auto Pipeline = parsePipelineText(PipelineText);
2110 if (!Pipeline || Pipeline->empty())
2111 return make_error<StringError>(
2112 formatv(
"invalid machine pass pipeline '{0}'", PipelineText).str(),
2115 if (
auto Err = parseMachinePassPipeline(MFPM, *Pipeline))
2124 if (PipelineText ==
"default") {
2129 while (!PipelineText.
empty()) {
2131 std::tie(
Name, PipelineText) = PipelineText.
split(
',');
2132 if (!parseAAPassName(AA,
Name))
2133 return make_error<StringError>(
2134 formatv(
"unknown alias analysis name '{0}'",
Name).str(),
2146 OS <<
" " <<
PassName <<
"<" << Params <<
">\n";
2152 OS <<
"Module passes:\n";
2153#define MODULE_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2154#include "PassRegistry.def"
2156 OS <<
"Module passes with params:\n";
2157#define MODULE_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2158 printPassName(NAME, PARAMS, OS);
2159#include "PassRegistry.def"
2161 OS <<
"Module analyses:\n";
2162#define MODULE_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2163#include "PassRegistry.def"
2165 OS <<
"Module alias analyses:\n";
2166#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2167#include "PassRegistry.def"
2169 OS <<
"CGSCC passes:\n";
2170#define CGSCC_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2171#include "PassRegistry.def"
2173 OS <<
"CGSCC passes with params:\n";
2174#define CGSCC_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2175 printPassName(NAME, PARAMS, OS);
2176#include "PassRegistry.def"
2178 OS <<
"CGSCC analyses:\n";
2179#define CGSCC_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2180#include "PassRegistry.def"
2182 OS <<
"Function passes:\n";
2183#define FUNCTION_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2184#include "PassRegistry.def"
2186 OS <<
"Function passes with params:\n";
2187#define FUNCTION_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2188 printPassName(NAME, PARAMS, OS);
2189#include "PassRegistry.def"
2191 OS <<
"Function analyses:\n";
2192#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2193#include "PassRegistry.def"
2195 OS <<
"Function alias analyses:\n";
2196#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2197#include "PassRegistry.def"
2199 OS <<
"LoopNest passes:\n";
2200#define LOOPNEST_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2201#include "PassRegistry.def"
2203 OS <<
"Loop passes:\n";
2204#define LOOP_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2205#include "PassRegistry.def"
2207 OS <<
"Loop passes with params:\n";
2208#define LOOP_PASS_WITH_PARAMS(NAME, CLASS, CREATE_PASS, PARSER, PARAMS) \
2209 printPassName(NAME, PARAMS, OS);
2210#include "PassRegistry.def"
2212 OS <<
"Loop analyses:\n";
2213#define LOOP_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2214#include "PassRegistry.def"
2216 OS <<
"Machine module passes (WIP):\n";
2217#define MACHINE_MODULE_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2218#include "llvm/Passes/MachinePassRegistry.def"
2220 OS <<
"Machine function passes (WIP):\n";
2221#define MACHINE_FUNCTION_PASS(NAME, CREATE_PASS) printPassName(NAME, OS);
2222#include "llvm/Passes/MachinePassRegistry.def"
2224 OS <<
"Machine function analyses (WIP):\n";
2225#define MACHINE_FUNCTION_ANALYSIS(NAME, CREATE_PASS) printPassName(NAME, OS);
2226#include "llvm/Passes/MachinePassRegistry.def"
2232 TopLevelPipelineParsingCallbacks.push_back(
C);
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 provides the interface for LLVM's Call Graph Profile pass.
This header provides classes for managing passes over SCCs of the call graph.
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 declares an analysis pass that computes CycleInfo for LLVM IR, specialized from GenericCycl...
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.
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 passes to print out IR in various granularities.
Interfaces for passes which infer implicit function attributes from the name and signature of functio...
This file provides the primary interface to the instcombine pass.
Defines passes for running instruction simplification across chunks of IR.
This file provides the interface for LLVM's PGO Instrumentation lowering pass.
This file contains the declaration of the InterleavedAccessPass class, its corresponding pass name is...
See the comments on JumpThreadingPass.
Implements a lazy call graph analysis and related passes for the new pass manager.
This file defines the interface for the loop cache analysis.
This file provides the interface for LLVM's Loop Data Prefetching Pass.
This file implements the Loop Fusion pass.
This header defines the LoopLoadEliminationPass object.
This file defines the interface for the loop nest analysis.
This header provides classes for managing a pipeline of passes over loops in LLVM IR.
This file provides the interface for the pass responsible for removing expensive ubsan checks.
The header file for the LowerConstantIntrinsics pass as used by the new pass manager.
The header file for the LowerExpectIntrinsic pass as used by the new pass manager.
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
const char LLVMTargetMachineRef TM
PassInstrumentationCallbacks 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 std::optional< int > parseRepeatPassName(StringRef Name)
static bool startsWithDefaultPipelineAliasPrefix(StringRef Name)
Tests whether a pass name starts with a valid prefix for a default pipeline alias.
static bool isLoopNestPassName(StringRef Name, CallbacksT &Callbacks, bool &UseMemorySSA)
static bool isMachineFunctionPassName(StringRef Name, CallbacksT &Callbacks)
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 void printPassName(StringRef PassName, raw_ostream &OS)
static bool isFunctionPassName(StringRef Name, CallbacksT &Callbacks)
static const Regex DefaultAliasRegex("^(default|thinlto-pre-link|thinlto|lto-pre-link|lto)<(O[0123sz])>$")
This header defines various interfaces for pass management in LLVM.
This file implements the PredicateInfo analysis, which creates an Extended SSA form for operations us...
This file implements relative lookup table converter that converts lookup tables to relative lookup t...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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...
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.
A container for analyses that lazily runs them and caches their results.
bool registerPass(PassBuilderT &&PassBuilder)
Register an analysis pass with the manager.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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 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...
An analysis over an "outer" IR unit that provides access to an analysis manager over an "inner" IR un...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
A Module instance is used to store all the information related to an LLVM module.
static const OptimizationLevel O3
Optimize for fast execution as much as possible.
static const OptimizationLevel Oz
A very specialized mode that will optimize for code size at any and all costs.
static const OptimizationLevel O0
Disable as many optimizations as possible.
static const OptimizationLevel Os
Similar to O2 but tries to optimize for small code size instead of fast execution without triggering ...
static const OptimizationLevel O2
Optimize for fast execution as much as possible without triggering significant incremental compile ti...
static const OptimizationLevel O1
Optimize quickly without destroying debuggability.
void printPassNames(raw_ostream &OS)
Print pass names.
static bool checkParametrizedPassName(StringRef Name, StringRef PassName)
AAManager buildDefaultAAPipeline()
Build the default AAManager with the default alias analysis pipeline registered.
Error parseAAPipeline(AAManager &AA, StringRef PipelineText)
Parse a textual alias analysis pipeline into the provided AA manager.
ModulePassManager buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, ThinLTO-targeting default optimization pipeline to a pass manager.
PassBuilder(TargetMachine *TM=nullptr, PipelineTuningOptions PTO=PipelineTuningOptions(), std::optional< PGOOptions > PGOOpt=std::nullopt, PassInstrumentationCallbacks *PIC=nullptr)
void registerLoopAnalyses(LoopAnalysisManager &LAM)
Registers all available loop analysis passes.
void crossRegisterProxies(LoopAnalysisManager &LAM, FunctionAnalysisManager &FAM, CGSCCAnalysisManager &CGAM, ModuleAnalysisManager &MAM, MachineFunctionAnalysisManager *MFAM=nullptr)
Cross register the analysis managers through their proxies.
ModulePassManager buildPerModuleDefaultPipeline(OptimizationLevel Level, bool LTOPreLink=false)
Build a per-module default optimization pipeline.
Error parsePassPipeline(ModulePassManager &MPM, StringRef PipelineText)
Parse a textual pass pipeline description into a ModulePassManager.
ModulePassManager buildLTODefaultPipeline(OptimizationLevel Level, ModuleSummaryIndex *ExportSummary)
Build an LTO default optimization pipeline to a pass manager.
ModulePassManager buildThinLTODefaultPipeline(OptimizationLevel Level, const ModuleSummaryIndex *ImportSummary)
Build a ThinLTO default optimization pipeline to a pass manager.
void registerModuleAnalyses(ModuleAnalysisManager &MAM)
Registers all available module analysis passes.
void registerCGSCCAnalyses(CGSCCAnalysisManager &CGAM)
Registers all available CGSCC analysis passes.
static Expected< bool > parseSinglePassOption(StringRef Params, StringRef OptionName, StringRef PassName)
Handle passes only accept one bool-valued parameter.
void registerMachineFunctionAnalyses(MachineFunctionAnalysisManager &MFAM)
Registers all available machine function analysis passes.
void registerParseTopLevelPipelineCallback(const std::function< bool(ModulePassManager &, ArrayRef< PipelineElement >)> &C)
Register a callback for a top-level pipeline entry.
ModulePassManager buildLTOPreLinkDefaultPipeline(OptimizationLevel Level)
Build a pre-link, LTO-targeting default optimization pipeline to a pass manager.
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< is_detected< HasRunOnLoopT, PassT >::value > addPass(PassT &&Pass)
LLVM_ATTRIBUTE_MINSIZE void 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 PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
bool match(StringRef String, SmallVectorImpl< StringRef > *Matches=nullptr, std::string *Error=nullptr) const
matches - Match the regex against a given String.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - 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
str - Get the contents as an std::string.
constexpr bool empty() const
empty - Check if the string is empty.
char front() const
front - Get the first character in the string.
bool consume_front(StringRef 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)
Primary interface to the complete machine description for the target machine.
static bool hasLimitedCodeGenPipeline()
Returns true if one of the -start-after, -start-before, -stop-after or -stop-before options is set.
This function has undefined behavior.
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,...
@ C
The default llvm calling convention, compatible with C.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
This is an optimization pass for GlobalISel generic memory operations.
std::vector< std::string > printAfterPasses()
ModuleToFunctionPassAdaptor createModuleToFunctionPassAdaptor(FunctionPassT &&Pass, bool EagerlyInvalidate=false)
A function to deduce a function pass type and wrap it in the templated adaptor.
RepeatedPass< PassT > createRepeatedPass(int Count, PassT &&P)
DevirtSCCRepeatedPass createDevirtSCCRepeatedPass(CGSCCPassT &&Pass, int MaxIterations)
A function to deduce a function pass type and wrap it in the templated adaptor.
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>
OuterAnalysisManagerProxy< ModuleAnalysisManager, MachineFunction > ModuleAnalysisManagerMachineFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
OuterAnalysisManagerProxy< ModuleAnalysisManager, Function > ModuleAnalysisManagerFunctionProxy
Provide the ModuleAnalysisManager to Function proxy.
InnerAnalysisManagerProxy< MachineFunctionAnalysisManager, Module > MachineFunctionAnalysisManagerModuleProxy
OuterAnalysisManagerProxy< ModuleAnalysisManager, LazyCallGraph::SCC, LazyCallGraph & > ModuleAnalysisManagerCGSCCProxy
A proxy from a ModuleAnalysisManager to an SCC.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
std::vector< std::string > printBeforePasses()
ModuleToPostOrderCGSCCPassAdaptor createModuleToPostOrderCGSCCPassAdaptor(CGSCCPassT &&Pass)
A function to deduce a function 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.
InnerAnalysisManagerProxy< FunctionAnalysisManager, Module > FunctionAnalysisManagerModuleProxy
Provide the FunctionAnalysisManager to Module proxy.
ModuleToMachineFunctionPassAdaptor createModuleToMachineFunctionPassAdaptor(MachineFunctionPassT &&Pass)
cl::opt< bool > PrintPipelinePasses("print-pipeline-passes", cl::desc("Print a '-passes' compatible string describing the pipeline " "(best-effort only)."))
OuterAnalysisManagerProxy< FunctionAnalysisManager, Loop, LoopStandardAnalysisResults & > FunctionAnalysisManagerLoopProxy
A proxy from a FunctionAnalysisManager to a Loop.
OuterAnalysisManagerProxy< CGSCCAnalysisManager, Function > CGSCCAnalysisManagerFunctionProxy
A proxy from a CGSCCAnalysisManager to a Function.
std::enable_if_t< is_detected< HasRunOnLoopT, LoopPassT >::value, FunctionToLoopPassAdaptor > createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA=false, bool UseBlockFrequencyInfo=false, bool UseBranchProbabilityInfo=false)
A function to deduce a loop pass type and wrap it in the templated adaptor.
bool isFilterPassesEmpty()
A special type used by analysis passes to provide an address that identifies that particular analysis...
A set of parameters to control various transforms performed by GVN pass.
HardwareLoopOptions & setForceNested(bool Force)
HardwareLoopOptions & setDecrement(unsigned Count)
HardwareLoopOptions & setForceGuard(bool Force)
HardwareLoopOptions & setForce(bool Force)
HardwareLoopOptions & setCounterBitwidth(unsigned Width)
HardwareLoopOptions & setForcePhi(bool Force)
A set of parameters to control various transforms performed by IPSCCP pass.
A set of parameters used to control various transforms performed by the LoopUnroll pass.
LoopUnrollOptions & setPeeling(bool Peeling)
Enables or disables loop peeling.
LoopUnrollOptions & setOptLevel(int O)
LoopUnrollOptions & setPartial(bool Partial)
Enables or disables partial unrolling.
LoopUnrollOptions & setFullUnrollMaxCount(unsigned O)
LoopUnrollOptions & setUpperBound(bool UpperBound)
Enables or disables the use of trip count upper bound in loop unrolling.
LoopUnrollOptions & setRuntime(bool Runtime)
Enables or disables unrolling of loops with runtime trip count.
LoopUnrollOptions & setProfileBasedPeeling(int O)
LoopVectorizeOptions & setVectorizeOnlyWhenForced(bool Value)
LoopVectorizeOptions & setInterleaveOnlyWhenForced(bool Value)
A CRTP mix-in to automatically provide informational APIs needed for passes.
static StringRef name()
Gets the name of the pass we are mixed into.