From a146183c2105911eade774490650389924dae524 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 17 Apr 2002 03:24:47 +0000 Subject: [PATCH] Make data structure acurately get ALL edges, even loads of null fields of nodes that are not shadow nodes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2273 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DataStructure.h | 22 ++++++++++--------- .../Analysis/DataStructure/DataStructure.h | 22 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index e619f6b3603..0474da11d1f 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -20,6 +20,7 @@ class GlobalValue; class FunctionDSGraph; class DataStructure; class DSNodeIterator; +class ShadowDSNode; // FIXME: move this somewhere private unsigned countPointerFields(const Type *Ty); @@ -113,6 +114,8 @@ class DSNode { std::vector FieldLinks; std::vector Pointers; // Values pointing to me... std::vector Referrers; + + std::vector > SynthNodes; DSNode(const DSNode &); // DO NOT IMPLEMENT void operator=(const DSNode &); // DO NOT IMPLEMENT @@ -186,6 +189,10 @@ public: return New; } + // synthesizeNode - Create a new shadow node that is to be linked into this + // chain.. + // + ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); virtual void dropAllReferences() { FieldLinks.clear(); @@ -320,30 +327,25 @@ private: // class ShadowDSNode : public DSNode { friend class FunctionDSGraph; + friend class FunctionRepBuilder; Module *Mod; - ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node... - std::vector > SynthNodes; + DSNode *ShadowParent; // Nonnull if this is a synthesized node... public: ShadowDSNode(const Type *Ty, Module *M); virtual std::string getCaption() const; - // synthesizeNode - Create a new shadow node that is to be linked into this - // chain.. - // - ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); - // isEquivalentTo - Return true if the nodes should be merged... virtual bool isEquivalentTo(DSNode *Node) const; + DSNode *getShadowParent() const { return ShadowParent; } + // 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; } private: - ShadowDSNode(const Type *Ty, Module *M, ShadowDSNode *ShadParent); + ShadowDSNode(const Type *Ty, Module *M, DSNode *ShadParent); protected: - virtual void mapNode(std::map &NodeMap, - const DSNode *Old); virtual ShadowDSNode *cloneImpl() const { if (ShadowParent) return new ShadowDSNode(getType(), Mod, ShadowParent); diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index e619f6b3603..0474da11d1f 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -20,6 +20,7 @@ class GlobalValue; class FunctionDSGraph; class DataStructure; class DSNodeIterator; +class ShadowDSNode; // FIXME: move this somewhere private unsigned countPointerFields(const Type *Ty); @@ -113,6 +114,8 @@ class DSNode { std::vector FieldLinks; std::vector Pointers; // Values pointing to me... std::vector Referrers; + + std::vector > SynthNodes; DSNode(const DSNode &); // DO NOT IMPLEMENT void operator=(const DSNode &); // DO NOT IMPLEMENT @@ -186,6 +189,10 @@ public: return New; } + // synthesizeNode - Create a new shadow node that is to be linked into this + // chain.. + // + ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); virtual void dropAllReferences() { FieldLinks.clear(); @@ -320,30 +327,25 @@ private: // class ShadowDSNode : public DSNode { friend class FunctionDSGraph; + friend class FunctionRepBuilder; Module *Mod; - ShadowDSNode *ShadowParent; // Nonnull if this is a synthesized node... - std::vector > SynthNodes; + DSNode *ShadowParent; // Nonnull if this is a synthesized node... public: ShadowDSNode(const Type *Ty, Module *M); virtual std::string getCaption() const; - // synthesizeNode - Create a new shadow node that is to be linked into this - // chain.. - // - ShadowDSNode *synthesizeNode(const Type *Ty, FunctionRepBuilder *Rep); - // isEquivalentTo - Return true if the nodes should be merged... virtual bool isEquivalentTo(DSNode *Node) const; + DSNode *getShadowParent() const { return ShadowParent; } + // 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; } private: - ShadowDSNode(const Type *Ty, Module *M, ShadowDSNode *ShadParent); + ShadowDSNode(const Type *Ty, Module *M, DSNode *ShadParent); protected: - virtual void mapNode(std::map &NodeMap, - const DSNode *Old); virtual ShadowDSNode *cloneImpl() const { if (ShadowParent) return new ShadowDSNode(getType(), Mod, ShadowParent); -- 2.34.1