}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
}
// print - Print out the analysis results...
- void print(std::ostream &O, Module *M) const;
+ void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
return getDominators(B).count(A) != 0;
}
+ // print - Convert to human readable form
+ virtual void print(std::ostream &OS) const;
+
// dominates - Return true if A dominates B. This performs the special checks
// neccesary if A and B are in the same basic block.
//
std::map<BasicBlock*, BasicBlock*>::const_iterator I = IDoms.find(BB);
return I != IDoms.end() ? I->second : 0;
}
+
+ // print - Convert to human readable form
+ virtual void print(std::ostream &OS) const;
};
//===-------------------------------------
NodeMapType::const_iterator i = Nodes.find(BB);
return (i != Nodes.end()) ? i->second : 0;
}
+
+ // print - Convert to human readable form
+ virtual void print(std::ostream &OS) const;
};
inline const_iterator begin() const { return Frontiers.begin(); }
inline const_iterator end() const { return Frontiers.end(); }
inline const_iterator find(BasicBlock* B) const { return Frontiers.find(B); }
+
+ // print - Convert to human readable form
+ virtual void print(std::ostream &OS) const;
};
//
virtual bool run(Module &M);
- // printResults - Loop over the results of the analysis, printing out unsafe
- // types.
+ // print - Loop over the results of the analysis, printing out unsafe types.
//
- void printResults(const Module *Mod, std::ostream &o) const;
+ void print(std::ostream &o, const Module *Mod) const;
// getAnalysisUsage - Of course, we provide ourself...
//
// passed in, then the types are printed symbolically if possible, using the
// symbol table from the module.
//
- void printTypes(std::ostream &o, const Module *M = 0) const;
+ void print(std::ostream &o, const Module *M) const;
private:
// IncorporateType - Incorporate one type and all of its subtypes into the
#ifndef LLVM_ANALYSIS_INDUCTIONVARIABLE_H
#define LLVM_ANALYSIS_INDUCTIONVARIABLE_H
+#include <iosfwd>
class Value;
class PHINode;
class Instruction;
// Classify Induction
static enum iType Classify(const Value *Start, const Value *Step,
const Loop *L = 0);
+
+ void print(std::ostream &OS) const;
};
#endif
#define LLVM_INTERVAL_H
#include <vector>
+#include <iosfwd>
class BasicBlock;
// isLoop - Find out if there is a back edge in this interval...
bool isLoop() const;
+
+ // print - Show contents in human readable format...
+ void print(std::ostream &O) const;
};
// succ_begin/succ_end - define methods so that Intervals may be used
// Destructor - Free memory
~IntervalPartition() { destroy(); }
+ // print - Show contents in human readable format...
+ virtual void print(std::ostream &O) const;
+
// getRootInterval() - Return the root interval that contains the starting
// block of the function.
inline Interval *getRootInterval() { return RootInterval; }
inline const std::vector<Loop*> &getSubLoops() const { return SubLoops; }
inline const std::vector<BasicBlock*> &getBlocks() const { return Blocks; }
+ void print(std::ostream &O) const;
private:
friend class LoopInfo;
inline Loop(BasicBlock *BB) { Blocks.push_back(BB); LoopDepth = 0; }
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
+ void print(std::ostream &O) const;
// getAnalysisUsage - Provide loop info, require dominator set
//
+++ /dev/null
-//===-- llvm/Analysis/Writer.h - Printer for Analysis routines ---*- C++ -*--=//
-//
-// This library provides routines to print out various analysis results to
-// an output stream.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_ANALYSIS_WRITER_H
-#define LLVM_ANALYSIS_WRITER_H
-
-#include <iosfwd>
-
-// This library provides support for printing out Intervals.
-class Interval;
-class IntervalPartition;
-
-void WriteToOutput(const Interval *I, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const Interval *I) {
- WriteToOutput(I, o); return o;
-}
-
-void WriteToOutput(const IntervalPartition &IP, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o,
- const IntervalPartition &IP) {
- WriteToOutput(IP, o); return o;
-}
-
-// Stuff for printing out Dominator data structures...
-class DominatorSetBase;
-class ImmediateDominatorsBase;
-class DominatorTreeBase;
-class DominanceFrontierBase;
-
-void WriteToOutput(const DominatorSetBase &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const DominatorSetBase &DS) {
- WriteToOutput(DS, o); return o;
-}
-
-void WriteToOutput(const ImmediateDominatorsBase &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o,
- const ImmediateDominatorsBase &ID) {
- WriteToOutput(ID, o); return o;
-}
-
-void WriteToOutput(const DominatorTreeBase &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const DominatorTreeBase &DT) {
- WriteToOutput(DT, o); return o;
-}
-
-void WriteToOutput(const DominanceFrontierBase &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o,
- const DominanceFrontierBase &DF) {
- WriteToOutput(DF, o); return o;
-}
-
-// Stuff for printing out Loop information
-class Loop;
-class LoopInfo;
-
-void WriteToOutput(const LoopInfo &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const LoopInfo &LI) {
- WriteToOutput(LI, o); return o;
-}
-
-void WriteToOutput(const Loop *, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const Loop *L) {
- WriteToOutput(L, o); return o;
-}
-
-class InductionVariable;
-void WriteToOutput(const InductionVariable &, std::ostream &o);
-inline std::ostream &operator <<(std::ostream &o, const InductionVariable &IV) {
- WriteToOutput(IV, o); return o;
-}
-
-#endif
static RegisterAnalysis<BUDataStructures>
X("budatastructure", "Bottom-Up Data Structure Analysis Closure");
-AnalysisID BUDataStructures::ID(AnalysisID::create<BUDataStructures>());
+AnalysisID BUDataStructures::ID = X;
// releaseMemory - If the pass pipeline is done with this pass, we can release
// our memory... here...
using std::vector;
-static RegisterAnalysis<LocalDataStructures>
-X("datastructure", "Local Data Structure Analysis");
-AnalysisID LocalDataStructures::ID(AnalysisID::create<LocalDataStructures>());
-
//===----------------------------------------------------------------------===//
// DSNode Implementation
//===----------------------------------------------------------------------===//
using std::map;
using std::vector;
+static RegisterAnalysis<LocalDataStructures>
+X("datastructure", "Local Data Structure Analysis");
+AnalysisID LocalDataStructures::ID = X;
+
//===----------------------------------------------------------------------===//
// GraphBuilder Class
//===----------------------------------------------------------------------===//
}
template <typename Collection>
-static void printCollection(const Collection &C, std::ostream &O, Module *M,
- const string &Prefix) {
- for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
+static void printCollection(const Collection &C, std::ostream &O,
+ const Module *M, const string &Prefix) {
+ if (M == 0) {
+ O << "Null Module pointer, cannot continue!\n";
+ return;
+ }
+
+ for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
if (!I->isExternal()) {
string Filename = Prefix + "." + I->getName() + ".dot";
O << "Writing '" << Filename << "'...";
std::ofstream F(Filename.c_str());
if (F.good()) {
- DSGraph &Graph = C.getDSGraph(*I);
+ DSGraph &Graph = C.getDSGraph((Function&)*I);
Graph.print(F);
O << " [" << Graph.getGraphSize() << "+"
<< Graph.getFunctionCalls().size() << "]\n";
// print - Print out the analysis results...
-void LocalDataStructures::print(std::ostream &O, Module *M) const {
+void LocalDataStructures::print(std::ostream &O, const Module *M) const {
printCollection(*this, O, M, "ds");
}
-void BUDataStructures::print(std::ostream &O, Module *M) const {
+void BUDataStructures::print(std::ostream &O, const Module *M) const {
printCollection(*this, O, M, "bu");
}
static RegisterAnalysis<FunctionLiveVarInfo>
X("livevar", "Live Variable Analysis");
-AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
+AnalysisID FunctionLiveVarInfo::ID = X;
LiveVarDebugLevel_t DEBUG_LV;
static RegisterAnalysis<FunctionLiveVarInfo>
X("livevar", "Live Variable Analysis");
-AnalysisID FunctionLiveVarInfo::ID(AnalysisID::create<FunctionLiveVarInfo>());
+AnalysisID FunctionLiveVarInfo::ID = X;
LiveVarDebugLevel_t DEBUG_LV;
#include "llvm/Type.h"
using std::vector;
-AnalysisID UnifyFunctionExitNodes::ID(AnalysisID::create<UnifyFunctionExitNodes>());
-
static RegisterOpt<UnifyFunctionExitNodes>
X("mergereturn", "Unify function exit nodes");
+AnalysisID UnifyFunctionExitNodes::ID = X;
// UnifyAllExitNodes - Unify all exit nodes of the CFG by creating a new
// BasicBlock, and converting all returns to unconditional branches to this