14 #ifndef LLVM_ANALYSIS_DOTGRAPHTRAITSPASS_H 15 #define LLVM_ANALYSIS_DOTGRAPHTRAITSPASS_H 26 template <
typename AnalysisT,
typename GraphT = AnalysisT *>
28 static GraphT
getGraph(AnalysisT *A) {
return A; }
32 typename AnalysisT,
bool IsSimple,
typename GraphT = AnalysisT *,
50 auto &
Analysis = getAnalysis<AnalysisT>();
55 GraphT Graph = AnalysisGraphTraitsT::getGraph(&
Analysis);
57 std::string Title = GraphName +
" for '" + F.
getName().
str() +
"' function";
74 typename AnalysisT,
bool IsSimple,
typename GraphT = AnalysisT *,
92 auto &
Analysis = getAnalysis<AnalysisT>();
97 GraphT Graph = AnalysisGraphTraitsT::getGraph(&
Analysis);
101 errs() <<
"Writing '" << Filename <<
"'...";
105 std::string Title = GraphName +
" for '" + F.
getName().
str() +
"' function";
110 errs() <<
" error opening file for writing!";
126 typename AnalysisT,
bool IsSimple,
typename GraphT = AnalysisT *,
134 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
152 typename AnalysisT,
bool IsSimple,
typename GraphT = AnalysisT *,
160 GraphT Graph = AnalysisGraphTraitsT::getGraph(&getAnalysis<AnalysisT>());
161 std::string Filename =
Name +
".dot";
164 errs() <<
"Writing '" << Filename <<
"'...";
172 errs() <<
" error opening file for writing!";
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
DOTGraphTraitsModuleViewer(StringRef GraphName, char &ID)
*ViewGraph Emit a dot run run gv on the postscript *then cleanup For use from the debugger *void ViewGraph(const GraphType &G, const Twine &Name, bool ShortNames=false, const Twine &Title="", GraphProgram::Name Program=GraphProgram::DOT)
AnalysisUsage & addRequired()
amdgpu Simplify well known AMD library false Value Value const Twine & Name
static GraphT getGraph(AnalysisT *A)
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on...
raw_ostream & WriteGraph(raw_ostream &O, const GraphType &G, bool ShortNames=false, const Twine &Title="")
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
virtual bool processFunction(Function &F, AnalysisT &Analysis)
Return true if this function should be processed.
DOTGraphTraitsViewer(StringRef GraphName, char &ID)
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
DOTGraphTraitsPrinter(StringRef GraphName, char &ID)
void setPreservesAll()
Set by analyses that do not transform their input at all.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
block Block Frequency Analysis
A raw_ostream that writes to a file descriptor.
StringRef getName() const
Return a constant reference to the value's name.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool processFunction(Function &F, AnalysisT &Analysis)
Return true if this function should be processed.
Default traits class for extracting a graph from an analysis pass.
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on...
StringRef - Represent a constant reference to a string, i.e.
static std::string getGraphName(const GraphType &)
getGraphName - Return the label for the graph as a whole.
DOTGraphTraitsModulePrinter(StringRef GraphName, char &ID)