1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[LCG] Add some accessor methods to the SCC to allow iterating over the

parents of an SCC, and add a lookup method for finding the SCC for
a given function. These aren't used yet, but will be used shortly in
some unit tests I'm adding and are really part of the broader intended
interface for the analysis.

llvm-svn: 206959
This commit is contained in:
Chandler Carruth 2014-04-23 09:57:18 +00:00
parent aa4646ea54
commit da074e6ecd

View File

@ -225,9 +225,17 @@ public:
public:
typedef SmallVectorImpl<Node *>::const_iterator iterator;
typedef SmallSetVector<SCC *, 1>::const_iterator parent_iterator;
iterator begin() const { return Nodes.begin(); }
iterator end() const { return Nodes.end(); }
parent_iterator parent_begin() const { return ParentSCCs.begin(); }
parent_iterator parent_end() const { return ParentSCCs.end(); }
iterator_range<parent_iterator> parents() const {
return iterator_range<parent_iterator>(parent_begin(), parent_end());
}
};
/// \brief A post-order depth-first SCC iterator over the call graph.
@ -310,6 +318,12 @@ public:
/// added.
Node *lookup(const Function &F) const { return NodeMap.lookup(&F); }
/// \brief Lookup a function's SCC in the graph.
///
/// \returns null if the function hasn't been assigned an SCC via the SCC
/// iterator walk.
SCC *lookupSCC(const Function &F) const { return SCCMap.lookup(&F); }
/// \brief Get a graph node for a given function, scanning it to populate the
/// graph data as necessary.
Node *get(Function &F) {