24 #define DEBUG_TYPE "regionpassmgr" 35 CurrentRegion =
nullptr;
41 for (
const auto &
E : R)
48 Info.setPreservesAll();
54 RI = &getAnalysis<RegionInfoPass>().getRegionInfo();
69 Changed |=
RP->doInitialization(R, *
this);
76 CurrentRegion = RQ.back();
90 bool LocalChanged =
false;
95 #ifdef EXPENSIVE_CHECKS 96 uint64_t RefHash = StructuralHash(
F);
98 LocalChanged =
P->runOnRegion(CurrentRegion, *
this);
100 #ifdef EXPENSIVE_CHECKS 101 if (!LocalChanged && (RefHash != StructuralHash(
F))) {
102 llvm::errs() <<
"Pass modifies its input and doesn't report it: " 103 <<
P->getPassName() <<
"\n";
108 Changed |= LocalChanged;
151 Changed |=
P->doFinalization();
156 <<
" after all region Pass:\n";
167 P->dumpPassStructure(
Offset + 1);
191 for (
const auto *BB :
R->blocks()) {
195 Out <<
"Printing <null> Block";
201 StringRef getPassName()
const override {
return "Print Region IR"; }
219 while (!PMS.
empty() &&
236 while (!PMS.
empty() &&
247 assert (!PMS.
empty() &&
"Unable to create Region Pass Manager");
271 const std::string &Banner)
const {
272 return new PrintRegionPass(Banner,
O);
280 Function &
F = *R.getEntry()->getParent();
285 if (
F.hasOptNone()) {
287 if (R.getEntry() == &
F.getEntryBlock())
289 <<
"' on function " <<
F.getName() <<
"\n");
Pass interface - Implemented by all 'passes'.
bool preserveHigherLevelAnalysis(Pass *P)
PassManagerType
Different types of internal pass managers.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
This class represents lattice values for constants.
void dumpLastUses(Pass *P, unsigned Offset) const
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
Get a pass to print the LLVM IR in the region.
Extensions to this class implement mechanisms to disable passes and individual optimizations at compi...
static void addRegionIntoQueue(Region &R, std::deque< Region * > &RQ)
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
bool skipRegion(Region &R) const
Optional passes call this function to check whether the pass should be skipped.
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
The pass manager to schedule RegionPasses.
virtual bool shouldRunPass(const Pass *P, StringRef IRDescription)
IRDescription is a textual description of the IR unit the pass is running over.
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers.
Timer * getPassTimer(Pass *)
Request the timer for this legacy-pass-manager's pass instance.
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
void schedulePass(Pass *P)
Schedule pass P for execution.
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
void populateInheritedAnalysis(PMStack &PMS)
This header defines classes/functions to handle pass execution timing information with interfaces for...
PMStack - This class implements a stack data structure of PMDataManager pointers.
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls m...
virtual bool isEnabled() const
isEnabled() should return true before calling shouldRunPass().
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
RegionT * getTopLevelRegion() const
bool isPassDebuggingExecutionsOrMore() const
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
Analysis containing CSE Info
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
void assignPassManager(PMStack &PMS, PassManagerType PMT=PMT_RegionPassManager) override
Assign pass manager to manage this pass.
void preparePassManager(PMStack &PMS) override
Check if available pass managers are suitable for this pass or not.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static std::string getDescription(const Region &R)
A pass that runs on each Region in a function.
void addIndirectPassManager(PMDataManager *Manager)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
virtual PassManagerType getPassManagerType() const
Represent the analysis usage information of a pass.
bool runOnFunction(Function &F) override
Execute all of the passes scheduled for execution.
FunctionPass class - This class is used to implement most global optimizations.
Pass * getContainedPass(unsigned N)
Get passes contained by this manager.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
BlockT * getEntry() const
Get the entry BasicBlock of the Region.
void dumpRequiredSet(const Pass *P) const
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
This file declares the interface for bisecting optimizations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setPreservesAll()
Set by analyses that do not transform their input at all.
std::string getNameStr() const
Returns the name of the Region.
void verifyRegion() const
Verify if the region is a correct region.
void push(PMDataManager *PM)
PMDataManager provides the common place to manage the analysis data used by pass managers.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
PMDataManager * top() const
void clearNodeCache()
Clear the Node Cache for all Regions.
unsigned getNumContainedPasses() const
This class implements an extremely fast bulk output stream that can only output to a stream.
StringRef - Represent a constant reference to a string, i.e.
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
void dumpPreservedSet(const Pass *P) const