From 9a691dbc8241ccf7779062124ba3a3ba728b313f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 30 Mar 2002 09:07:51 +0000 Subject: [PATCH] Add accessors and a method to get all the outgoing links for ALL nodes git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2055 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DataStructure.h | 33 +++++++++++++++++++ .../Analysis/DataStructure/DataStructure.h | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index 379ccfa9136..64cd3fc566a 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -131,6 +131,10 @@ public: assert(i < getNumLinks() && "Field links access out of range..."); return FieldLinks[i]; } + const PointerValSet &getLink(unsigned i) const { + assert(i < getNumLinks() && "Field links access out of range..."); + return FieldLinks[i]; + } // addReferrer - Keep the referrer set up to date... void addReferrer(PointerValSet *PVS) { Referrers.push_back(PVS); } @@ -146,6 +150,18 @@ public: const Type *getType() const { return Ty; } + // getNumOutgoingLinks - Return the number of outgoing links, which is usually + // the number of normal links, but for call nodes it also includes their + // arguments. + // + virtual unsigned getNumOutgoingLinks() const { return getNumLinks(); } + virtual PointerValSet &getOutgoingLink(unsigned Link) { + return getLink(Link); + } + virtual const PointerValSet &getOutgoingLink(unsigned Link) const { + return getLink(Link); + } + void print(std::ostream &O) const; virtual std::string getCaption() const = 0; @@ -258,6 +274,22 @@ public: ArgLinks.clear(); } + // getNumOutgoingLinks - Return the number of outgoing links, which is usually + // the number of normal links, but for call nodes it also includes their + // arguments. + // + virtual unsigned getNumOutgoingLinks() const { + return getNumLinks() + getNumArgs(); + } + virtual PointerValSet &getOutgoingLink(unsigned Link) { + if (Link < getNumLinks()) return getLink(Link); + return getArgValues(Link-getNumLinks()); + } + virtual const PointerValSet &getOutgoingLink(unsigned Link) const { + if (Link < getNumLinks()) return getLink(Link); + return getArgValues(Link-getNumLinks()); + } + // isEquivalentTo - Return true if the nodes should be merged... virtual bool isEquivalentTo(DSNode *Node) const; @@ -393,6 +425,7 @@ public: // std::map &getValueMap() { return ValueMap; } + const PointerValSet &getRetNodes() const { return RetNode; } void printFunction(std::ostream &O, const char *Label) const; diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 379ccfa9136..64cd3fc566a 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -131,6 +131,10 @@ public: assert(i < getNumLinks() && "Field links access out of range..."); return FieldLinks[i]; } + const PointerValSet &getLink(unsigned i) const { + assert(i < getNumLinks() && "Field links access out of range..."); + return FieldLinks[i]; + } // addReferrer - Keep the referrer set up to date... void addReferrer(PointerValSet *PVS) { Referrers.push_back(PVS); } @@ -146,6 +150,18 @@ public: const Type *getType() const { return Ty; } + // getNumOutgoingLinks - Return the number of outgoing links, which is usually + // the number of normal links, but for call nodes it also includes their + // arguments. + // + virtual unsigned getNumOutgoingLinks() const { return getNumLinks(); } + virtual PointerValSet &getOutgoingLink(unsigned Link) { + return getLink(Link); + } + virtual const PointerValSet &getOutgoingLink(unsigned Link) const { + return getLink(Link); + } + void print(std::ostream &O) const; virtual std::string getCaption() const = 0; @@ -258,6 +274,22 @@ public: ArgLinks.clear(); } + // getNumOutgoingLinks - Return the number of outgoing links, which is usually + // the number of normal links, but for call nodes it also includes their + // arguments. + // + virtual unsigned getNumOutgoingLinks() const { + return getNumLinks() + getNumArgs(); + } + virtual PointerValSet &getOutgoingLink(unsigned Link) { + if (Link < getNumLinks()) return getLink(Link); + return getArgValues(Link-getNumLinks()); + } + virtual const PointerValSet &getOutgoingLink(unsigned Link) const { + if (Link < getNumLinks()) return getLink(Link); + return getArgValues(Link-getNumLinks()); + } + // isEquivalentTo - Return true if the nodes should be merged... virtual bool isEquivalentTo(DSNode *Node) const; @@ -393,6 +425,7 @@ public: // std::map &getValueMap() { return ValueMap; } + const PointerValSet &getRetNodes() const { return RetNode; } void printFunction(std::ostream &O, const char *Label) const; -- 2.34.1