LLVM
8.0.1
|
This file provides the implementation of the PassBuilder based on our static pass registry as well as related functionality. More...
#include "llvm/Passes/PassBuilder.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AliasAnalysisEvaluator.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFGPrinter.h"
#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/CallGraph.h"
#include "llvm/Analysis/DemandedBits.h"
#include "llvm/Analysis/DependenceAnalysis.h"
#include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/IVUsers.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/LazyValueInfo.h"
#include "llvm/Analysis/LoopAccessAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemoryDependenceAnalysis.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/PhiValues.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
#include "llvm/Analysis/StackSafetyAnalysis.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
#include "llvm/CodeGen/PreISelIntrinsicLowering.h"
#include "llvm/CodeGen/UnreachableBlockElim.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
#include "llvm/Transforms/IPO/AlwaysInliner.h"
#include "llvm/Transforms/IPO/ArgumentPromotion.h"
#include "llvm/Transforms/IPO/CalledValuePropagation.h"
#include "llvm/Transforms/IPO/ConstantMerge.h"
#include "llvm/Transforms/IPO/CrossDSOCFI.h"
#include "llvm/Transforms/IPO/DeadArgumentElimination.h"
#include "llvm/Transforms/IPO/ElimAvailExtern.h"
#include "llvm/Transforms/IPO/ForceFunctionAttrs.h"
#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/Transforms/IPO/FunctionImport.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/IPO/GlobalOpt.h"
#include "llvm/Transforms/IPO/GlobalSplit.h"
#include "llvm/Transforms/IPO/HotColdSplitting.h"
#include "llvm/Transforms/IPO/InferFunctionAttrs.h"
#include "llvm/Transforms/IPO/Inliner.h"
#include "llvm/Transforms/IPO/Internalize.h"
#include "llvm/Transforms/IPO/LowerTypeTests.h"
#include "llvm/Transforms/IPO/PartialInlining.h"
#include "llvm/Transforms/IPO/SCCP.h"
#include "llvm/Transforms/IPO/SampleProfile.h"
#include "llvm/Transforms/IPO/StripDeadPrototypes.h"
#include "llvm/Transforms/IPO/SyntheticCountsPropagation.h"
#include "llvm/Transforms/IPO/WholeProgramDevirt.h"
#include "llvm/Transforms/InstCombine/InstCombine.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Instrumentation/BoundsChecking.h"
#include "llvm/Transforms/Instrumentation/CGProfile.h"
#include "llvm/Transforms/Instrumentation/ControlHeightReduction.h"
#include "llvm/Transforms/Instrumentation/GCOVProfiler.h"
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
#include "llvm/Transforms/Scalar/ADCE.h"
#include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"
#include "llvm/Transforms/Scalar/BDCE.h"
#include "llvm/Transforms/Scalar/CallSiteSplitting.h"
#include "llvm/Transforms/Scalar/ConstantHoisting.h"
#include "llvm/Transforms/Scalar/CorrelatedValuePropagation.h"
#include "llvm/Transforms/Scalar/DCE.h"
#include "llvm/Transforms/Scalar/DeadStoreElimination.h"
#include "llvm/Transforms/Scalar/DivRemPairs.h"
#include "llvm/Transforms/Scalar/EarlyCSE.h"
#include "llvm/Transforms/Scalar/Float2Int.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Scalar/GuardWidening.h"
#include "llvm/Transforms/Scalar/IVUsersPrinter.h"
#include "llvm/Transforms/Scalar/IndVarSimplify.h"
#include "llvm/Transforms/Scalar/InductiveRangeCheckElimination.h"
#include "llvm/Transforms/Scalar/InstSimplifyPass.h"
#include "llvm/Transforms/Scalar/JumpThreading.h"
#include "llvm/Transforms/Scalar/LICM.h"
#include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h"
#include "llvm/Transforms/Scalar/LoopDataPrefetch.h"
#include "llvm/Transforms/Scalar/LoopDeletion.h"
#include "llvm/Transforms/Scalar/LoopDistribute.h"
#include "llvm/Transforms/Scalar/LoopIdiomRecognize.h"
#include "llvm/Transforms/Scalar/LoopInstSimplify.h"
#include "llvm/Transforms/Scalar/LoopLoadElimination.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Scalar/LoopPredication.h"
#include "llvm/Transforms/Scalar/LoopRotation.h"
#include "llvm/Transforms/Scalar/LoopSimplifyCFG.h"
#include "llvm/Transforms/Scalar/LoopSink.h"
#include "llvm/Transforms/Scalar/LoopStrengthReduce.h"
#include "llvm/Transforms/Scalar/LoopUnrollAndJamPass.h"
#include "llvm/Transforms/Scalar/LoopUnrollPass.h"
#include "llvm/Transforms/Scalar/LowerAtomic.h"
#include "llvm/Transforms/Scalar/LowerExpectIntrinsic.h"
#include "llvm/Transforms/Scalar/LowerGuardIntrinsic.h"
#include "llvm/Transforms/Scalar/MakeGuardsExplicit.h"
#include "llvm/Transforms/Scalar/MemCpyOptimizer.h"
#include "llvm/Transforms/Scalar/MergedLoadStoreMotion.h"
#include "llvm/Transforms/Scalar/NaryReassociate.h"
#include "llvm/Transforms/Scalar/NewGVN.h"
#include "llvm/Transforms/Scalar/PartiallyInlineLibCalls.h"
#include "llvm/Transforms/Scalar/Reassociate.h"
#include "llvm/Transforms/Scalar/RewriteStatepointsForGC.h"
#include "llvm/Transforms/Scalar/SCCP.h"
#include "llvm/Transforms/Scalar/SROA.h"
#include "llvm/Transforms/Scalar/Scalarizer.h"
#include "llvm/Transforms/Scalar/SimpleLoopUnswitch.h"
#include "llvm/Transforms/Scalar/SimplifyCFG.h"
#include "llvm/Transforms/Scalar/Sink.h"
#include "llvm/Transforms/Scalar/SpeculateAroundPHIs.h"
#include "llvm/Transforms/Scalar/SpeculativeExecution.h"
#include "llvm/Transforms/Scalar/TailRecursionElimination.h"
#include "llvm/Transforms/Scalar/WarnMissedTransforms.h"
#include "llvm/Transforms/Utils/AddDiscriminators.h"
#include "llvm/Transforms/Utils/BreakCriticalEdges.h"
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
#include "llvm/Transforms/Utils/EntryExitInstrumenter.h"
#include "llvm/Transforms/Utils/LCSSA.h"
#include "llvm/Transforms/Utils/LibCallsShrinkWrap.h"
#include "llvm/Transforms/Utils/LoopSimplify.h"
#include "llvm/Transforms/Utils/LowerInvoke.h"
#include "llvm/Transforms/Utils/Mem2Reg.h"
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
#include "llvm/Transforms/Utils/SymbolRewriter.h"
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
#include "PassRegistry.def"
Go to the source code of this file.
Macros | |
#define | MODULE_ANALYSIS(NAME, CREATE_PASS) MAM.registerPass([&] { return CREATE_PASS; }); |
#define | CGSCC_ANALYSIS(NAME, CREATE_PASS) CGAM.registerPass([&] { return CREATE_PASS; }); |
#define | FUNCTION_ANALYSIS(NAME, CREATE_PASS) FAM.registerPass([&] { return CREATE_PASS; }); |
#define | LOOP_ANALYSIS(NAME, CREATE_PASS) LAM.registerPass([&] { return CREATE_PASS; }); |
#define | MODULE_PASS(NAME, CREATE_PASS) |
#define | MODULE_ANALYSIS(NAME, CREATE_PASS) |
#define | CGSCC_PASS(NAME, CREATE_PASS) |
#define | CGSCC_ANALYSIS(NAME, CREATE_PASS) |
#define | FUNCTION_PASS(NAME, CREATE_PASS) |
#define | FUNCTION_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER) |
#define | FUNCTION_ANALYSIS(NAME, CREATE_PASS) |
#define | LOOP_PASS(NAME, CREATE_PASS) |
#define | LOOP_ANALYSIS(NAME, CREATE_PASS) |
#define | MODULE_PASS(NAME, CREATE_PASS) |
#define | MODULE_ANALYSIS(NAME, CREATE_PASS) |
#define | CGSCC_PASS(NAME, CREATE_PASS) |
#define | CGSCC_ANALYSIS(NAME, CREATE_PASS) |
#define | FUNCTION_PASS(NAME, CREATE_PASS) |
#define | FUNCTION_PASS_WITH_PARAMS(NAME, CREATE_PASS, PARSER) |
#define | FUNCTION_ANALYSIS(NAME, CREATE_PASS) |
#define | LOOP_PASS(NAME, CREATE_PASS) |
#define | LOOP_ANALYSIS(NAME, CREATE_PASS) |
#define | MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) |
#define | FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) |
Functions | |
static bool | isOptimizingForSize (PassBuilder::OptimizationLevel Level) |
static InlineParams | getInlineParamsFromOptLevel (PassBuilder::OptimizationLevel Level) |
static Optional< int > | parseRepeatPassName (StringRef Name) |
static Optional< int > | parseDevirtPassName (StringRef Name) |
static bool | checkParametrizedPassName (StringRef Name, StringRef PassName) |
static bool | startsWithDefaultPipelineAliasPrefix (StringRef Name) |
Tests whether a pass name starts with a valid prefix for a default pipeline alias. More... | |
template<typename PassManagerT , typename CallbacksT > | |
static bool | callbacksAcceptPassName (StringRef Name, CallbacksT &Callbacks) |
Tests whether registered callbacks will accept a given pass name. More... | |
template<typename CallbacksT > | |
static bool | isModulePassName (StringRef Name, CallbacksT &Callbacks) |
template<typename CallbacksT > | |
static bool | isCGSCCPassName (StringRef Name, CallbacksT &Callbacks) |
template<typename CallbacksT > | |
static bool | isFunctionPassName (StringRef Name, CallbacksT &Callbacks) |
template<typename CallbacksT > | |
static bool | isLoopPassName (StringRef Name, CallbacksT &Callbacks) |
Variables | |
static cl::opt< unsigned > | MaxDevirtIterations ("pm-max-devirt-iterations", cl::ReallyHidden, cl::init(4)) |
static cl::opt< bool > | RunPartialInlining ("enable-npm-partial-inlining", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run Partial inlinining pass")) |
static cl::opt< bool > | RunNewGVN ("enable-npm-newgvn", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run NewGVN instead of GVN")) |
static cl::opt< bool > | EnableEarlyCSEMemSSA ("enable-npm-earlycse-memssa", cl::init(true), cl::Hidden, cl::desc("Enable the EarlyCSE w/ MemorySSA pass for the new PM (default = on)")) |
static cl::opt< bool > | EnableGVNHoist ("enable-npm-gvn-hoist", cl::init(false), cl::Hidden, cl::desc("Enable the GVN hoisting pass for the new PM (default = off)")) |
static cl::opt< bool > | EnableGVNSink ("enable-npm-gvn-sink", cl::init(false), cl::Hidden, cl::desc("Enable the GVN hoisting pass for the new PM (default = off)")) |
static cl::opt< bool > | EnableUnrollAndJam ("enable-npm-unroll-and-jam", cl::init(false), cl::Hidden, cl::desc("Enable the Unroll and Jam pass for the new PM (default = off)")) |
static cl::opt< bool > | EnableSyntheticCounts ("enable-npm-synthetic-counts", cl::init(false), cl::Hidden, cl::ZeroOrMore, cl::desc("Run synthetic function entry count generation " "pass")) |
static Regex | DefaultAliasRegex ("^(default|thinlto-pre-link|thinlto|lto-pre-link|lto)<(O[0123sz])>$") |
static cl::opt< bool > | EnableCHR ("enable-chr-npm", cl::init(true), cl::Hidden, cl::desc("Enable control height reduction optimization (CHR)")) |
cl::opt< bool > | EnableHotColdSplit |
This file provides the implementation of the PassBuilder based on our static pass registry as well as related functionality.
It also provides helpers to aid in analyzing, debugging, and testing passes and pass pipelines.
Definition in file PassBuilder.cpp.
#define CGSCC_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) | CGAM.registerPass([&] { return CREATE_PASS; }); |
#define CGSCC_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define CGSCC_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define CGSCC_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define CGSCC_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_ALIAS_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) | FAM.registerPass([&] { return CREATE_PASS; }); |
#define FUNCTION_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define FUNCTION_PASS_WITH_PARAMS | ( | NAME, | |
CREATE_PASS, | |||
PARSER | |||
) |
#define FUNCTION_PASS_WITH_PARAMS | ( | NAME, | |
CREATE_PASS, | |||
PARSER | |||
) |
#define LOOP_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) | LAM.registerPass([&] { return CREATE_PASS; }); |
#define LOOP_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define LOOP_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define LOOP_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define LOOP_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define MODULE_ALIAS_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define MODULE_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) | MAM.registerPass([&] { return CREATE_PASS; }); |
#define MODULE_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define MODULE_ANALYSIS | ( | NAME, | |
CREATE_PASS | |||
) |
#define MODULE_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
#define MODULE_PASS | ( | NAME, | |
CREATE_PASS | |||
) |
|
static |
Tests whether registered callbacks will accept a given pass name.
When parsing a pipeline text, the type of the outermost pipeline may be omitted, in which case the type is automatically determined from the first pass name in the text. This may be a name that is handled through one of the callbacks. We check this through the oridinary parsing callbacks by setting up a dummy PassManager in order to not force the client to also handle this type of query.
Definition at line 1347 of file PassBuilder.cpp.
Definition at line 1246 of file PassBuilder.cpp.
References assert(), llvm::StringSwitch< T, R >::Case(), llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::StringSwitch< T, R >::Default(), llvm::StringRef::empty(), llvm::Enable, llvm::StringRef::endswith(), llvm::formatv(), llvm::inconvertibleErrorCode(), Name, llvm::LoopUnrollOptions::setOptLevel(), llvm::LoopUnrollOptions::setPartial(), llvm::LoopUnrollOptions::setPeeling(), llvm::LoopUnrollOptions::setRuntime(), llvm::LoopUnrollOptions::setUpperBound(), llvm::StringRef::split(), and llvm::StringRef::startswith().
|
static |
Definition at line 577 of file PassBuilder.cpp.
References llvm::getInlineParams(), and llvm::PassBuilder::O3.
Referenced by llvm::PassBuilder::buildLTODefaultPipeline(), and llvm::PassBuilder::buildModuleSimplificationPipeline().
|
static |
Definition at line 1387 of file PassBuilder.cpp.
References Name, parseDevirtPassName(), and parseRepeatPassName().
Referenced by llvm::PassBuilder::parsePassPipeline().
|
static |
Definition at line 1412 of file PassBuilder.cpp.
References Name, and parseRepeatPassName().
Referenced by llvm::PassBuilder::parsePassPipeline().
|
static |
Definition at line 1438 of file PassBuilder.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T >::back(), llvm::StringRef::consume_front(), E, llvm::StringRef::empty(), llvm::StringRef::find_first_of(), Name, llvm::None, llvm::StringRef::npos, parseRepeatPassName(), llvm::SmallVectorTemplateBase< T >::pop_back(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorBase::size(), and llvm::StringRef::substr().
Referenced by llvm::PassBuilder::parsePassPipeline().
|
static |
Definition at line 1358 of file PassBuilder.cpp.
References DefaultAliasRegex, llvm::Regex::match(), Name, parseRepeatPassName(), and startsWithDefaultPipelineAliasPrefix().
Referenced by llvm::PassBuilder::parsePassPipeline().
|
static |
Definition at line 214 of file PassBuilder.cpp.
References llvm::PreservedAnalyses::all(), C, F(), G, llvm_unreachable, name, llvm::PassBuilder::O0, llvm::PassBuilder::O1, llvm::PassBuilder::O2, llvm::PassBuilder::O3, llvm::PassBuilder::Os, and llvm::PassBuilder::Oz.
Referenced by llvm::PassBuilder::buildFunctionSimplificationPipeline().
Definition at line 1237 of file PassBuilder.cpp.
References llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::StringRef::getAsInteger(), and llvm::None.
Referenced by isCGSCCPassName().
Definition at line 1228 of file PassBuilder.cpp.
References llvm::StringRef::consume_back(), llvm::StringRef::consume_front(), llvm::StringRef::getAsInteger(), and llvm::None.
Referenced by isCGSCCPassName(), isFunctionPassName(), isLoopPassName(), and isModulePassName().
Tests whether a pass name starts with a valid prefix for a default pipeline alias.
Definition at line 1333 of file PassBuilder.cpp.
References llvm::StringRef::startswith().
Referenced by isModulePassName().
|
static |
Referenced by isModulePassName().
|
static |
Referenced by llvm::PassBuilder::buildFunctionSimplificationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildFunctionSimplificationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildFunctionSimplificationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildFunctionSimplificationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildModuleSimplificationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildModuleOptimizationPipeline().
|
static |
Referenced by llvm::PassBuilder::buildModuleSimplificationPipeline().