[PassManager] Make passes inherit from RequiredPassInfoMixin/OptionalPassInfoMixin (#192120)

It's very easy to forget to add `isRequired() { return true; }` for
passes that must be run on all IR, rather than e.g. being skipped on
optnone functions.

This PR adds RequiredPassInfoMixin/OptionalPassInfoMixin which have
`isRequired()`, and the long term vision is there to be no default
`isRequired()` on PassInfoMixin.

However, for out-of-tree migration purposes, we leave a `isRequired() {
return false; }` for now in PassInfoMixin.


https://discourse.llvm.org/t/rfc-introduce-mandatorypassinfomixin-optionalpassinfomixin-for-required-not-required-passes/90547

Assisted-by: Gemini
This commit is contained in:
Arthur Eubanks 2026-05-06 10:00:07 -07:00 committed by GitHub
parent 0e6d576485
commit 11729f768a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
452 changed files with 869 additions and 943 deletions

View file

@ -27,7 +27,7 @@ using namespace clang;
namespace {
class PrintPass final : public llvm::AnalysisInfoMixin<PrintPass> {
class PrintPass final : public llvm::RequiredPassInfoMixin<PrintPass> {
friend struct llvm::AnalysisInfoMixin<PrintPass>;
public:
@ -38,7 +38,6 @@ public:
llvm::outs() << "[PrintPass] Found function: " << F.getName() << "\n";
return llvm::PreservedAnalyses::all();
}
static bool isRequired() { return true; }
};
void PrintCallback(llvm::PassBuilder &PB) {

View file

@ -26,14 +26,13 @@ class Pass;
/// Create and return a pass that links in Moduels from a provided
/// BackendConsumer to a given primary Module. Note that this pass is designed
/// for use with the legacy pass manager.
class LinkInModulesPass : public PassInfoMixin<LinkInModulesPass> {
class LinkInModulesPass : public RequiredPassInfoMixin<LinkInModulesPass> {
clang::BackendConsumer *BC;
public:
LinkInModulesPass(clang::BackendConsumer *BC);
PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -25,7 +25,8 @@ Unlike passes under the legacy pass manager where the pass interface is
defined via inheritance, passes under the new pass manager rely on
concept-based polymorphism, meaning there is no explicit interface (see
comments in ``PassManager.h`` for more details). All LLVM passes inherit from
the CRTP mix-in ``PassInfoMixin<PassT>``. The pass should have a ``run()``
the CRTP mix-in ``OptionalPassInfoMixin<PassT>`` or
``RequiredPassInfoMixin<PassT>``. The pass should have a ``run()``
method which returns a ``PreservedAnalyses`` and takes in some unit of IR
along with an analysis manager. For example, a function pass would have a
``PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);`` method.
@ -82,7 +83,7 @@ contain the following boilerplate:
namespace llvm {
class HelloWorldPass : public PassInfoMixin<HelloWorldPass> {
class HelloWorldPass : public OptionalPassInfoMixin<HelloWorldPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
@ -92,8 +93,12 @@ contain the following boilerplate:
#endif // LLVM_TRANSFORMS_HELLONEW_HELLOWORLD_H
This creates the class for the pass with a declaration of the ``run()``
method which actually runs the pass. Inheriting from ``PassInfoMixin<PassT>``
sets up some more boilerplate so that we don't have to write it ourselves.
method which actually runs the pass. Inheriting from
``OptionalPassInfoMixin<PassT>`` or ``RequiredPassInfoMixin<PassT>`` sets up
some more boilerplate so that we don't have to write it ourselves.
``RequiredPassInfoMixin`` should be used for passes that cannot be skipped
(e.g. ``AlwaysInlinerPass``), while ``OptionalPassInfoMixin`` should be used
for passes that can be skipped (e.g. optimization passes).
Our class is in the ``llvm`` namespace so that we don't pollute the global
namespace.
@ -210,15 +215,13 @@ FAQs
Required passes
---------------
A pass that defines a static ``isRequired()`` method that returns true is a required pass. For example:
A pass that inherits from ``RequiredPassInfoMixin<PassT>`` is a required pass. For example:
.. code-block:: c++
class HelloWorldPass : public PassInfoMixin<HelloWorldPass> {
class HelloWorldPass : public RequiredPassInfoMixin<HelloWorldPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
A required pass is a pass that may not be skipped. An example of a required

View file

@ -30,7 +30,7 @@ struct LegacyBye : public FunctionPass {
bool runOnFunction(Function &F) override { return runBye(F); }
};
struct Bye : PassInfoMixin<Bye> {
struct Bye : OptionalPassInfoMixin<Bye> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &) {
if (!runBye(F))
return PreservedAnalyses::all();

View file

@ -368,7 +368,7 @@ static bool doSimplify_v3(Function &F, DominatorTree &DT) {
}
namespace {
struct SimplifyCFGPass : public PassInfoMixin<SimplifyCFGPass> {
struct SimplifyCFGPass : public OptionalPassInfoMixin<SimplifyCFGPass> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM) {
switch (Version) {
case V1:

View file

@ -31,7 +31,7 @@ namespace llvm {
class AAResults;
class Function;
class AAEvaluator : public PassInfoMixin<AAEvaluator> {
class AAEvaluator : public OptionalPassInfoMixin<AAEvaluator> {
int64_t FunctionCount = 0;
int64_t NoAliasCount = 0, MayAliasCount = 0, PartialAliasCount = 0;
int64_t MustAliasCount = 0;

View file

@ -270,13 +270,13 @@ inline raw_ostream& operator<<(raw_ostream &OS, const AliasSetTracker &AST) {
return OS;
}
class AliasSetsPrinterPass : public PassInfoMixin<AliasSetsPrinterPass> {
class AliasSetsPrinterPass
: public RequiredPassInfoMixin<AliasSetsPrinterPass> {
raw_ostream &OS;
public:
LLVM_ABI explicit AliasSetsPrinterPass(raw_ostream &OS);
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -189,15 +189,14 @@ public:
};
/// Printer pass for the \c AssumptionAnalysis results.
class AssumptionPrinterPass : public PassInfoMixin<AssumptionPrinterPass> {
class AssumptionPrinterPass
: public RequiredPassInfoMixin<AssumptionPrinterPass> {
raw_ostream &OS;
public:
explicit AssumptionPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// An immutable pass that tracks lazily created \c AssumptionCache

View file

@ -132,15 +132,13 @@ public:
/// Printer pass for the \c BlockFrequencyInfo results.
class BlockFrequencyPrinterPass
: public PassInfoMixin<BlockFrequencyPrinterPass> {
: public RequiredPassInfoMixin<BlockFrequencyPrinterPass> {
raw_ostream &OS;
public:
explicit BlockFrequencyPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Legacy analysis pass which computes \c BlockFrequencyInfo.

View file

@ -213,15 +213,13 @@ public:
/// Printer pass for the \c BranchProbabilityAnalysis results.
class BranchProbabilityPrinterPass
: public PassInfoMixin<BranchProbabilityPrinterPass> {
: public RequiredPassInfoMixin<BranchProbabilityPrinterPass> {
raw_ostream &OS;
public:
explicit BranchProbabilityPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Legacy analysis pass which computes \c BranchProbabilityInfo.

View file

@ -38,28 +38,24 @@ namespace llvm {
class ModuleSlotTracker;
template <class GraphType> struct GraphTraits;
class CFGViewerPass : public PassInfoMixin<CFGViewerPass> {
class CFGViewerPass : public RequiredPassInfoMixin<CFGViewerPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class CFGOnlyViewerPass : public PassInfoMixin<CFGOnlyViewerPass> {
class CFGOnlyViewerPass : public RequiredPassInfoMixin<CFGOnlyViewerPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class CFGPrinterPass : public PassInfoMixin<CFGPrinterPass> {
class CFGPrinterPass : public RequiredPassInfoMixin<CFGPrinterPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class CFGOnlyPrinterPass : public PassInfoMixin<CFGOnlyPrinterPass> {
class CFGOnlyPrinterPass : public RequiredPassInfoMixin<CFGOnlyPrinterPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class DOTFuncInfo {

View file

@ -13,13 +13,12 @@
namespace llvm {
class CFGSCCPrinterPass : public PassInfoMixin<CFGSCCPrinterPass> {
class CFGSCCPrinterPass : public RequiredPassInfoMixin<CFGSCCPrinterPass> {
raw_ostream &OS;
public:
explicit CFGSCCPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -148,9 +148,9 @@ using CGSCCPassManager =
template <typename AnalysisT>
struct RequireAnalysisPass<AnalysisT, LazyCallGraph::SCC, CGSCCAnalysisManager,
LazyCallGraph &, CGSCCUpdateResult &>
: PassInfoMixin<RequireAnalysisPass<AnalysisT, LazyCallGraph::SCC,
CGSCCAnalysisManager, LazyCallGraph &,
CGSCCUpdateResult &>> {
: RequiredPassInfoMixin<RequireAnalysisPass<
AnalysisT, LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
CGSCCUpdateResult &>> {
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
LazyCallGraph &CG, CGSCCUpdateResult &) {
(void)AM.template getResult<AnalysisT>(C, CG);
@ -313,7 +313,7 @@ struct CGSCCUpdateResult {
/// pass over the module to enable a \c FunctionAnalysisManager to be used
/// within this run safely.
class ModuleToPostOrderCGSCCPassAdaptor
: public PassInfoMixin<ModuleToPostOrderCGSCCPassAdaptor> {
: public RequiredPassInfoMixin<ModuleToPostOrderCGSCCPassAdaptor> {
public:
using PassConceptT =
detail::PassConcept<LazyCallGraph::SCC, CGSCCAnalysisManager,
@ -346,8 +346,6 @@ public:
OS << ')';
}
static bool isRequired() { return true; }
private:
std::unique_ptr<PassConceptT> Pass;
};
@ -445,7 +443,7 @@ LLVM_ABI LazyCallGraph::SCC &updateCGAndAnalysisManagerForCGSCCPass(
/// pass over the SCC to enable a \c FunctionAnalysisManager to be used
/// within this run safely.
class CGSCCToFunctionPassAdaptor
: public PassInfoMixin<CGSCCToFunctionPassAdaptor> {
: public RequiredPassInfoMixin<CGSCCToFunctionPassAdaptor> {
public:
using PassConceptT = detail::PassConcept<Function, FunctionAnalysisManager>;
@ -491,8 +489,6 @@ public:
OS << ')';
}
static bool isRequired() { return true; }
private:
std::unique_ptr<PassConceptT> Pass;
bool EagerlyInvalidate;
@ -544,7 +540,8 @@ public:
/// This repetition has the potential to be very large however, as each one
/// might refine a single call site. As a consequence, in practice we use an
/// upper bound on the number of repetitions to limit things.
class DevirtSCCRepeatedPass : public PassInfoMixin<DevirtSCCRepeatedPass> {
class DevirtSCCRepeatedPass
: public OptionalPassInfoMixin<DevirtSCCRepeatedPass> {
public:
using PassConceptT =
detail::PassConcept<LazyCallGraph::SCC, CGSCCAnalysisManager,

View file

@ -299,28 +299,25 @@ public:
};
/// Printer pass for the \c CallGraphAnalysis results.
class CallGraphPrinterPass : public PassInfoMixin<CallGraphPrinterPass> {
class CallGraphPrinterPass
: public RequiredPassInfoMixin<CallGraphPrinterPass> {
raw_ostream &OS;
public:
explicit CallGraphPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Printer pass for the summarized \c CallGraphAnalysis results.
class CallGraphSCCsPrinterPass
: public PassInfoMixin<CallGraphSCCsPrinterPass> {
: public RequiredPassInfoMixin<CallGraphSCCsPrinterPass> {
raw_ostream &OS;
public:
explicit CallGraphSCCsPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// The \c ModulePass which wraps up a \c CallGraph and the logic to

View file

@ -22,17 +22,16 @@ namespace llvm {
class ModulePass;
/// Pass for printing the call graph to a dot file
class CallGraphDOTPrinterPass : public PassInfoMixin<CallGraphDOTPrinterPass> {
class CallGraphDOTPrinterPass
: public RequiredPassInfoMixin<CallGraphDOTPrinterPass> {
public:
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Pass for viewing the call graph
class CallGraphViewerPass : public PassInfoMixin<CallGraphViewerPass> {
class CallGraphViewerPass : public RequiredPassInfoMixin<CallGraphViewerPass> {
public:
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
LLVM_ABI ModulePass *createCallGraphViewerPass();

View file

@ -13,15 +13,14 @@
namespace llvm {
/// Printer pass for cost modeling results.
class CostModelPrinterPass : public PassInfoMixin<CostModelPrinterPass> {
class CostModelPrinterPass
: public RequiredPassInfoMixin<CostModelPrinterPass> {
raw_ostream &OS;
public:
explicit CostModelPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -147,13 +147,12 @@ public:
};
class CtxProfAnalysisPrinterPass
: public PassInfoMixin<CtxProfAnalysisPrinterPass> {
: public RequiredPassInfoMixin<CtxProfAnalysisPrinterPass> {
public:
enum class PrintMode { Everything, YAML };
LLVM_ABI explicit CtxProfAnalysisPrinterPass(raw_ostream &OS);
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
private:
raw_ostream &OS;
@ -197,7 +196,7 @@ public:
// the pass pipeline, associate it with any Global Value, and then use it for
// PGO and ThinLTO.
// At that point, this should be moved elsewhere.
class AssignGUIDPass : public PassInfoMixin<AssignGUIDPass> {
class AssignGUIDPass : public OptionalPassInfoMixin<AssignGUIDPass> {
public:
explicit AssignGUIDPass() = default;

View file

@ -62,18 +62,18 @@ public:
// TODO: verify analysis?
};
class CycleInfoPrinterPass : public PassInfoMixin<CycleInfoPrinterPass> {
class CycleInfoPrinterPass
: public RequiredPassInfoMixin<CycleInfoPrinterPass> {
raw_ostream &OS;
public:
explicit CycleInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
struct CycleInfoVerifierPass : public PassInfoMixin<CycleInfoVerifierPass> {
struct CycleInfoVerifierPass
: public RequiredPassInfoMixin<CycleInfoVerifierPass> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -421,13 +421,13 @@ private:
};
/// Textual printer pass for the DDG of a loop.
class DDGAnalysisPrinterPass : public PassInfoMixin<DDGAnalysisPrinterPass> {
class DDGAnalysisPrinterPass
: public RequiredPassInfoMixin<DDGAnalysisPrinterPass> {
public:
explicit DDGAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR,
LPMUpdater &U);
static bool isRequired() { return true; }
private:
raw_ostream &OS;

View file

@ -25,11 +25,10 @@ class Loop;
//===--------------------------------------------------------------------===//
// Implementation of DDG DOT Printer for a loop.
//===--------------------------------------------------------------------===//
class DDGDotPrinterPass : public PassInfoMixin<DDGDotPrinterPass> {
class DDGDotPrinterPass : public RequiredPassInfoMixin<DDGDotPrinterPass> {
public:
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);
static bool isRequired() { return true; }
};
//===--------------------------------------------------------------------===//

View file

@ -44,8 +44,8 @@ template <typename AnalysisT, bool IsSimple,
typename AnalysisGraphTraitsT =
DefaultAnalysisGraphTraits<typename AnalysisT::Result &, GraphT>>
struct DOTGraphTraitsViewer
: PassInfoMixin<DOTGraphTraitsViewer<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
: OptionalPassInfoMixin<DOTGraphTraitsViewer<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
DOTGraphTraitsViewer(StringRef GraphName) : Name(GraphName) {}
/// Return true if this function should be processed.
@ -124,8 +124,8 @@ template <typename AnalysisT, bool IsSimple,
typename AnalysisGraphTraitsT =
DefaultAnalysisGraphTraits<typename AnalysisT::Result &, GraphT>>
struct DOTGraphTraitsPrinter
: PassInfoMixin<DOTGraphTraitsPrinter<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
: OptionalPassInfoMixin<DOTGraphTraitsPrinter<AnalysisT, IsSimple, GraphT,
AnalysisGraphTraitsT>> {
DOTGraphTraitsPrinter(StringRef GraphName) : Name(GraphName) {}
/// Return true if this function should be processed.

View file

@ -59,15 +59,13 @@ public:
/// Printer pass for the \c DXILMetadataAnalysis results.
class DXILMetadataAnalysisPrinterPass
: public PassInfoMixin<DXILMetadataAnalysisPrinterPass> {
: public RequiredPassInfoMixin<DXILMetadataAnalysisPrinterPass> {
raw_ostream &OS;
public:
explicit DXILMetadataAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Legacy pass

View file

@ -622,15 +622,14 @@ public:
};
/// Printer pass for the \c DXILResourceAnalysis results.
class DXILResourcePrinterPass : public PassInfoMixin<DXILResourcePrinterPass> {
class DXILResourcePrinterPass
: public RequiredPassInfoMixin<DXILResourcePrinterPass> {
raw_ostream &OS;
public:
explicit DXILResourcePrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
class LLVM_ABI DXILResourceWrapperPass : public ModulePass {

View file

@ -161,10 +161,9 @@ bool getIndexExpressionsFromGEP(ScalarEvolution &SE,
SmallVectorImpl<const SCEV *> &Sizes);
struct DelinearizationPrinterPass
: public PassInfoMixin<DelinearizationPrinterPass> {
: public RequiredPassInfoMixin<DelinearizationPrinterPass> {
explicit DelinearizationPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
private:
raw_ostream &OS;

View file

@ -116,15 +116,14 @@ public:
};
/// Printer pass for DemandedBits
class DemandedBitsPrinterPass : public PassInfoMixin<DemandedBitsPrinterPass> {
class DemandedBitsPrinterPass
: public RequiredPassInfoMixin<DemandedBitsPrinterPass> {
raw_ostream &OS;
public:
explicit DemandedBitsPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -727,14 +727,12 @@ private:
/// Printer pass to dump DA results.
struct DependenceAnalysisPrinterPass
: public PassInfoMixin<DependenceAnalysisPrinterPass> {
: public RequiredPassInfoMixin<DependenceAnalysisPrinterPass> {
DependenceAnalysisPrinterPass(raw_ostream &OS, bool NormalizeResults = false)
: OS(OS), NormalizeResults(NormalizeResults) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
static bool isRequired() { return true; }
private:
raw_ostream &OS;
bool NormalizeResults;

View file

@ -146,15 +146,13 @@ public:
/// Printer pass for the \c DominanceFrontier.
class DominanceFrontierPrinterPass
: public PassInfoMixin<DominanceFrontierPrinterPass> {
: public RequiredPassInfoMixin<DominanceFrontierPrinterPass> {
raw_ostream &OS;
public:
explicit DominanceFrontierPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -173,23 +173,22 @@ public:
/// Printer pass for the FunctionPropertiesAnalysis results.
class FunctionPropertiesPrinterPass
: public PassInfoMixin<FunctionPropertiesPrinterPass> {
: public RequiredPassInfoMixin<FunctionPropertiesPrinterPass> {
raw_ostream &OS;
public:
explicit FunctionPropertiesPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Statistics pass for the FunctionPropertiesAnalysis results.
struct FunctionPropertiesStatisticsPass
: PassInfoMixin<FunctionPropertiesStatisticsPass> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
class FunctionPropertiesStatisticsPass
: public RequiredPassInfoMixin<FunctionPropertiesStatisticsPass> {
public:
explicit FunctionPropertiesStatisticsPass() {}
static bool isRequired() { return true; }
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};
/// Correctly update FunctionPropertiesInfo post-inlining. A

View file

@ -138,7 +138,7 @@ public:
LLVM_ABI GlobalsAAResult run(Module &M, ModuleAnalysisManager &AM);
};
struct RecomputeGlobalsAAPass : PassInfoMixin<RecomputeGlobalsAAPass> {
struct RecomputeGlobalsAAPass : OptionalPassInfoMixin<RecomputeGlobalsAAPass> {
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};

View file

@ -94,7 +94,7 @@ public:
};
class HashRecognizePrinterPass
: public PassInfoMixin<HashRecognizePrinterPass> {
: public OptionalPassInfoMixin<HashRecognizePrinterPass> {
raw_ostream &OS;
public:

View file

@ -652,23 +652,22 @@ public:
/// This pass prints the IR2Vec embeddings for instructions, basic blocks, and
/// functions.
class IR2VecPrinterPass : public PassInfoMixin<IR2VecPrinterPass> {
class IR2VecPrinterPass : public RequiredPassInfoMixin<IR2VecPrinterPass> {
raw_ostream &OS;
public:
explicit IR2VecPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
};
/// This pass prints the embeddings in the vocabulary
class IR2VecVocabPrinterPass : public PassInfoMixin<IR2VecVocabPrinterPass> {
class IR2VecVocabPrinterPass
: public RequiredPassInfoMixin<IR2VecVocabPrinterPass> {
raw_ostream &OS;
public:
explicit IR2VecVocabPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -1195,13 +1195,12 @@ private:
/// Printer pass that uses \c IRSimilarityAnalysis.
class IRSimilarityAnalysisPrinterPass
: public PassInfoMixin<IRSimilarityAnalysisPrinterPass> {
: public RequiredPassInfoMixin<IRSimilarityAnalysisPrinterPass> {
raw_ostream &OS;
public:
explicit IRSimilarityAnalysisPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -339,7 +339,7 @@ private:
/// Printer pass for the InlineAdvisorAnalysis results.
class InlineAdvisorAnalysisPrinterPass
: public PassInfoMixin<InlineAdvisorAnalysisPrinterPass> {
: public RequiredPassInfoMixin<InlineAdvisorAnalysisPrinterPass> {
raw_ostream &OS;
public:
@ -350,7 +350,6 @@ public:
LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &InitialC,
CGSCCAnalysisManager &AM, LazyCallGraph &CG,
CGSCCUpdateResult &UR);
static bool isRequired() { return true; }
};
LLVM_ABI std::unique_ptr<InlineAdvisor>

View file

@ -351,13 +351,12 @@ LLVM_ABI InlineResult isInlineViable(Function &Callee);
// debugging and analysis. The main purpose of the pass is to see and test
// inliner's decisions when creating new optimizations to InlineCost.
struct InlineCostAnnotationPrinterPass
: PassInfoMixin<InlineCostAnnotationPrinterPass> {
: RequiredPassInfoMixin<InlineCostAnnotationPrinterPass> {
raw_ostream &OS;
public:
explicit InlineCostAnnotationPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -19,10 +19,11 @@ namespace llvm {
class Function;
struct InstCountPass : PassInfoMixin<InstCountPass> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &);
class InstCountPass : public RequiredPassInfoMixin<InstCountPass> {
public:
explicit InstCountPass() {}
static bool isRequired() { return true; }
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};
} // end namespace llvm

View file

@ -21,15 +21,13 @@ namespace llvm {
class TargetMachine;
class KernelInfoPrinter : public PassInfoMixin<KernelInfoPrinter> {
class KernelInfoPrinter : public RequiredPassInfoMixin<KernelInfoPrinter> {
TargetMachine *TM;
public:
explicit KernelInfoPrinter(TargetMachine *TM) : TM(TM) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm
#endif // LLVM_ANALYSIS_KERNELINFO_H

View file

@ -1283,30 +1283,26 @@ public:
///
/// This is primarily useful for testing the analysis.
class LazyCallGraphPrinterPass
: public PassInfoMixin<LazyCallGraphPrinterPass> {
: public RequiredPassInfoMixin<LazyCallGraphPrinterPass> {
raw_ostream &OS;
public:
LLVM_ABI explicit LazyCallGraphPrinterPass(raw_ostream &OS);
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// A pass which prints the call graph as a DOT file to a \c raw_ostream.
///
/// This is primarily useful for visualization purposes.
class LazyCallGraphDOTPrinterPass
: public PassInfoMixin<LazyCallGraphDOTPrinterPass> {
: public RequiredPassInfoMixin<LazyCallGraphDOTPrinterPass> {
raw_ostream &OS;
public:
LLVM_ABI explicit LazyCallGraphDOTPrinterPass(raw_ostream &OS);
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
extern template struct LLVM_TEMPLATE_ABI

View file

@ -147,15 +147,13 @@ private:
/// Printer pass for the LazyValueAnalysis results.
class LazyValueInfoPrinterPass
: public PassInfoMixin<LazyValueInfoPrinterPass> {
: public RequiredPassInfoMixin<LazyValueInfoPrinterPass> {
raw_ostream &OS;
public:
explicit LazyValueInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Wrapper around LazyValueInfo.

View file

@ -34,7 +34,7 @@ void lintModule(const Module &M, bool AbortOnError = false);
// Lint a function.
void lintFunction(const Function &F, bool AbortOnError = false);
class LintPass : public PassInfoMixin<LintPass> {
class LintPass : public OptionalPassInfoMixin<LintPass> {
const bool AbortOnError;
public:

View file

@ -278,7 +278,8 @@ raw_ostream &operator<<(raw_ostream &OS, const IndexedReference &R);
raw_ostream &operator<<(raw_ostream &OS, const CacheCost &CC);
/// Printer pass for the \c CacheCost results.
class LoopCachePrinterPass : public PassInfoMixin<LoopCachePrinterPass> {
class LoopCachePrinterPass
: public RequiredPassInfoMixin<LoopCachePrinterPass> {
raw_ostream &OS;
public:
@ -286,8 +287,6 @@ public:
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -595,19 +595,17 @@ public:
};
/// Printer pass for the \c LoopAnalysis results.
class LoopPrinterPass : public PassInfoMixin<LoopPrinterPass> {
class LoopPrinterPass : public RequiredPassInfoMixin<LoopPrinterPass> {
raw_ostream &OS;
public:
explicit LoopPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Verifier pass for the \c LoopAnalysis results.
struct LoopVerifierPass : public PassInfoMixin<LoopVerifierPass> {
struct LoopVerifierPass : public RequiredPassInfoMixin<LoopVerifierPass> {
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// The legacy pass manager's analysis pass to compute loop information.

View file

@ -211,7 +211,7 @@ public:
};
/// Printer pass for the \c LoopNest results.
class LoopNestPrinterPass : public PassInfoMixin<LoopNestPrinterPass> {
class LoopNestPrinterPass : public RequiredPassInfoMixin<LoopNestPrinterPass> {
raw_ostream &OS;
public:
@ -220,8 +220,6 @@ public:
LLVM_ABI PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR,
LPMUpdater &U);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -12,13 +12,12 @@
#include "llvm/IR/PassManager.h"
namespace llvm {
class MemDerefPrinterPass : public PassInfoMixin<MemDerefPrinterPass> {
class MemDerefPrinterPass : public RequiredPassInfoMixin<MemDerefPrinterPass> {
raw_ostream &OS;
public:
MemDerefPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -943,7 +943,8 @@ public:
};
/// Printer pass for \c MemorySSA.
class MemorySSAPrinterPass : public PassInfoMixin<MemorySSAPrinterPass> {
class MemorySSAPrinterPass
: public RequiredPassInfoMixin<MemorySSAPrinterPass> {
raw_ostream &OS;
bool EnsureOptimizedUses;
@ -952,27 +953,22 @@ public:
: OS(OS), EnsureOptimizedUses(EnsureOptimizedUses) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Printer pass for \c MemorySSA via the walker.
class MemorySSAWalkerPrinterPass
: public PassInfoMixin<MemorySSAWalkerPrinterPass> {
: public RequiredPassInfoMixin<MemorySSAWalkerPrinterPass> {
raw_ostream &OS;
public:
explicit MemorySSAWalkerPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Verifier pass for \c MemorySSA.
struct MemorySSAVerifierPass : PassInfoMixin<MemorySSAVerifierPass> {
struct MemorySSAVerifierPass : RequiredPassInfoMixin<MemorySSAVerifierPass> {
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Legacy analysis pass which computes \c MemorySSA.

View file

@ -16,14 +16,13 @@ namespace llvm {
class raw_ostream;
class ModuleDebugInfoPrinterPass
: public PassInfoMixin<ModuleDebugInfoPrinterPass> {
: public RequiredPassInfoMixin<ModuleDebugInfoPrinterPass> {
DebugInfoFinder Finder;
raw_ostream &OS;
public:
explicit ModuleDebugInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -543,23 +543,22 @@ private:
MustBeExecutedIterator EndIterator;
};
class MustExecutePrinterPass : public PassInfoMixin<MustExecutePrinterPass> {
class MustExecutePrinterPass
: public RequiredPassInfoMixin<MustExecutePrinterPass> {
raw_ostream &OS;
public:
MustExecutePrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class MustBeExecutedContextPrinterPass
: public PassInfoMixin<MustBeExecutedContextPrinterPass> {
: public RequiredPassInfoMixin<MustBeExecutedContextPrinterPass> {
raw_ostream &OS;
public:
MustBeExecutedContextPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -127,13 +127,13 @@ public:
/// This pass doesn't print whatever information the PhiValues happens to hold,
/// but instead first uses the PhiValues to analyze all the phis in the function
/// so the complete information is printed.
class PhiValuesPrinterPass : public PassInfoMixin<PhiValuesPrinterPass> {
class PhiValuesPrinterPass
: public RequiredPassInfoMixin<PhiValuesPrinterPass> {
raw_ostream &OS;
public:
explicit PhiValuesPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Wrapper pass for the legacy pass manager

View file

@ -62,15 +62,13 @@ public:
/// Printer pass for the \c PostDominatorTree.
class PostDominatorTreePrinterPass
: public PassInfoMixin<PostDominatorTreePrinterPass> {
: public RequiredPassInfoMixin<PostDominatorTreePrinterPass> {
raw_ostream &OS;
public:
LLVM_ABI explicit PostDominatorTreePrinterPass(raw_ostream &OS);
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
struct LLVM_ABI PostDominatorTreeWrapperPass : public FunctionPass {

View file

@ -387,13 +387,12 @@ private:
/// Printer pass that uses \c ProfileSummaryAnalysis.
class ProfileSummaryPrinterPass
: public PassInfoMixin<ProfileSummaryPrinterPass> {
: public RequiredPassInfoMixin<ProfileSummaryPrinterPass> {
raw_ostream &OS;
public:
explicit ProfileSummaryPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -974,21 +974,19 @@ public:
};
/// Printer pass for the \c RegionInfo.
class RegionInfoPrinterPass : public PassInfoMixin<RegionInfoPrinterPass> {
class RegionInfoPrinterPass
: public RequiredPassInfoMixin<RegionInfoPrinterPass> {
raw_ostream &OS;
public:
explicit RegionInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Verifier pass for the \c RegionInfo.
struct RegionInfoVerifierPass : PassInfoMixin<RegionInfoVerifierPass> {
struct RegionInfoVerifierPass : RequiredPassInfoMixin<RegionInfoVerifierPass> {
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
template <>

View file

@ -2573,23 +2573,20 @@ public:
/// Verifier pass for the \c ScalarEvolutionAnalysis results.
class ScalarEvolutionVerifierPass
: public PassInfoMixin<ScalarEvolutionVerifierPass> {
: public RequiredPassInfoMixin<ScalarEvolutionVerifierPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Printer pass for the \c ScalarEvolutionAnalysis results.
class ScalarEvolutionPrinterPass
: public PassInfoMixin<ScalarEvolutionPrinterPass> {
: public RequiredPassInfoMixin<ScalarEvolutionPrinterPass> {
raw_ostream &OS;
public:
explicit ScalarEvolutionPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
class LLVM_ABI ScalarEvolutionWrapperPass : public FunctionPass {

View file

@ -82,7 +82,8 @@ private:
const SCEV *Denominator, *Quotient, *Remainder, *Zero, *One;
};
class SCEVDivisionPrinterPass : public PassInfoMixin<SCEVDivisionPrinterPass> {
class SCEVDivisionPrinterPass
: public OptionalPassInfoMixin<SCEVDivisionPrinterPass> {
raw_ostream &OS;
void runImpl(Function &F, ScalarEvolution &SE);

View file

@ -180,7 +180,7 @@ inline raw_ostream &operator<<(raw_ostream &OS,
/// Printer pass for testing.
class StackLifetimePrinterPass
: public PassInfoMixin<StackLifetimePrinterPass> {
: public RequiredPassInfoMixin<StackLifetimePrinterPass> {
StackLifetime::LivenessType Type;
raw_ostream &OS;
@ -188,7 +188,7 @@ public:
StackLifetimePrinterPass(raw_ostream &OS, StackLifetime::LivenessType Type)
: Type(Type), OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
};

View file

@ -99,13 +99,13 @@ public:
};
/// Printer pass for the \c StackSafetyAnalysis results.
class StackSafetyPrinterPass : public PassInfoMixin<StackSafetyPrinterPass> {
class StackSafetyPrinterPass
: public RequiredPassInfoMixin<StackSafetyPrinterPass> {
raw_ostream &OS;
public:
explicit StackSafetyPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// StackSafetyInfo wrapper for the legacy pass manager
@ -138,13 +138,12 @@ public:
/// Printer pass for the \c StackSafetyGlobalAnalysis results.
class StackSafetyGlobalPrinterPass
: public PassInfoMixin<StackSafetyGlobalPrinterPass> {
: public RequiredPassInfoMixin<StackSafetyGlobalPrinterPass> {
raw_ostream &OS;
public:
explicit StackSafetyGlobalPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// This pass performs the global (interprocedural) stack safety analysis

View file

@ -21,7 +21,7 @@ enum class StructuralHashOptions {
/// Printer pass for StructuralHashes
class StructuralHashPrinterPass
: public PassInfoMixin<StructuralHashPrinterPass> {
: public RequiredPassInfoMixin<StructuralHashPrinterPass> {
raw_ostream &OS;
const StructuralHashOptions Options;
@ -31,8 +31,6 @@ public:
: OS(OS), Options(Options) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -42,15 +42,13 @@ public:
/// Printer pass for the \c UniformityInfo.
class UniformityInfoPrinterPass
: public PassInfoMixin<UniformityInfoPrinterPass> {
: public RequiredPassInfoMixin<UniformityInfoPrinterPass> {
raw_ostream &OS;
public:
explicit UniformityInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Legacy analysis pass which computes a \ref CycleInfo.

View file

@ -40,7 +40,7 @@ LLVM_ABI bool isBitcodeWriterPass(Pass *P);
///
/// Note that this is intended for use with the new pass manager. To construct
/// a pass for the legacy pass manager, use the function above.
class BitcodeWriterPass : public PassInfoMixin<BitcodeWriterPass> {
class BitcodeWriterPass : public RequiredPassInfoMixin<BitcodeWriterPass> {
raw_ostream &OS;
bool ShouldPreserveUseListOrder;
bool EmitSummaryIndex;
@ -64,10 +64,7 @@ public:
/// Run the bitcode writer pass, and output the module to the selected
/// output stream.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
static bool isRequired() { return true; }
};
}
#endif

View file

@ -113,7 +113,7 @@ public:
};
class DebugAssignmentTrackingPrinterPass
: public PassInfoMixin<DebugAssignmentTrackingPrinterPass> {
: public OptionalPassInfoMixin<DebugAssignmentTrackingPrinterPass> {
raw_ostream &OS;
public:

View file

@ -16,7 +16,7 @@ namespace llvm {
class Function;
class TargetMachine;
class AtomicExpandPass : public PassInfoMixin<AtomicExpandPass> {
class AtomicExpandPass : public OptionalPassInfoMixin<AtomicExpandPass> {
private:
const TargetMachine *TM;

View file

@ -12,7 +12,7 @@
namespace llvm {
class BranchFolderPass : public PassInfoMixin<BranchFolderPass> {
class BranchFolderPass : public OptionalPassInfoMixin<BranchFolderPass> {
bool EnableTailMerge;
public:

View file

@ -13,11 +13,11 @@
namespace llvm {
class BranchRelaxationPass : public PassInfoMixin<BranchRelaxationPass> {
class BranchRelaxationPass
: public RequiredPassInfoMixin<BranchRelaxationPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -21,7 +21,7 @@ namespace llvm {
class Function;
class TargetMachine;
class CodeGenPreparePass : public PassInfoMixin<CodeGenPreparePass> {
class CodeGenPreparePass : public OptionalPassInfoMixin<CodeGenPreparePass> {
private:
const TargetMachine *TM;

View file

@ -22,7 +22,7 @@ class Function;
class TargetMachine;
struct ComplexDeinterleavingPass
: public PassInfoMixin<ComplexDeinterleavingPass> {
: public OptionalPassInfoMixin<ComplexDeinterleavingPass> {
private:
const TargetMachine *TM;

View file

@ -14,7 +14,7 @@
namespace llvm {
class DeadMachineInstructionElimPass
: public PassInfoMixin<DeadMachineInstructionElimPass> {
: public OptionalPassInfoMixin<DeadMachineInstructionElimPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);

View file

@ -116,11 +116,10 @@ private:
BitVector DefinedByCopy;
};
class DetectDeadLanesPass : public PassInfoMixin<DetectDeadLanesPass> {
class DetectDeadLanesPass : public RequiredPassInfoMixin<DetectDeadLanesPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // end namespace llvm

View file

@ -20,7 +20,7 @@ namespace llvm {
class TargetMachine;
class DwarfEHPreparePass : public PassInfoMixin<DwarfEHPreparePass> {
class DwarfEHPreparePass : public OptionalPassInfoMixin<DwarfEHPreparePass> {
const TargetMachine *TM;
public:

View file

@ -13,7 +13,8 @@
namespace llvm {
class EarlyIfConverterPass : public PassInfoMixin<EarlyIfConverterPass> {
class EarlyIfConverterPass
: public OptionalPassInfoMixin<EarlyIfConverterPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);

View file

@ -16,7 +16,7 @@ namespace llvm {
class TargetMachine;
class ExpandIRInstsPass : public PassInfoMixin<ExpandIRInstsPass> {
class ExpandIRInstsPass : public RequiredPassInfoMixin<ExpandIRInstsPass> {
private:
const TargetMachine *TM;
CodeGenOptLevel OptLevel;
@ -25,7 +25,7 @@ public:
explicit ExpandIRInstsPass(const TargetMachine &TM, CodeGenOptLevel OptLevel);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
};

View file

@ -13,13 +13,13 @@
namespace llvm {
class ExpandPostRAPseudosPass : public PassInfoMixin<ExpandPostRAPseudosPass> {
class ExpandPostRAPseudosPass
: public RequiredPassInfoMixin<ExpandPostRAPseudosPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
// We need to expand pseudoinstructions regardless of optimization level or
// otherwise later passes (e.g., AsmPrinter) will fail.
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -14,7 +14,7 @@
namespace llvm {
class ExpandReductionsPass
: public PassInfoMixin<ExpandReductionsPass> {
: public OptionalPassInfoMixin<ExpandReductionsPass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};

View file

@ -13,11 +13,10 @@
namespace llvm {
class FEntryInserterPass : public PassInfoMixin<FEntryInserterPass> {
class FEntryInserterPass : public RequiredPassInfoMixin<FEntryInserterPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -13,10 +13,9 @@
namespace llvm {
class FinalizeISelPass : public PassInfoMixin<FinalizeISelPass> {
class FinalizeISelPass : public RequiredPassInfoMixin<FinalizeISelPass> {
public:
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -14,7 +14,7 @@
namespace llvm {
class FixupStatepointCallerSavedPass
: public PassInfoMixin<FixupStatepointCallerSavedPass> {
: public OptionalPassInfoMixin<FixupStatepointCallerSavedPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);

View file

@ -13,7 +13,8 @@
namespace llvm {
class GCEmptyBasicBlocksPass : public PassInfoMixin<GCEmptyBasicBlocksPass> {
class GCEmptyBasicBlocksPass
: public OptionalPassInfoMixin<GCEmptyBasicBlocksPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);

View file

@ -226,7 +226,7 @@ public:
/// and custom intrinsic lowering.
///
/// This pass requires `CollectorMetadataAnalysis`.
class GCLoweringPass : public PassInfoMixin<GCLoweringPass> {
class GCLoweringPass : public OptionalPassInfoMixin<GCLoweringPass> {
public:
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};

View file

@ -193,7 +193,7 @@ public:
};
class GISelValueTrackingPrinterPass
: public PassInfoMixin<GISelValueTrackingPrinterPass> {
: public OptionalPassInfoMixin<GISelValueTrackingPrinterPass> {
raw_ostream &OS;
public:

View file

@ -40,7 +40,7 @@ struct GlobalMergeOptions {
};
// FIXME: This pass must run before AsmPrinterPass::doInitialization!
class GlobalMergePass : public PassInfoMixin<GlobalMergePass> {
class GlobalMergePass : public OptionalPassInfoMixin<GlobalMergePass> {
const TargetMachine *TM;
GlobalMergeOptions Options;

View file

@ -77,7 +77,7 @@ public:
};
/// Global function merging pass for new pass manager.
struct GlobalMergeFuncPass : public PassInfoMixin<GlobalMergeFuncPass> {
struct GlobalMergeFuncPass : public OptionalPassInfoMixin<GlobalMergeFuncPass> {
const ModuleSummaryIndex *ImportSummary = nullptr;
GlobalMergeFuncPass() = default;
GlobalMergeFuncPass(const ModuleSummaryIndex *ImportSummary)

View file

@ -61,7 +61,7 @@ struct HardwareLoopOptions {
}
};
class HardwareLoopsPass : public PassInfoMixin<HardwareLoopsPass> {
class HardwareLoopsPass : public OptionalPassInfoMixin<HardwareLoopsPass> {
HardwareLoopOptions Opts;
public:

View file

@ -15,7 +15,8 @@ namespace llvm {
class TargetMachine;
class IndirectBrExpandPass : public PassInfoMixin<IndirectBrExpandPass> {
class IndirectBrExpandPass
: public OptionalPassInfoMixin<IndirectBrExpandPass> {
const TargetMachine *TM;
public:

View file

@ -13,11 +13,10 @@
namespace llvm {
class InitUndefPass : public PassInfoMixin<InitUndefPass> {
class InitUndefPass : public RequiredPassInfoMixin<InitUndefPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -13,7 +13,8 @@
namespace llvm {
class InlineAsmPreparePass : public PassInfoMixin<InlineAsmPreparePass> {
class InlineAsmPreparePass
: public OptionalPassInfoMixin<InlineAsmPreparePass> {
public:
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
};

View file

@ -21,7 +21,8 @@ namespace llvm {
class TargetMachine;
class InterleavedAccessPass : public PassInfoMixin<InterleavedAccessPass> {
class InterleavedAccessPass
: public OptionalPassInfoMixin<InterleavedAccessPass> {
const TargetMachine *TM;
public:

View file

@ -16,7 +16,7 @@ namespace llvm {
class TargetMachine;
class InterleavedLoadCombinePass
: public PassInfoMixin<InterleavedLoadCombinePass> {
: public OptionalPassInfoMixin<InterleavedLoadCombinePass> {
const TargetMachine *TM;
public:

View file

@ -13,7 +13,7 @@
namespace llvm {
class JMCInstrumenterPass : public PassInfoMixin<JMCInstrumenterPass> {
class JMCInstrumenterPass : public OptionalPassInfoMixin<JMCInstrumenterPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
};

View file

@ -19,11 +19,10 @@
namespace llvm {
class MachineKCFIPass : public PassInfoMixin<MachineKCFIPass> {
class MachineKCFIPass : public RequiredPassInfoMixin<MachineKCFIPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -13,7 +13,7 @@
namespace llvm {
class LiveDebugValuesPass : public PassInfoMixin<LiveDebugValuesPass> {
class LiveDebugValuesPass : public OptionalPassInfoMixin<LiveDebugValuesPass> {
const bool ShouldEmitDebugEntryValues;
public:

View file

@ -108,7 +108,7 @@ public:
};
class LiveDebugVariablesPrinterPass
: public PassInfoMixin<LiveDebugVariablesPrinterPass> {
: public OptionalPassInfoMixin<LiveDebugVariablesPrinterPass> {
raw_ostream &OS;
public:

View file

@ -528,14 +528,13 @@ public:
};
class LiveIntervalsPrinterPass
: public PassInfoMixin<LiveIntervalsPrinterPass> {
: public RequiredPassInfoMixin<LiveIntervalsPrinterPass> {
raw_ostream &OS;
public:
explicit LiveIntervalsPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
class LLVM_ABI LiveIntervalsWrapperPass : public MachineFunctionPass {

View file

@ -124,7 +124,8 @@ public:
LiveStacks run(MachineFunction &MF, MachineFunctionAnalysisManager &);
};
class LiveStacksPrinterPass : public PassInfoMixin<LiveStacksPrinterPass> {
class LiveStacksPrinterPass
: public OptionalPassInfoMixin<LiveStacksPrinterPass> {
raw_ostream &OS;
public:

View file

@ -310,14 +310,13 @@ public:
};
class LiveVariablesPrinterPass
: public PassInfoMixin<LiveVariablesPrinterPass> {
: public RequiredPassInfoMixin<LiveVariablesPrinterPass> {
raw_ostream &OS;
public:
explicit LiveVariablesPrinterPass(raw_ostream &OS) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
class LLVM_ABI LiveVariablesWrapperPass : public MachineFunctionPass {

View file

@ -14,10 +14,9 @@
namespace llvm {
class LocalStackSlotAllocationPass
: public PassInfoMixin<LocalStackSlotAllocationPass> {
: public RequiredPassInfoMixin<LocalStackSlotAllocationPass> {
public:
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -19,7 +19,7 @@
namespace llvm {
class LowerEmuTLSPass : public PassInfoMixin<LowerEmuTLSPass> {
class LowerEmuTLSPass : public OptionalPassInfoMixin<LowerEmuTLSPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
};

View file

@ -26,23 +26,21 @@ class MachineModuleInfo;
class Module;
template <typename T> class SmallVectorImpl;
class PrintMIRPreparePass : public PassInfoMixin<PrintMIRPreparePass> {
class PrintMIRPreparePass : public RequiredPassInfoMixin<PrintMIRPreparePass> {
raw_ostream &OS;
public:
PrintMIRPreparePass(raw_ostream &OS = errs()) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
class PrintMIRPass : public PassInfoMixin<PrintMIRPass> {
class PrintMIRPass : public RequiredPassInfoMixin<PrintMIRPass> {
raw_ostream &OS;
public:
PrintMIRPass(raw_ostream &OS = errs()) : OS(OS) {}
LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
/// Print LLVM IR using the MIR serialization format to the given output stream.

View file

@ -125,7 +125,7 @@ public:
/// Printer pass for the \c MachineBlockFrequencyInfo results.
class MachineBlockFrequencyPrinterPass
: public PassInfoMixin<MachineBlockFrequencyPrinterPass> {
: public RequiredPassInfoMixin<MachineBlockFrequencyPrinterPass> {
raw_ostream &OS;
public:
@ -133,8 +133,6 @@ public:
LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
class LLVM_ABI MachineBlockFrequencyInfoWrapperPass

View file

@ -118,14 +118,13 @@ public:
/// Printer pass for the \c MachineBlockHashInfoAnalysis results.
class MachineBlockHashInfoPrinterPass
: public PassInfoMixin<MachineBlockHashInfoPrinterPass> {
: public RequiredPassInfoMixin<MachineBlockHashInfoPrinterPass> {
raw_ostream &OS;
public:
explicit MachineBlockHashInfoPrinterPass(raw_ostream &OS) : OS(OS) {}
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
/// Legacy MachineFunctionPass for MachineBlockHashInfo.

View file

@ -14,7 +14,7 @@
namespace llvm {
class MachineBlockPlacementPass
: public PassInfoMixin<MachineBlockPlacementPass> {
: public RequiredPassInfoMixin<MachineBlockPlacementPass> {
bool AllowTailMerge = true;
@ -23,7 +23,6 @@ public:
: AllowTailMerge(AllowTailMerge) {}
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
void
printPipeline(raw_ostream &OS,
@ -31,12 +30,11 @@ public:
};
class MachineBlockPlacementStatsPass
: public PassInfoMixin<MachineBlockPlacementStatsPass> {
: public RequiredPassInfoMixin<MachineBlockPlacementStatsPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);
static bool isRequired() { return true; }
};
} // namespace llvm

View file

@ -66,7 +66,7 @@ public:
};
class MachineBranchProbabilityPrinterPass
: public PassInfoMixin<MachineBranchProbabilityPrinterPass> {
: public OptionalPassInfoMixin<MachineBranchProbabilityPrinterPass> {
raw_ostream &OS;
public:

View file

@ -13,7 +13,7 @@
namespace llvm {
class MachineCSEPass : public PassInfoMixin<MachineCSEPass> {
class MachineCSEPass : public OptionalPassInfoMixin<MachineCSEPass> {
public:
PreservedAnalyses run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM);

View file

@ -14,7 +14,7 @@
namespace llvm {
class MachineCopyPropagationPass
: public PassInfoMixin<MachineCopyPropagationPass> {
: public OptionalPassInfoMixin<MachineCopyPropagationPass> {
bool UseCopyInstr;
public:

Some files were not shown because too many files have changed in this diff Show more