Remove the concept of a critical shadow node

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2265 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-04-16 20:39:23 +00:00
parent 7523a107d9
commit 28c238636e
2 changed files with 12 additions and 28 deletions

View File

@ -118,7 +118,7 @@ class DSNode {
void operator=(const DSNode &); // DO NOT IMPLEMENT void operator=(const DSNode &); // DO NOT IMPLEMENT
public: public:
enum NodeTy { enum NodeTy {
NewNode, CallNode, ShadowNode, ArgNode, GlobalNode NewNode, CallNode, ShadowNode, GlobalNode
} NodeType; } NodeType;
DSNode(enum NodeTy NT, const Type *T); DSNode(enum NodeTy NT, const Type *T);
@ -254,6 +254,9 @@ class CallDSNode : public DSNode {
std::vector<PointerValSet> ArgLinks; std::vector<PointerValSet> ArgLinks;
public: public:
CallDSNode(CallInst *CI); CallDSNode(CallInst *CI);
~CallDSNode() {
ArgLinks.clear();
}
CallInst *getCall() const { return CI; } CallInst *getCall() const { return CI; }
@ -315,21 +318,13 @@ private:
// to. When functions are integrated into each other, shadow nodes are // to. When functions are integrated into each other, shadow nodes are
// resolved. // 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 { class ShadowDSNode : public DSNode {
friend class FunctionDSGraph; friend class FunctionDSGraph;
Module *Mod; Module *Mod;
ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node... ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node...
std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes; std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes;
bool CriticalNode;
public: public:
ShadowDSNode(const Type *Ty, Module *M, bool Critical = false); ShadowDSNode(const Type *Ty, Module *M);
virtual std::string getCaption() const; virtual std::string getCaption() const;
// synthesizeNode - Create a new shadow node that is to be linked into this // synthesizeNode - Create a new shadow node that is to be linked into this
@ -337,9 +332,6 @@ public:
// //
ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep);
bool isCriticalNode() const { return CriticalNode; }
void resetCriticalMark() { CriticalNode = false; }
// isEquivalentTo - Return true if the nodes should be merged... // isEquivalentTo - Return true if the nodes should be merged...
virtual bool isEquivalentTo(DSNode *Node) const; virtual bool isEquivalentTo(DSNode *Node) const;
@ -356,7 +348,7 @@ protected:
if (ShadowParent) if (ShadowParent)
return new ShadowDSNode(getType(), Mod, ShadowParent); return new ShadowDSNode(getType(), Mod, ShadowParent);
else else
return new ShadowDSNode(getType(), Mod, CriticalNode); return new ShadowDSNode(getType(), Mod);
} }
}; };

View File

@ -118,7 +118,7 @@ class DSNode {
void operator=(const DSNode &); // DO NOT IMPLEMENT void operator=(const DSNode &); // DO NOT IMPLEMENT
public: public:
enum NodeTy { enum NodeTy {
NewNode, CallNode, ShadowNode, ArgNode, GlobalNode NewNode, CallNode, ShadowNode, GlobalNode
} NodeType; } NodeType;
DSNode(enum NodeTy NT, const Type *T); DSNode(enum NodeTy NT, const Type *T);
@ -254,6 +254,9 @@ class CallDSNode : public DSNode {
std::vector<PointerValSet> ArgLinks; std::vector<PointerValSet> ArgLinks;
public: public:
CallDSNode(CallInst *CI); CallDSNode(CallInst *CI);
~CallDSNode() {
ArgLinks.clear();
}
CallInst *getCall() const { return CI; } CallInst *getCall() const { return CI; }
@ -315,21 +318,13 @@ private:
// to. When functions are integrated into each other, shadow nodes are // to. When functions are integrated into each other, shadow nodes are
// resolved. // 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 { class ShadowDSNode : public DSNode {
friend class FunctionDSGraph; friend class FunctionDSGraph;
Module *Mod; Module *Mod;
ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node... ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node...
std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes; std::vector<std::pair<const Type *, ShadowDSNode *> > SynthNodes;
bool CriticalNode;
public: public:
ShadowDSNode(const Type *Ty, Module *M, bool Critical = false); ShadowDSNode(const Type *Ty, Module *M);
virtual std::string getCaption() const; virtual std::string getCaption() const;
// synthesizeNode - Create a new shadow node that is to be linked into this // synthesizeNode - Create a new shadow node that is to be linked into this
@ -337,9 +332,6 @@ public:
// //
ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep);
bool isCriticalNode() const { return CriticalNode; }
void resetCriticalMark() { CriticalNode = false; }
// isEquivalentTo - Return true if the nodes should be merged... // isEquivalentTo - Return true if the nodes should be merged...
virtual bool isEquivalentTo(DSNode *Node) const; virtual bool isEquivalentTo(DSNode *Node) const;
@ -356,7 +348,7 @@ protected:
if (ShadowParent) if (ShadowParent)
return new ShadowDSNode(getType(), Mod, ShadowParent); return new ShadowDSNode(getType(), Mod, ShadowParent);
else else
return new ShadowDSNode(getType(), Mod, CriticalNode); return new ShadowDSNode(getType(), Mod);
} }
}; };