27#define DEBUG_TYPE "regionpassmgr"
37 CurrentRegion =
nullptr;
43 for (
const auto &
E : R)
50 Info.setPreservesAll();
71 Changed |= RP->doInitialization(R, *
this);
78 CurrentRegion = RQ.back();
86 CurrentRegion->getNameStr());
92 bool LocalChanged =
false;
97#ifdef EXPENSIVE_CHECKS
100 LocalChanged =
P->runOnRegion(CurrentRegion, *
this);
102#ifdef EXPENSIVE_CHECKS
103 if (!LocalChanged && (RefHash !=
P->structuralHash(
F))) {
104 llvm::errs() <<
"Pass modifies its input and doesn't report it: "
105 <<
P->getPassName() <<
"\n";
116 CurrentRegion->getNameStr());
127 CurrentRegion->verifyRegion();
139 : CurrentRegion->getNameStr(),
147 RI->clearNodeCache();
158 <<
" after all region Pass:\n";
159 RI->dump();
dbgs() <<
"\n";);
169 P->dumpPassStructure(
Offset + 1);
191 bool runOnRegion(Region *R, RGPassManager &RGM)
override {
195 for (
const auto *BB :
R->blocks()) {
199 Out <<
"Printing <null> Block";
205 StringRef getPassName()
const override {
return "Print Region IR"; }
208char PrintRegionPass::ID = 0;
223 while (!PMS.
empty() &&
240 while (!PMS.
empty() &&
251 assert (!PMS.
empty() &&
"Unable to create Region Pass Manager");
275 const std::string &Banner)
const {
276 return new PrintRegionPass(Banner, O);
284 Function &
F = *R.getEntry()->getParent();
285 const OptPassGate &Gate =
F.getContext().getOptPassGate();
290 if (
F.hasOptNone()) {
292 if (R.getEntry() == &
F.getEntryBlock())
294 <<
"' on function " <<
F.getName() <<
"\n");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static std::string getDescription(const Loop &L)
This file declares the interface for bisecting optimizations.
This header defines classes/functions to handle pass execution timing information with interfaces for...
static void addRegionIntoQueue(Region &R, std::deque< Region * > &RQ)
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
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(StringRef PassName, StringRef IRDescription) const
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.
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
void dumpLastUses(Pass *P, unsigned Offset) const
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
PMTopLevelManager * getTopLevelManager()
void dumpRequiredSet(const Pass *P) const
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs!
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
bool preserveHigherLevelAnalysis(Pass *P)
unsigned getNumContainedPasses() const
virtual PassManagerType getPassManagerType() const
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
void populateInheritedAnalysis(PMStack &PMS)
void dumpPreservedSet(const Pass *P) const
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
PMStack - This class implements a stack data structure of PMDataManager pointers.
PMDataManager * top() const
LLVM_ABI void push(PMDataManager *PM)
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
void addIndirectPassManager(PMDataManager *Manager)
void schedulePass(Pass *P)
Schedule pass P for execution.
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
Pass interface - Implemented by all 'passes'.
Pass(PassKind K, char &pid)
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
The pass manager to schedule RegionPasses.
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
Pass * getContainedPass(unsigned N)
Get passes contained by this manager.
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
bool runOnFunction(Function &F) override
Execute all of the passes scheduled for execution.
A pass that runs on each Region in a function.
void preparePassManager(PMStack &PMS) override
Check if available pass managers are suitable for this pass or not.
bool skipRegion(Region &R) const
Optional passes call this function to check whether the pass should be skipped.
void assignPassManager(PMStack &PMS, PassManagerType PMT=PMT_RegionPassManager) override
Assign pass manager to manage this pass.
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
Get a pass to print the LLVM IR in the region.
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
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.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
PassManagerType
Different types of internal pass managers.
@ PMT_RegionPassManager
RGPassManager.
LLVM_ABI Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isFunctionInPrintList(StringRef FunctionName)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.