aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-27 21:49:25 +0000
committerChris Lattner <sabre@nondot.org>2004-01-27 21:49:25 +0000
commit7a31285c3f6964a1dd1c66072f241d3bc77f6114 (patch)
tree6039f473e09c3f58e2060744f3dfe307223964b0
parent5f549af582cd69bd214690e56e64d0057c92fc56 (diff)
Add comments, allow DSNode "copy ctor" to ignore outgoing links, add more
structured access to the globals list, add a couple helper methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10982 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DSNode.h23
-rw-r--r--include/llvm/Analysis/DataStructure/DSNode.h23
2 files changed, 40 insertions, 6 deletions
diff --git a/include/llvm/Analysis/DSNode.h b/include/llvm/Analysis/DSNode.h
index 1008789046..25920e26e7 100644
--- a/include/llvm/Analysis/DSNode.h
+++ b/include/llvm/Analysis/DSNode.h
@@ -97,9 +97,16 @@ public:
private:
unsigned short NodeType;
public:
-
+
+ /// DSNode ctor - Create a node of the specified type, inserting it into the
+ /// specified graph.
DSNode(const Type *T, DSGraph *G);
- DSNode(const DSNode &, 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() {
dropAllReferences();
@@ -241,14 +248,24 @@ public:
/// also marks the node with the 'G' flag if it does not already have it.
///
void addGlobal(GlobalValue *GV);
+ void mergeGlobals(const std::vector<GlobalValue*> &RHS);
const std::vector<GlobalValue*> &getGlobals() const { return Globals; }
+ typedef std::vector<GlobalValue*>::const_iterator global_iterator;
+ global_iterator global_begin() const { return Globals.begin(); }
+ global_iterator global_end() const { return Globals.end(); }
+
+
/// maskNodeTypes - Apply a mask to the node types bitfield.
///
void maskNodeTypes(unsigned Mask) {
NodeType &= Mask;
}
+ void mergeNodeFlags(unsigned RHS) {
+ NodeType |= RHS;
+ }
+
/// 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; }
@@ -320,7 +337,7 @@ private:
inline DSNode *DSNodeHandle::getNode() const {
assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) ||
!N->ForwardNH.isNull()) && "Node handle offset out of range!");
- if (!N || N->ForwardNH.isNull())
+ if (N == 0 || N->ForwardNH.isNull())
return N;
return HandleForwarding();
diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h
index 1008789046..25920e26e7 100644
--- a/include/llvm/Analysis/DataStructure/DSNode.h
+++ b/include/llvm/Analysis/DataStructure/DSNode.h
@@ -97,9 +97,16 @@ public:
private:
unsigned short NodeType;
public:
-
+
+ /// DSNode ctor - Create a node of the specified type, inserting it into the
+ /// specified graph.
DSNode(const Type *T, DSGraph *G);
- DSNode(const DSNode &, 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() {
dropAllReferences();
@@ -241,14 +248,24 @@ public:
/// also marks the node with the 'G' flag if it does not already have it.
///
void addGlobal(GlobalValue *GV);
+ void mergeGlobals(const std::vector<GlobalValue*> &RHS);
const std::vector<GlobalValue*> &getGlobals() const { return Globals; }
+ typedef std::vector<GlobalValue*>::const_iterator global_iterator;
+ global_iterator global_begin() const { return Globals.begin(); }
+ global_iterator global_end() const { return Globals.end(); }
+
+
/// maskNodeTypes - Apply a mask to the node types bitfield.
///
void maskNodeTypes(unsigned Mask) {
NodeType &= Mask;
}
+ void mergeNodeFlags(unsigned RHS) {
+ NodeType |= RHS;
+ }
+
/// 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; }
@@ -320,7 +337,7 @@ private:
inline DSNode *DSNodeHandle::getNode() const {
assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) ||
!N->ForwardNH.isNull()) && "Node handle offset out of range!");
- if (!N || N->ForwardNH.isNull())
+ if (N == 0 || N->ForwardNH.isNull())
return N;
return HandleForwarding();