mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
Get rid of the whole "Node2" business, rename getNode() ->getBlock() to
be more descriptive git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -53,8 +53,7 @@ public:
|
|||||||
// is unreachable in this function, the set will be empty. This cannot happen
|
// is unreachable in this function, the set will be empty. This cannot happen
|
||||||
// for reachable code, because every block dominates at least itself.
|
// for reachable code, because every block dominates at least itself.
|
||||||
//
|
//
|
||||||
class DominatorSetBase : public DominatorBase {
|
struct DominatorSetBase : public DominatorBase {
|
||||||
public:
|
|
||||||
typedef std::set<BasicBlock*> DomSetType; // Dom set for a bb
|
typedef std::set<BasicBlock*> DomSetType; // Dom set for a bb
|
||||||
// Map of dom sets
|
// Map of dom sets
|
||||||
typedef std::map<BasicBlock*, DomSetType> DomSetMapType;
|
typedef std::map<BasicBlock*, DomSetType> DomSetMapType;
|
||||||
@@ -251,11 +250,8 @@ struct ImmediateDominators : public ImmediateDominatorsBase {
|
|||||||
//
|
//
|
||||||
// DominatorTree - Calculate the immediate dominator tree for a function.
|
// DominatorTree - Calculate the immediate dominator tree for a function.
|
||||||
//
|
//
|
||||||
class DominatorTreeBase : public DominatorBase {
|
struct DominatorTreeBase : public DominatorBase {
|
||||||
protected:
|
class Node;
|
||||||
class Node2;
|
|
||||||
public:
|
|
||||||
typedef Node2 Node;
|
|
||||||
protected:
|
protected:
|
||||||
std::map<BasicBlock*, Node*> Nodes;
|
std::map<BasicBlock*, Node*> Nodes;
|
||||||
void reset();
|
void reset();
|
||||||
@@ -263,12 +259,12 @@ protected:
|
|||||||
|
|
||||||
Node *RootNode;
|
Node *RootNode;
|
||||||
public:
|
public:
|
||||||
class Node2 {
|
class Node {
|
||||||
friend class DominatorTree;
|
friend class DominatorTree;
|
||||||
friend class PostDominatorTree;
|
friend class PostDominatorTree;
|
||||||
friend class DominatorTreeBase;
|
friend class DominatorTreeBase;
|
||||||
BasicBlock *TheNode;
|
BasicBlock *TheBB;
|
||||||
Node2 *IDom;
|
Node *IDom;
|
||||||
std::vector<Node*> Children;
|
std::vector<Node*> Children;
|
||||||
public:
|
public:
|
||||||
typedef std::vector<Node*>::iterator iterator;
|
typedef std::vector<Node*>::iterator iterator;
|
||||||
@@ -279,25 +275,25 @@ public:
|
|||||||
const_iterator begin() const { return Children.begin(); }
|
const_iterator begin() const { return Children.begin(); }
|
||||||
const_iterator end() const { return Children.end(); }
|
const_iterator end() const { return Children.end(); }
|
||||||
|
|
||||||
inline BasicBlock *getNode() const { return TheNode; }
|
inline BasicBlock *getBlock() const { return TheBB; }
|
||||||
inline Node2 *getIDom() const { return IDom; }
|
inline Node *getIDom() const { return IDom; }
|
||||||
inline const std::vector<Node*> &getChildren() const { return Children; }
|
inline const std::vector<Node*> &getChildren() const { return Children; }
|
||||||
|
|
||||||
// dominates - Returns true iff this dominates N. Note that this is not a
|
// dominates - Returns true iff this dominates N. Note that this is not a
|
||||||
// constant time operation!
|
// constant time operation!
|
||||||
inline bool dominates(const Node2 *N) const {
|
inline bool dominates(const Node *N) const {
|
||||||
const Node2 *IDom;
|
const Node *IDom;
|
||||||
while ((IDom = N->getIDom()) != 0 && IDom != this)
|
while ((IDom = N->getIDom()) != 0 && IDom != this)
|
||||||
N = IDom; // Walk up the tree
|
N = IDom; // Walk up the tree
|
||||||
return IDom != 0;
|
return IDom != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline Node2(BasicBlock *node, Node *iDom)
|
inline Node(BasicBlock *BB, Node *iDom)
|
||||||
: TheNode(node), IDom(iDom) {}
|
: TheBB(BB), IDom(iDom) {}
|
||||||
inline Node2 *addChild(Node *C) { Children.push_back(C); return C; }
|
inline Node *addChild(Node *C) { Children.push_back(C); return C; }
|
||||||
|
|
||||||
void setIDom(Node2 *NewIDom);
|
void setIDom(Node *NewIDom);
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -413,8 +409,7 @@ template <> struct GraphTraits<DominatorTree*>
|
|||||||
//
|
//
|
||||||
// DominanceFrontier - Calculate the dominance frontiers for a function.
|
// DominanceFrontier - Calculate the dominance frontiers for a function.
|
||||||
//
|
//
|
||||||
class DominanceFrontierBase : public DominatorBase {
|
struct DominanceFrontierBase : public DominatorBase {
|
||||||
public:
|
|
||||||
typedef std::set<BasicBlock*> DomSetType; // Dom set for a bb
|
typedef std::set<BasicBlock*> DomSetType; // Dom set for a bb
|
||||||
typedef std::map<BasicBlock*, DomSetType> DomSetMapType; // Dom set map
|
typedef std::map<BasicBlock*, DomSetType> DomSetMapType; // Dom set map
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user