void operator=(const DSGraph &); // DO NOT IMPLEMENT
public:
- DSGraph() : Func(0), GlobalsGraph(0) {} // Create a new, empty, DSGraph.
+ // Create a new, empty, DSGraph.
+ DSGraph() : Func(0), GlobalsGraph(0), PrintAuxCalls(false) {}
DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
// Copy ctor - If you want to capture the node mapping between the source and
~DSGraph();
bool hasFunction() const { return Func != 0; }
- Function &getFunction() const { return *Func; }
+ Function &getFunction() const {
+ assert(hasFunction() && "Cannot call getFunction on graph without a fn!");
+ return *Func;
+ }
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
return Nodes.size();
}
+ /// print - Print a dot graph to the specified ostream...
void print(std::ostream &O) const;
+
+ /// dump - call print(std::cerr), for use from the debugger...
+ ///
void dump() const;
+
+ /// viewGraph - Emit a dot graph, run 'dot', run gv on the postscript file,
+ /// then cleanup. For use from the debugger.
+ void viewGraph() const;
+
void writeGraphToFile(std::ostream &O, const std::string &GraphName) const;
/// maskNodeTypes - Apply a mask to all of the node types in the graph. This
//
enum MarkIncompleteFlags {
MarkFormalArgs = 1, IgnoreFormalArgs = 0,
+ IgnoreGlobals = 2, MarkGlobalsIncomplete = 0,
};
void markIncompleteNodes(unsigned Flags);
void mergeInGraph(DSCallSite &CS, const DSGraph &Graph, unsigned CloneFlags);
// Methods for checking to make sure graphs are well formed...
- void AssertNodeInGraph(DSNode *N) const {
+ void AssertNodeInGraph(const DSNode *N) const {
assert((!N || find(Nodes.begin(), Nodes.end(), N) != Nodes.end()) &&
"AssertNodeInGraph: Node is not in graph!");
}
}
void AssertCallSiteInGraph(const DSCallSite &CS) const {
- AssertNodeInGraph(CS.getCallee().getNode());
+ if (CS.isIndirectCall())
+ AssertNodeInGraph(CS.getCalleeNode());
AssertNodeInGraph(CS.getRetVal().getNode());
for (unsigned j = 0, e = CS.getNumPtrArgs(); j != e; ++j)
AssertNodeInGraph(CS.getPtrArg(j).getNode());