28 #define DEBUG_TYPE "region"
36 STATISTIC(numRegions,
"The # of regions");
37 STATISTIC(numSimpleRegions,
"The # of simple regions");
45 cl::desc(
"Verify region info (time consuming)"));
51 cl::desc(
"style of printing regions"),
55 "print regions in detail with block_iterator"),
57 "print regions in detail with element_iterator")));
127 auto DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
128 auto PDT = &getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree();
129 auto DF = &getAnalysis<DominanceFrontierWrapperPass>().getDominanceFrontier();
154 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
163 "Detect single entry single exit regions",
true,
true)
168 "Detect single entry single exit regions",
true, true)
176 return new RegionInfoPass();
201 OS <<
"Region Tree for function: " << F.
getName() <<
"\n";
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
STATISTIC(NumFunctions,"Total number of functions")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
bool isSimple() const
Is this a simple region?
A Module instance is used to store all the information related to an LLVM module. ...
static RegionT::PrintStyle printStyle
void print(raw_ostream &OS, const Module *) const override
print - Print out the internal state of the pass.
FunctionPass * createRegionInfoPass()
Analysis pass which computes a DominatorTree.
void recalculate(Function &F, DominatorTree *DT, PostDominatorTree *PDT, DominanceFrontier *DF)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void initializeRegionInfoPassPass(PassRegistry &)
Analysis that detects all canonical Regions.
void viewRegionOnly(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
StringRef getName() const
Return a constant reference to the value's name.
void view()
Opens a viewer to show the GraphViz visualization of the regions.
INITIALIZE_PASS_BEGIN(RegionInfoPass,"regions","Detect single entry single exit regions", true, true) INITIALIZE_PASS_END(RegionInfoPass
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Detect single entry single exit true
Analysis pass which computes a DominanceFrontier.
A RegionNode represents a subregion or a BasicBlock that is part of a Region.
RegionInfoPrinterPass(raw_ostream &OS)
void print(raw_ostream &OS) const
void verifyAnalysis() const
Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI, DominatorTree *DT, Region *Parent=nullptr)
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
ValuesClass values(OptsTy...Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
A set of analyses that are preserved following a run of a transformation pass.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
FunctionPass class - This class is used to implement most global optimizations.
RegionInfo run(Function &F, FunctionAnalysisManager &AM)
void viewOnly()
Opens a viewer to show the GraphViz visualization of this region without instructions in the BasicBlo...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static cl::opt< Region::PrintStyle, true > printStyleX("print-region-style", cl::location(RegionInfo::printStyle), cl::Hidden, cl::desc("style of printing regions"), cl::values(clEnumValN(Region::PrintNone,"none","print no details"), clEnumValN(Region::PrintBB,"bb","print regions in detail with block_iterator"), clEnumValN(Region::PrintRN,"rn","print regions in detail with element_iterator")))
~RegionInfoPass() override
Analysis pass which computes a PostDominatorTree.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
const BasicBlock & getEntryBlock() const
A single entry single exit Region.
Analysis pass that exposes the RegionInfo for a function.
void setPreservesAll()
Set by analyses that do not transform their input at all.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
AnalysisUsage & addRequiredTransitive()
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
void updateStatistics(Region *R) final
This class implements an extremely fast bulk output stream that can only output to a stream...
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
This header defines various interfaces for pass management in LLVM.
static cl::opt< bool, true > VerifyRegionInfoX("verify-region-info", cl::location(RegionInfoBase< RegionTraits< Function >>::VerifyRegionInfo), cl::desc("Verify region info (time consuming)"))
A special type used by analysis passes to provide an address that identifies that particular analysis...
LocationClass< Ty > location(Ty &L)