16#include "llvm/Config/llvm-config.h"
30#ifdef EXPENSIVE_CHECKS
36#define DEBUG_TYPE "ir"
51 const std::string &Banner)
const {
60 return "module (" + M.getName().str() +
")";
64 OptPassGate &Gate = M.getContext().getOptPassGate();
70 return Resolver->getAnalysisIfAvailable(&AID) !=
nullptr;
86 return "Unnamed pass: implement Pass::getPassName()";
131 OS <<
"Pass::print not implemented for pass: '" <<
getPassName() <<
"'!\n";
134#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
141#ifdef EXPENSIVE_CHECKS
166 const std::string &Banner)
const {
175 return "function (" +
F.getName().str() +
")";
184 if (
F.hasOptNone()) {
186 <<
F.getName() <<
"\n");
238 GetCFGOnlyPasses(
VectorType &L) : CFGOnlyList(L) {}
240 void passEnumerate(
const PassInfo *
P)
override {
241 if (
P->isCFGOnlyPass())
242 CFGOnlyList.push_back(
P->getTypeInfo());
259 GetCFGOnlyPasses(Preserved).enumeratePasses();
271 pushUnique(Required,
ID);
276 pushUnique(Required, &
ID);
281 pushUnique(Required, &
ID);
282 pushUnique(RequiredTransitive, &
ID);
static std::string getDescription(const CallGraphSCC &SCC)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains an interface for creating legacy passes to print out IR in various granularities.
Module.h This file contains the declarations for the Module class.
This file declares the interface for bisecting optimizations.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AnalysisResolver - Simple interface used by Pass objects to pull all analysis information out of pass...
Represent the analysis usage information of a pass.
AnalysisUsage & addRequiredID(const void *ID)
AnalysisUsage & addRequiredTransitiveID(char &ID)
SmallVectorImpl< AnalysisID > VectorType
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
PassManagerType getPotentialPassManagerType() const override
Return what kind of Pass Manager can manage this pass.
Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const override
createPrinterPass - Get a function printer pass.
bool skipFunction(const Function &F) const
Optional passes call this function to check whether the pass should be skipped.
ImmutablePass class - This class is used to provide information that does not need to be run.
~ImmutablePass() override
virtual void initializePass()
initializePass - This method may be overriden by immutable passes to allow them to perform various in...
PassManagerType getPotentialPassManagerType() const override
Return what kind of Pass Manager can manage this pass.
bool skipModule(Module &M) const
Optional passes call this function to check whether the pass should be skipped.
Pass * createPrinterPass(raw_ostream &OS, const std::string &Banner) const override
createPrinterPass - Get a module printer pass.
A Module instance is used to store all the information related to an LLVM module.
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
virtual bool isEnabled() const
isEnabled() should return true before calling shouldRunPass().
virtual bool shouldRunPass(const StringRef PassName, StringRef IRDescription)
IRDescription is a textual description of the IR unit the pass is running over.
PMDataManager provides the common place to manage the analysis data used by pass managers.
PMStack - This class implements a stack data structure of PMDataManager pointers.
PassInfo class - An instance of this class exists for every pass known by the system,...
StringRef getPassName() const
getPassName - Return the friendly name for the pass, never returns null
Pass * createPass() const
createPass() - Use this method to create an instance of this pass.
const void * getTypeInfo() const
getTypeInfo - Return the id object for the pass... TODO : Rename
PassNameParser(cl::Option &O)
~PassNameParser() override
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void addRegistrationListener(PassRegistrationListener *L)
addRegistrationListener - Register the given PassRegistrationListener to receive passRegistered() cal...
void enumerateWith(PassRegistrationListener *L)
enumerateWith - Enumerate the registered passes, calling the provided PassRegistrationListener's pass...
const PassInfo * getPassInfo(const void *TI) const
getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass' type identifier (&MyPass::...
Pass interface - Implemented by all 'passes'.
virtual void * getAdjustedAnalysisPointer(AnalysisID ID)
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through...
virtual PassManagerType getPotentialPassManagerType() const
Return what kind of Pass Manager can manage this pass.
virtual void print(raw_ostream &OS, const Module *M) const
print - Print out the internal state of the pass.
bool mustPreserveAnalysisID(char &AID) const
mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable,...
void setResolver(AnalysisResolver *AR)
static Pass * createPass(AnalysisID ID)
virtual PMDataManager * getAsPMDataManager()
AnalysisID getPassID() const
getPassID - Return the PassID number that corresponds to this pass.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
virtual void preparePassManager(PMStack &)
Check if available pass managers are suitable for this pass or not.
static const PassInfo * lookupPassInfo(const void *TI)
virtual void verifyAnalysis() const
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
virtual void dumpPassStructure(unsigned Offset=0)
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
virtual ImmutablePass * getAsImmutablePass()
virtual void releaseMemory()
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
StringRef - Represent a constant reference to a string, i.e.
Base class of all SIMD vector types.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
This is an optimization pass for GlobalISel generic memory operations.
PassManagerType
Different types of internal pass managers.
@ PMT_ModulePassManager
MPPassManager.
@ PMT_FunctionPassManager
FPPassManager.
IRHash StructuralHash(const Function &F, bool DetailedHash=false)
Returns a hash of the function F.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ModulePass * createPrintModulePass(raw_ostream &OS, const std::string &Banner="", bool ShouldPreserveUseListOrder=false)
Create and return a pass that writes the module to the specified raw_ostream.
FunctionPass * createPrintFunctionPass(raw_ostream &OS, const std::string &Banner="")
Create and return a pass that prints functions to the specified raw_ostream as they are processed.
PassRegistrationListener class - This class is meant to be derived from by clients that are intereste...
void enumeratePasses()
enumeratePasses - Iterate over the registered passes, calling the passEnumerate callback on each Pass...