aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-03-11 23:08:20 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-03-11 23:08:20 +0000
commitdd298c8c6eb036baf35bf5a559c59d2afd2c7944 (patch)
tree0407c874472e1e0da4e2c999d081d7558d27e7a1
parent3497ae9f0556c66fa843106e40a71bb5c82fd68d (diff)
Doxygenified and cleand up comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12294 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h1
-rw-r--r--include/llvm/Analysis/DSGraph.h94
-rw-r--r--include/llvm/Analysis/DSNode.h17
-rw-r--r--include/llvm/Analysis/DSSupport.h15
-rw-r--r--include/llvm/Analysis/DataStructure.h75
-rw-r--r--include/llvm/Analysis/DataStructure/DSGraph.h94
-rw-r--r--include/llvm/Analysis/DataStructure/DSNode.h17
-rw-r--r--include/llvm/Analysis/DataStructure/DSSupport.h15
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h75
-rw-r--r--include/llvm/Analysis/DependenceGraph.h90
-rw-r--r--include/llvm/Analysis/Dominators.h128
-rw-r--r--include/llvm/Analysis/Expressions.h16
-rw-r--r--include/llvm/Analysis/FindUnsafePointerTypes.h16
-rw-r--r--include/llvm/Analysis/IPModRef.h116
-rw-r--r--include/llvm/Analysis/MemoryDepAnalysis.h10
-rw-r--r--include/llvm/Analysis/PgmDependenceGraph.h139
16 files changed, 475 insertions, 443 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index 6bbb88539e..fb848ebd57 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -61,6 +61,7 @@ public:
/// getTargetData - Every alias analysis implementation depends on the size of
/// data items in the current Target. This provides a uniform way to handle
/// it.
+ ///
const TargetData &getTargetData() const { return *TD; }
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/Analysis/DSGraph.h b/include/llvm/Analysis/DSGraph.h
index 31339a5b8c..3d9e4187d8 100644
--- a/include/llvm/Analysis/DSGraph.h
+++ b/include/llvm/Analysis/DSGraph.h
@@ -56,6 +56,7 @@ public:
/// replaceScalar - When an instruction needs to be modified, this method can
/// be used to update the scalar map to remove the old and insert the new.
+ ///
void replaceScalar(Value *Old, Value *New) {
iterator I = find(Old);
assert(I != end() && "Old value is not in the map!");
@@ -189,6 +190,7 @@ public:
/// getFunctionNames - Return a space separated list of the name of the
/// functions in this graph (if any)
+ ///
std::string getFunctionNames() const;
/// addNode - Add a new node to the graph.
@@ -240,6 +242,7 @@ public:
/// getReturnNodes - Return the mapping of functions to their return nodes for
/// this graph.
+ ///
const ReturnNodesTy &getReturnNodes() const { return ReturnNodes; }
ReturnNodesTy &getReturnNodes() { return ReturnNodes; }
@@ -273,6 +276,7 @@ public:
/// 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;
@@ -354,7 +358,6 @@ public:
void mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph,
unsigned CloneFlags);
-
/// getCallSiteForArguments - Get the arguments and return value bindings for
/// the specified function in the current graph.
///
@@ -389,54 +392,57 @@ public:
};
- /// ReachabilityCloner - This class is used to incrementally clone and merge
- /// nodes from a non-changing source graph into a potentially mutating
- /// destination graph. Nodes are only cloned over on demand, either in
- /// responds to a merge() or getClonedNH() call. When a node is cloned over,
- /// all of the nodes reachable from it are automatically brought over as well.
- class ReachabilityCloner {
- DSGraph &Dest;
- const DSGraph &Src;
-
- /// BitsToKeep - These bits are retained from the source node when the
- /// source nodes are merged into the destination graph.
- unsigned BitsToKeep;
- unsigned CloneFlags;
-
- // NodeMap - A mapping from nodes in the source graph to the nodes that
- // represent them in the destination graph.
- DSGraph::NodeMapTy NodeMap;
- public:
- ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags)
- : Dest(dest), Src(src), CloneFlags(cloneFlags) {
- assert(&Dest != &Src && "Cannot clone from graph to same graph!");
- BitsToKeep = ~DSNode::DEAD;
- if (CloneFlags & DSGraph::StripAllocaBit)
- BitsToKeep &= ~DSNode::AllocaNode;
- if (CloneFlags & DSGraph::StripModRefBits)
- BitsToKeep &= ~(DSNode::Modified | DSNode::Read);
- if (CloneFlags & DSGraph::StripIncompleteBit)
- BitsToKeep &= ~DSNode::Incomplete;
- }
-
- DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);
+/// ReachabilityCloner - This class is used to incrementally clone and merge
+/// nodes from a non-changing source graph into a potentially mutating
+/// destination graph. Nodes are only cloned over on demand, either in
+/// responds to a merge() or getClonedNH() call. When a node is cloned over,
+/// all of the nodes reachable from it are automatically brought over as well.
+///
+class ReachabilityCloner {
+ DSGraph &Dest;
+ const DSGraph &Src;
+
+ /// BitsToKeep - These bits are retained from the source node when the
+ /// source nodes are merged into the destination graph.
+ unsigned BitsToKeep;
+ unsigned CloneFlags;
+
+ // NodeMap - A mapping from nodes in the source graph to the nodes that
+ // represent them in the destination graph.
+ DSGraph::NodeMapTy NodeMap;
+public:
+ ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags)
+ : Dest(dest), Src(src), CloneFlags(cloneFlags) {
+ assert(&Dest != &Src && "Cannot clone from graph to same graph!");
+ BitsToKeep = ~DSNode::DEAD;
+ if (CloneFlags & DSGraph::StripAllocaBit)
+ BitsToKeep &= ~DSNode::AllocaNode;
+ if (CloneFlags & DSGraph::StripModRefBits)
+ BitsToKeep &= ~(DSNode::Modified | DSNode::Read);
+ if (CloneFlags & DSGraph::StripIncompleteBit)
+ BitsToKeep &= ~DSNode::Incomplete;
+ }
+
+ DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);
- void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH);
+ void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH);
- /// mergeCallSite - Merge the nodes reachable from the specified src call
- /// site into the nodes reachable from DestCS.
- void mergeCallSite(const DSCallSite &DestCS, const DSCallSite &SrcCS);
+ /// mergeCallSite - Merge the nodes reachable from the specified src call
+ /// site into the nodes reachable from DestCS.
+ ///
+ void mergeCallSite(const DSCallSite &DestCS, const DSCallSite &SrcCS);
- bool clonedAnyNodes() const { return !NodeMap.empty(); }
+ bool clonedAnyNodes() const { return !NodeMap.empty(); }
- /// hasClonedNode - Return true if the specified node has been cloned from
- /// the source graph into the destination graph.
- bool hasClonedNode(const DSNode *N) {
- return NodeMap.count(N);
- }
+ /// hasClonedNode - Return true if the specified node has been cloned from
+ /// the source graph into the destination graph.
+ bool hasClonedNode(const DSNode *N) {
+ return NodeMap.count(N);
+ }
+
+ void destroy() { NodeMap.clear(); }
+};
- void destroy() { NodeMap.clear(); }
- };
} // End llvm namespace
#endif
diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h
index e58c8f936b..3ddd29a5ad 100644
--- a/include/llvm/Analysis/DSNode.h
+++ b/include/llvm/Analysis/DSNode.h
@@ -40,10 +40,12 @@ class DSNode {
/// that this node really is. When nodes get folded together, the node to be
/// eliminated has these fields filled in, otherwise ForwardNH.getNode() is
/// null.
+ ///
DSNodeHandle ForwardNH;
/// Next, Prev - These instance variables are used to keep the node on a
/// doubly-linked ilist in the DSGraph.
+ ///
DSNode *Next, *Prev;
friend class ilist_traits<DSNode>;
@@ -105,12 +107,14 @@ public:
/// DSNode ctor - Create a node of the specified type, inserting it into the
/// specified graph.
+ ///
DSNode(const Type *T, DSGraph *G);
/// DSNode "copy ctor" - Copy the specified node, inserting it into the
/// specified graph. If NullLinks is true, then null out all of the links,
/// but keep the same number of them. This can be used for efficiency if the
/// links are just going to be clobbered anyway.
+ ///
DSNode(const DSNode &, DSGraph *G, bool NullLinks = false);
~DSNode() {
@@ -133,8 +137,10 @@ public:
///
unsigned getSize() const { return Size; }
- // getType - Return the node type of this object...
+ /// getType - Return the node type of this object...
+ ///
const Type *getType() const { return Ty; }
+
bool isArray() const { return NodeType & Array; }
/// hasNoReferrers - Return true if nothing is pointing to this node at all.
@@ -156,6 +162,7 @@ public:
/// getForwardNode - This method returns the node that this node is forwarded
/// to, if any.
+ ///
DSNode *getForwardNode() const { return ForwardNH.getNode(); }
/// isForwarding - Return true if this node is forwarding to another.
@@ -164,9 +171,10 @@ public:
/// stopForwarding - When the last reference to this forwarding node has been
/// dropped, delete the node.
+ ///
void stopForwarding() {
assert(isForwarding() &&
- "Node isn't forwarding, cannot stopForwarding!");
+ "Node isn't forwarding, cannot stopForwarding()!");
ForwardNH.setNode(0);
assert(ParentGraph == 0 &&
"Forwarding nodes must have been removed from graph!");
@@ -184,6 +192,7 @@ public:
}
/// getLink - Return the link at the specified offset.
+ ///
DSNodeHandle &getLink(unsigned Offset) {
assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
"Pointer offset not aligned correctly!");
@@ -283,6 +292,7 @@ public:
/// getNodeFlags - Return all of the flags set on the node. If the DEAD flag
/// is set, hide it from the caller.
+ ///
unsigned getNodeFlags() const { return NodeType & ~DEAD; }
bool isAllocaNode() const { return NodeType & AllocaNode; }
@@ -331,6 +341,7 @@ public:
/// remapLinks - Change all of the Links in the current node according to the
/// specified mapping.
+ ///
void remapLinks(hash_map<const DSNode*, DSNodeHandle> &OldNodeMap);
/// markReachableNodes - This method recursively traverses the specified
@@ -423,7 +434,7 @@ inline void DSNodeHandle::setLink(unsigned Off, const DSNodeHandle &NH) {
getNode()->setLink(Off+Offset, NH);
}
-/// addEdgeTo - Add an edge from the current node to the specified node. This
+/// addEdgeTo - Add an edge from the current node to the specified node. This
/// can cause merging of nodes in the graph.
///
inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) {
diff --git a/include/llvm/Analysis/DSSupport.h b/include/llvm/Analysis/DSSupport.h
index b1053714b9..fdbb43236e 100644
--- a/include/llvm/Analysis/DSSupport.h
+++ b/include/llvm/Analysis/DSSupport.h
@@ -35,9 +35,9 @@ namespace DS { // FIXME: After the paper, this should get cleaned up
PointerSize = 1 << PointerShift
};
- // isPointerType - Return true if this first class type is big enough to hold
- // a pointer.
- //
+ /// isPointerType - Return true if this first class type is big enough to hold
+ /// a pointer.
+ ///
bool isPointerType(const Type *Ty);
};
@@ -89,6 +89,7 @@ public:
/// isNull - Check to see if getNode() == 0, without going through the trouble
/// of checking to see if we are forwarding...
+ ///
bool isNull() const { return N == 0; }
// Allow explicit conversion to DSNode...
@@ -112,7 +113,8 @@ public:
///
void mergeWith(const DSNodeHandle &N) const;
- // hasLink - Return true if there is a link at the specified offset...
+ /// hasLink - Return true if there is a link at the specified offset...
+ ///
inline bool hasLink(unsigned Num) const;
/// getLink - Treat this current node pointer as a pointer to a structure of
@@ -262,8 +264,9 @@ public:
}
}
- // mergeWith - Merge the return value and parameters of the these two call
- // sites.
+ /// mergeWith - Merge the return value and parameters of the these two call
+ /// sites.
+ ///
void mergeWith(DSCallSite &CS) {
getRetVal().mergeWith(CS.getRetVal());
unsigned MinArgs = getNumPtrArgs();
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index 3a04cd5add..f210003213 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -27,9 +27,9 @@ class DSNode;
// FIXME: move this stuff to a private header
namespace DataStructureAnalysis {
- // isPointerType - Return true if this first class type is big enough to hold
- // a pointer.
- //
+ /// isPointerType - Return true if this first class type is big enough to hold
+ /// a pointer.
+ ///
bool isPointerType(const Type *Ty);
}
@@ -53,7 +53,8 @@ public:
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
}
- // getDSGraph - Return the data structure graph for the specified function.
+ /// getDSGraph - Return the data structure graph for the specified function.
+ ///
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
@@ -63,13 +64,17 @@ public:
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
- // print - Print out the analysis results...
+ /// print - Print out the analysis results...
+ ///
void print(std::ostream &O, const Module *M) const;
- // If the pass pipeline is done with this pass, we can release our memory...
+ /// releaseMemory - if the pass pipeline is done with this pass, we can
+ /// release our memory...
+ ///
virtual void releaseMemory();
- // getAnalysisUsage - This obviously provides a data structure graph.
+ /// getAnalysisUsage - This obviously provides a data structure graph.
+ ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<TargetData>();
@@ -77,10 +82,10 @@ public:
};
-// BUDataStructures - The analysis that computes the interprocedurally closed
-// data structure graphs for all of the functions in the program. This pass
-// only performs a "Bottom Up" propagation (hence the name).
-//
+/// BUDataStructures - The analysis that computes the interprocedurally closed
+/// data structure graphs for all of the functions in the program. This pass
+/// only performs a "Bottom Up" propagation (hence the name).
+///
class BUDataStructures : public Pass {
protected:
// DSInfo, one graph for each function
@@ -96,7 +101,8 @@ public:
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
}
- // getDSGraph - Return the data structure graph for the specified function.
+ /// getDSGraph - Return the data structure graph for the specified function.
+ ///
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
@@ -106,10 +112,13 @@ public:
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
- // print - Print out the analysis results...
+ /// print - Print out the analysis results...
+ ///
void print(std::ostream &O, const Module *M) const;
- // If the pass pipeline is done with this pass, we can release our memory...
+ /// releaseMemory - if the pass pipeline is done with this pass, we can
+ /// release our memory...
+ ///
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -136,10 +145,10 @@ private:
};
-// TDDataStructures - Analysis that computes new data structure graphs
-// for each function using the closed graphs for the callers computed
-// by the bottom-up pass.
-//
+/// TDDataStructures - Analysis that computes new data structure graphs
+/// for each function using the closed graphs for the callers computed
+/// by the bottom-up pass.
+///
class TDDataStructures : public Pass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
@@ -154,7 +163,8 @@ public:
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
}
- // getDSGraph - Return the data structure graph for the specified function.
+ /// getDSGraph - Return the data structure graph for the specified function.
+ ///
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
@@ -164,13 +174,16 @@ public:
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
- // print - Print out the analysis results...
+ /// print - Print out the analysis results...
+ ///
void print(std::ostream &O, const Module *M) const;
- // If the pass pipeline is done with this pass, we can release our memory...
+ /// If the pass pipeline is done with this pass, we can release our memory...
+ ///
virtual void releaseMyMemory();
- // getAnalysisUsage - This obviously provides a data structure graph.
+ /// getAnalysisUsage - This obviously provides a data structure graph.
+ ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<BUDataStructures>();
@@ -188,11 +201,11 @@ private:
};
-// CompleteBUDataStructures - This is the exact same as the bottom-up graphs,
-// but we use take a completed call graph and inline all indirect callees into
-// their callers graphs, making the result more useful for things like pool
-// allocation.
-//
+/// CompleteBUDataStructures - This is the exact same as the bottom-up graphs,
+/// but we use take a completed call graph and inline all indirect callees into
+/// their callers graphs, making the result more useful for things like pool
+/// allocation.
+///
struct CompleteBUDataStructures : public BUDataStructures {
virtual bool run(Module &M);
@@ -200,7 +213,8 @@ struct CompleteBUDataStructures : public BUDataStructures {
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
}
- // getDSGraph - Return the data structure graph for the specified function.
+ /// getDSGraph - Return the data structure graph for the specified function.
+ ///
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
@@ -217,7 +231,8 @@ struct CompleteBUDataStructures : public BUDataStructures {
AU.addRequired<TDDataStructures>();
}
- // print - Print out the analysis results...
+ /// print - Print out the analysis results...
+ ///
void print(std::ostream &O, const Module *M) const;
private:
@@ -228,8 +243,6 @@ private:
void processGraph(DSGraph &G);
};
-
-
} // End llvm namespace
#endif
diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h
index 31339a5b8c..3d9e4187d8 100644
--- a/include/llvm/Analysis/DataStructure/DSGraph.h
+++ b/include/llvm/Analysis/DataStructure/DSGraph.h
@@ -56,6 +56,7 @@ public:
/// replaceScalar - When an instruction needs to be modified, this method can
/// be used to update the scalar map to remove the old and insert the new.
+ ///
void replaceScalar(Value *Old, Value *New) {
iterator I = find(Old);
assert(I != end() && "Old value is not in the map!");
@@ -189,6 +190,7 @@ public:
/// getFunctionNames - Return a space separated list of the name of the
/// functions in this graph (if any)
+ ///
std::string getFunctionNames() const;
/// addNode - Add a new node to the graph.
@@ -240,6 +242,7 @@ public:
/// getReturnNodes - Return the mapping of functions to their return nodes for
/// this graph.
+ ///
const ReturnNodesTy &getReturnNodes() const { return ReturnNodes; }
ReturnNodesTy &getReturnNodes() { return ReturnNodes; }
@@ -273,6 +276,7 @@ public:
/// 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;
@@ -354,7 +358,6 @@ public:
void mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph,
unsigned CloneFlags);
-
/// getCallSiteForArguments - Get the arguments and return value bindings for
/// the specified function in the current graph.
///
@@ -389,54 +392,57 @@ public:
};
- /// ReachabilityCloner - This class is used to incrementally clone and merge
- /// nodes from a non-changing source graph into a potentially mutating
- /// destination graph. Nodes are only cloned over on demand, either in
- /// responds to a merge() or getClonedNH() call. When a node is cloned over,
- /// all of the nodes reachable from it are automatically brought over as well.
- class ReachabilityCloner {
- DSGraph &Dest;
- const DSGraph &Src;
-
- /// BitsToKeep - These bits are retained from the source node when the
- /// source nodes are merged into the destination graph.
- unsigned BitsToKeep;
- unsigned CloneFlags;
-
- // NodeMap - A mapping from nodes in the source graph to the nodes that
- // represent them in the destination graph.
- DSGraph::NodeMapTy NodeMap;
- public:
- ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags)
- : Dest(dest), Src(src), CloneFlags(cloneFlags) {
- assert(&Dest != &Src && "Cannot clone from graph to same graph!");
- BitsToKeep = ~DSNode::DEAD;
- if (CloneFlags & DSGraph::StripAllocaBit)
- BitsToKeep &= ~DSNode::AllocaNode;
- if (CloneFlags & DSGraph::StripModRefBits)
- BitsToKeep &= ~(DSNode::Modified | DSNode::Read);
- if (CloneFlags & DSGraph::StripIncompleteBit)
- BitsToKeep &= ~DSNode::Incomplete;
- }
-
- DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);
+/// ReachabilityCloner - This class is used to incrementally clone and merge
+/// nodes from a non-changing source graph into a potentially mutating
+/// destination graph. Nodes are only cloned over on demand, either in
+/// responds to a merge() or getClonedNH() call. When a node is cloned over,
+/// all of the nodes reachable from it are automatically brought over as well.
+///
+class ReachabilityCloner {
+ DSGraph &Dest;
+ const DSGraph &Src;
+
+ /// BitsToKeep - These bits are retained from the source node when the
+ /// source nodes are merged into the destination graph.
+ unsigned BitsToKeep;
+ unsigned CloneFlags;
+
+ // NodeMap - A mapping from nodes in the source graph to the nodes that
+ // represent them in the destination graph.
+ DSGraph::NodeMapTy NodeMap;
+public:
+ ReachabilityCloner(DSGraph &dest, const DSGraph &src, unsigned cloneFlags)
+ : Dest(dest), Src(src), CloneFlags(cloneFlags) {
+ assert(&Dest != &Src && "Cannot clone from graph to same graph!");
+ BitsToKeep = ~DSNode::DEAD;
+ if (CloneFlags & DSGraph::StripAllocaBit)
+ BitsToKeep &= ~DSNode::AllocaNode;
+ if (CloneFlags & DSGraph::StripModRefBits)
+ BitsToKeep &= ~(DSNode::Modified | DSNode::Read);
+ if (CloneFlags & DSGraph::StripIncompleteBit)
+ BitsToKeep &= ~DSNode::Incomplete;
+ }
+
+ DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);
- void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH);
+ void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH);
- /// mergeCallSite - Merge the nodes reachable from the specified src call
- /// site into the nodes reachable from DestCS.
- void mergeCallSite(const DSCallSite &DestCS, const DSCallSite &SrcCS);
+ /// mergeCallSite - Merge the nodes reachable from the specified src call
+ /// site into the nodes reachable from DestCS.
+ ///
+ void mergeCallSite(const DSCallSite &DestCS, const DSCallSite &SrcCS);
- bool clonedAnyNodes() const { return !NodeMap.empty(); }
+ bool clonedAnyNodes() const { return !NodeMap.empty(); }
- /// hasClonedNode - Return true if the specified node has been cloned from
- /// the source graph into the destination graph.
- bool hasClonedNode(const DSNode *N) {
- return NodeMap.count(N);
- }
+ /// hasClonedNode - Return true if the specified node has been cloned from
+ /// the source graph into the destination graph.
+ bool hasClonedNode(const DSNode *N) {
+ return NodeMap.count(N);
+ }
+
+ void destroy() { NodeMap.clear(); }
+};
- void destroy() { NodeMap.clear(); }
- };
} // End llvm namespace
#endif
diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h
index e58c8f936b..3ddd29a5ad 100644
--- a/include/llvm/Analysis/DataStructure/DSNode.h
+++ b/include/llvm/Analysis/DataStructure/DSNode.h
@@ -40,10 +40,12 @@ class DSNode {
/// that this node really is. When nodes get folded together, the node to be
/// eliminated has these fields filled in, otherwise ForwardNH.getNode() is
/// null.
+ ///
DSNodeHandle ForwardNH;
/// Next, Prev - These instance variables are used to keep the node on a
/// doubly-linked ilist in the DSGraph.
+ ///
DSNode *Next, *Prev;
friend class ilist_traits<DSNode>;
@@ -105,12 +107,14 @@ public:
/// DSNode ctor - Create a node of the specified type, inserting it into the
/// specified graph.
+ ///
DSNode(const Type *T, DSGraph *G);
/// DSNode "copy ctor" - Copy the specified node, inserting it into the
/// specified graph. If NullLinks is true, then null out all of the links,
/// but keep the same number of them. This can be used for efficiency if the
/// links are just going to be clobbered anyway.
+ ///
DSNode(const DSNode &, DSGraph *G, bool NullLinks = false);
~DSNode() {
@@ -133,8 +137,10 @@ public:
///
unsigned getSize() const { return Size; }
- // getType - Return the node type of this object...
+ /// getType - Return the node type of this object...
+ ///
const Type *getType() const { return Ty; }
+
bool isArray() const { return NodeType & Array; }
/// hasNoReferrers - Return true if nothing is pointing to this node at all.
@@ -156,6 +162,7 @@ public:
/// getForwardNode - This method returns the node that this node is forwarded
/// to, if any.
+ ///
DSNode *getForwardNode() const { return ForwardNH.getNode(); }
/// isForwarding - Return true if this node is forwarding to another.
@@ -164,9 +171,10 @@ public:
/// stopForwarding - When the last reference to this forwarding node has been
/// dropped, delete the node.
+ ///
void stopForwarding() {
assert(isForwarding() &&
- "Node isn't forwarding, cannot stopForwarding!");
+ "Node isn't forwarding, cannot stopForwarding()!");
ForwardNH.setNode(0);
assert(ParentGraph == 0 &&
"Forwarding nodes must have been removed from graph!");
@@ -184,6 +192,7 @@ public:
}
/// getLink - Return the link at the specified offset.
+ ///
DSNodeHandle &getLink(unsigned Offset) {
assert((Offset & ((1 << DS::PointerShift)-1)) == 0 &&
"Pointer offset not aligned correctly!");
@@ -283,6 +292,7 @@ public:
/// getNodeFlags - Return all of the flags set on the node. If the DEAD flag
/// is set, hide it from the caller.
+ ///
unsigned getNodeFlags() const { return NodeType & ~DEAD; }
bool isAllocaNode() const { return NodeType & AllocaNode; }
@@ -331,6 +341,7 @@ public:
/// remapLinks - Change all of the Links in the current node according to the
/// specified mapping.
+ ///
void remapLinks(hash_map<const DSNode*, DSNodeHandle> &OldNodeMap);
/// markReachableNodes - This method recursively traverses the specified
@@ -423,7 +434,7 @@ inline void DSNodeHandle::setLink(unsigned Off, const DSNodeHandle &NH) {
getNode()->setLink(Off+Offset, NH);
}
-/// addEdgeTo - Add an edge from the current node to the specified node. This
+/// addEdgeTo - Add an edge from the current node to the specified node. This
/// can cause merging of nodes in the graph.
///
inline void DSNodeHandle::addEdgeTo(unsigned Off, const DSNodeHandle &Node) {
diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h
index b1053714b9..fdbb43236e 100644
--- a/include/llvm/Analysis/DataStructure/DSSupport.h
+++ b/include/llvm/Analysis/DataStructure/DSSupport.h
@@ -35,9 +35,9 @@ namespace DS { // FIXME: After the paper, this should get cleaned up
PointerSize = 1 << PointerShift
};
- // isPointerType - Return true if this first class type is big enough to hold
- // a pointer.
- //
+ /// isPointerType - Return true if this first class type is big enough to hold
+ /// a pointer.
+ ///
bool isPointerType(const Type *Ty);
};
@@ -89,6 +89,7 @@ public:
/// isNull - Check to see if getNode() == 0, without going through the trouble
/// of checking to see if we are forwarding...
+ ///
bool isNull() const { return N == 0; }
// Allow explicit conversion to DSNode...
@@ -112,7 +113,8 @@ public:
///
void mergeWith(const DSNodeHandle &N) const;
- // hasLink - Return true if there is a link at the specified offset...
+ /// hasLink - Return true if there is a link at the specified offset...
+ ///
inline bool hasLink(unsigned Num) const;
/// getLink - Treat this current node pointer as a pointer to a structure of
@@ -262,8 +264,9 @@ public:
}
}
- // mergeWith - Merge the return value and parameters of the these two call
- // sites.
+ /// mergeWith - Merge the return value and parameters of the these two call
+ /// sites.
+ ///
void mergeWith(DSCallSite &CS) {
getRetVal().mergeWith(CS.getRetVal());
unsigned MinArgs = getNumPtrArgs();
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index 3a04cd5add..f210003213 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -27,9 +27,9 @@ class DSNode;
// FIXME: move this stuff to a private header
namespace DataStructureAnalysis {
- // isPointerType - Return true if this first class type is big enough to hold
- // a pointer.
- //
+ /// isPointerType - Return true if this first class type is big enough to hold
+ /// a pointer.
+ ///
bool isPointerType(const Type *Ty);
}
@@ -53,7 +53,8 @@ public:
return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
}
- // getDSGraph - Return the data structure graph for the specified function.
+ /// getDSGraph - Return the data structure graph for the specified function.
+ ///
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
@@ -63,13 +64,17 @@ public:
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
- // print - Print out the analysis results...
+ /// print - Print out the analysis results...
+ ///
void print(std::ostream &O, const Module *M) const;
- // If the pass pipeline is done with this pass, we can release our memory...
+ /// releaseMemory - if the pass pipeline is done with this pass, we can
+ /// release our memory...
+ ///
virtual void releaseMemory();
- // getAnalysisUsage - This obviously provides a data structure graph.
+ /// getAnalysisUsage - This obviously provides a data structure graph.
+ ///
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<TargetData>();
@@ -77,10 +82,10 @@ public:
};
-// BUDataStructures - The analysis that computes the interprocedurally closed
-// data structure graphs for all of the functions in the program. This pass
-// only performs a "Bottom Up" propagation (hence the name).
-//
+/// BUDataStructures - The analysis that computes the interprocedurally closed
+/// data structure graphs for all of the functions in the program. This pass