Go to the documentation of this file.
19 #include "llvm/Config/llvm-config.h"
26 #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)"));
50 cl::desc(
"style of printing regions"),
54 "print regions in detail with block_iterator"),
56 "print regions in detail with element_iterator")));
102 TopLevelRegion =
new Region(&
F.getEntryBlock(),
nullptr,
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)
203 OS <<
"Region Tree for function: " <<
F.getName() <<
"\n";
void viewOnly()
Opens a viewer to show the GraphViz visualization of this region without instructions in the BasicBlo...
A set of analyses that are preserved following a run of a transformation pass.
void updateStatistics(Region *R) final
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This is an optimization pass for GlobalISel generic memory operations.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
RegionInfoPrinterPass(raw_ostream &OS)
void recalculate(Function &F, DominatorTree *DT, PostDominatorTree *PDT, DominanceFrontier *DF)
LocationClass< Ty > location(Ty &L)
A single entry single exit Region.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
This templated class represents "all analyses that operate over <a particular IR unit>" (e....
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
LLVM Basic Block Representation.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Analysis pass that exposes the RegionInfo for a function.
Represent the analysis usage information of a pass.
Legacy analysis pass which computes a DominatorTree.
STATISTIC(NumFunctions, "Total number of functions")
This class implements an extremely fast bulk output stream that can only output to a stream.
void print(raw_ostream &OS, const Module *) const override
print - Print out the internal state of the pass.
API to communicate dependencies between analyses during invalidation.
void initializeRegionInfoPassPass(PassRegistry &)
Analysis that detects all canonical Regions.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
INITIALIZE_PASS_BEGIN(RegionInfoPass, "regions", "Detect single entry single exit regions", true, true) INITIALIZE_PASS_END(RegionInfoPass
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
static RegionT::PrintStyle printStyle
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Detect single entry single exit true
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
A special type used by analysis passes to provide an address that identifies that particular analysis...
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")))
static cl::opt< bool, true > VerifyRegionInfoX("verify-region-info", cl::location(RegionInfoBase< RegionTraits< Function >>::VerifyRegionInfo), cl::desc("Verify region info (time consuming)"))
RegionInfo run(Function &F, FunctionAnalysisManager &AM)
void print(raw_ostream &OS) const
A Module instance is used to store all the information related to an LLVM module.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
Represents analyses that only rely on functions' control flow.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Analysis pass which computes a DominanceFrontier.
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
void view()
Opens a viewer to show the GraphViz visualization of the regions.
void verifyAnalysis() const
void setPreservesAll()
Set by analyses that do not transform their input at all.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
FunctionPass * createRegionInfoPass()
Region(BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI, DominatorTree *DT, Region *Parent=nullptr)
void viewRegion(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
~RegionInfoPass() override
Analysis pass which computes a DominatorTree.
declare void exit(i32) noreturn nounwind This compiles into
A RegionNode represents a subregion or a BasicBlock that is part of a Region.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
AnalysisUsage & addRequiredTransitive()
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
A container for analyses that lazily runs them and caches their results.
FunctionPass class - This class is used to implement most global optimizations.
Analysis pass which computes a PostDominatorTree.
AnalysisUsage & addRequired()
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
void viewRegionOnly(llvm::RegionInfo *RI)
Open a viewer to display the GraphViz vizualization of the analysis result.
print Instructions which execute on loop entry