aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-03-27 19:41:45 +0000
committerChris Lattner <sabre@nondot.org>2002-03-27 19:41:45 +0000
commitb3ebdadb2c3d7ac7dd36975cd1b1642da39fa81b (patch)
treea76eb1a7e4bbb230b6340b11aa44438019e648d2 /include
parent9d42a1d2f905364841010643ccbb3f12c1247f6d (diff)
downloadexternal_llvm-b3ebdadb2c3d7ac7dd36975cd1b1642da39fa81b.zip
external_llvm-b3ebdadb2c3d7ac7dd36975cd1b1642da39fa81b.tar.gz
external_llvm-b3ebdadb2c3d7ac7dd36975cd1b1642da39fa81b.tar.bz2
* Add a nice utility method to DSNode
* Export interface to tell whether an alloc node represent a malloc or alloca * Add the concept of a "critical" shadow node git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DataStructure.h22
-rw-r--r--include/llvm/Analysis/DataStructure/DataStructure.h22
2 files changed, 40 insertions, 4 deletions
diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h
index 55029b2..73cc19f 100644
--- a/include/llvm/Analysis/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure.h
@@ -128,6 +128,10 @@ public:
void removeReferrer(PointerValSet *PVS);
const std::vector<PointerValSet*> &getReferrers() const { return Referrers; }
+ // removeAllIncomingEdges - Erase all edges in the graph that point to
+ // this node
+ void removeAllIncomingEdges();
+
void addPointer(Value *V) { Pointers.push_back(V); }
const std::vector<Value*> &getPointers() const { return Pointers; }
@@ -170,6 +174,9 @@ public:
virtual std::string getCaption() const;
+ bool isAllocaNode() const;
+ bool isMallocNode() const { return !isAllocaNode(); }
+
// Support type inquiry through isa, cast, and dyn_cast...
static bool classof(const NewDSNode *) { return true; }
static bool classof(const DSNode *N) { return N->NodeType == NewNode; }
@@ -256,14 +263,22 @@ private:
// to. When functions are integrated into each other, shadow nodes are
// resolved.
//
+// Shadow nodes may be marked as "critical" nodes when they are created. This
+// mark indicates that the node is the result of a function call, the value
+// pointed to by an incoming argument, or the value pointed to by a global
+// variable [fixme todo]. Since it is not possible to know what these nodes
+// point to, given just the current context, they are marked "Critical" to avoid
+// having the shadow node merger eliminate them.
+//
class ShadowDSNode : public DSNode {
friend class FunctionDSGraph;
DSNode *Parent;
Module *Mod;
ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node...
std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes;
+ bool CriticalNode;
public:
- ShadowDSNode(DSNode *Parent, Module *M);
+ ShadowDSNode(DSNode *Parent, Module *M, bool Critical = false);
virtual std::string getCaption() const;
// synthesizeNode - Create a new shadow node that is to be linked into this
@@ -271,6 +286,9 @@ public:
//
ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep);
+ bool isCriticalNode() const { return CriticalNode; }
+ void resetCriticalMark() { CriticalNode = false; }
+
// Support type inquiry through isa, cast, and dyn_cast...
static bool classof(const ShadowDSNode *) { return true; }
static bool classof(const DSNode *N) { return N->NodeType == ShadowNode; }
@@ -284,7 +302,7 @@ protected:
if (ShadowParent)
return new ShadowDSNode(getType(), Mod, ShadowParent);
else
- return new ShadowDSNode(Parent, Mod);
+ return new ShadowDSNode(Parent, Mod, CriticalNode);
}
};
diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h
index 55029b2..73cc19f 100644
--- a/include/llvm/Analysis/DataStructure/DataStructure.h
+++ b/include/llvm/Analysis/DataStructure/DataStructure.h
@@ -128,6 +128,10 @@ public:
void removeReferrer(PointerValSet *PVS);
const std::vector<PointerValSet*> &getReferrers() const { return Referrers; }
+ // removeAllIncomingEdges - Erase all edges in the graph that point to
+ // this node
+ void removeAllIncomingEdges();
+
void addPointer(Value *V) { Pointers.push_back(V); }
const std::vector<Value*> &getPointers() const { return Pointers; }
@@ -170,6 +174,9 @@ public:
virtual std::string getCaption() const;
+ bool isAllocaNode() const;
+ bool isMallocNode() const { return !isAllocaNode(); }
+
// Support type inquiry through isa, cast, and dyn_cast...
static bool classof(const NewDSNode *) { return true; }
static bool classof(const DSNode *N) { return N->NodeType == NewNode; }
@@ -256,14 +263,22 @@ private:
// to. When functions are integrated into each other, shadow nodes are
// resolved.
//
+// Shadow nodes may be marked as "critical" nodes when they are created. This
+// mark indicates that the node is the result of a function call, the value
+// pointed to by an incoming argument, or the value pointed to by a global
+// variable [fixme todo]. Since it is not possible to know what these nodes
+// point to, given just the current context, they are marked "Critical" to avoid
+// having the shadow node merger eliminate them.
+//
class ShadowDSNode : public DSNode {
friend class FunctionDSGraph;
DSNode *Parent;
Module *Mod;
ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node...
std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes;
+ bool CriticalNode;
public:
- ShadowDSNode(DSNode *Parent, Module *M);
+ ShadowDSNode(DSNode *Parent, Module *M, bool Critical = false);
virtual std::string getCaption() const;
// synthesizeNode - Create a new shadow node that is to be linked into this
@@ -271,6 +286,9 @@ public:
//
ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep);
+ bool isCriticalNode() const { return CriticalNode; }
+ void resetCriticalMark() { CriticalNode = false; }
+
// Support type inquiry through isa, cast, and dyn_cast...
static bool classof(const ShadowDSNode *) { return true; }
static bool classof(const DSNode *N) { return N->NodeType == ShadowNode; }
@@ -284,7 +302,7 @@ protected:
if (ShadowParent)
return new ShadowDSNode(getType(), Mod, ShadowParent);
else
- return new ShadowDSNode(Parent, Mod);
+ return new ShadowDSNode(Parent, Mod, CriticalNode);
}
};