mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-01 02:33:44 +00:00
s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0fa6b37c6f
commit
26042420d6
@ -56,12 +56,61 @@ public:
|
|||||||
bool isPostDominator() const { return IsPostDominators; }
|
bool isPostDominator() const { return IsPostDominators; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
// DomTreeNode - Dominator Tree Node
|
||||||
|
|
||||||
|
class DomTreeNode {
|
||||||
|
friend class DominatorTree;
|
||||||
|
friend struct PostDominatorTree;
|
||||||
|
friend class DominatorTreeBase;
|
||||||
|
BasicBlock *TheBB;
|
||||||
|
DomTreeNode *IDom;
|
||||||
|
std::vector<DomTreeNode*> Children;
|
||||||
|
public:
|
||||||
|
typedef std::vector<DomTreeNode*>::iterator iterator;
|
||||||
|
typedef std::vector<DomTreeNode*>::const_iterator const_iterator;
|
||||||
|
|
||||||
|
iterator begin() { return Children.begin(); }
|
||||||
|
iterator end() { return Children.end(); }
|
||||||
|
const_iterator begin() const { return Children.begin(); }
|
||||||
|
const_iterator end() const { return Children.end(); }
|
||||||
|
|
||||||
|
inline BasicBlock *getBlock() const { return TheBB; }
|
||||||
|
inline DomTreeNode *getIDom() const { return IDom; }
|
||||||
|
inline const std::vector<DomTreeNode*> &getChildren() const { return Children; }
|
||||||
|
|
||||||
|
/// properlyDominates - Returns true iff this dominates N and this != N.
|
||||||
|
/// Note that this is not a constant time operation!
|
||||||
|
///
|
||||||
|
bool properlyDominates(const DomTreeNode *N) const {
|
||||||
|
const DomTreeNode *IDom;
|
||||||
|
if (this == 0 || N == 0) return false;
|
||||||
|
while ((IDom = N->getIDom()) != 0 && IDom != this)
|
||||||
|
N = IDom; // Walk up the tree
|
||||||
|
return IDom != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// dominates - Returns true iff this dominates N. Note that this is not a
|
||||||
|
/// constant time operation!
|
||||||
|
///
|
||||||
|
inline bool dominates(const DomTreeNode *N) const {
|
||||||
|
if (N == this) return true; // A node trivially dominates itself.
|
||||||
|
return properlyDominates(N);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {}
|
||||||
|
inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; }
|
||||||
|
|
||||||
|
void setIDom(DomTreeNode *NewIDom);
|
||||||
|
};
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
/// DominatorTree - Calculate the immediate dominator tree for a function.
|
/// DominatorTree - Calculate the immediate dominator tree for a function.
|
||||||
///
|
///
|
||||||
class DominatorTreeBase : public DominatorBase {
|
class DominatorTreeBase : public DominatorBase {
|
||||||
public:
|
public:
|
||||||
class DomTreeNode;
|
|
||||||
protected:
|
protected:
|
||||||
std::map<BasicBlock*, DomTreeNode*> DomTreeNodes;
|
std::map<BasicBlock*, DomTreeNode*> DomTreeNodes;
|
||||||
void reset();
|
void reset();
|
||||||
@ -88,52 +137,6 @@ protected:
|
|||||||
std::map<BasicBlock*, InfoRec> Info;
|
std::map<BasicBlock*, InfoRec> Info;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class DomTreeNode {
|
|
||||||
friend class DominatorTree;
|
|
||||||
friend struct PostDominatorTree;
|
|
||||||
friend class DominatorTreeBase;
|
|
||||||
BasicBlock *TheBB;
|
|
||||||
DomTreeNode *IDom;
|
|
||||||
std::vector<DomTreeNode*> Children;
|
|
||||||
public:
|
|
||||||
typedef std::vector<DomTreeNode*>::iterator iterator;
|
|
||||||
typedef std::vector<DomTreeNode*>::const_iterator const_iterator;
|
|
||||||
|
|
||||||
iterator begin() { return Children.begin(); }
|
|
||||||
iterator end() { return Children.end(); }
|
|
||||||
const_iterator begin() const { return Children.begin(); }
|
|
||||||
const_iterator end() const { return Children.end(); }
|
|
||||||
|
|
||||||
inline BasicBlock *getBlock() const { return TheBB; }
|
|
||||||
inline DomTreeNode *getIDom() const { return IDom; }
|
|
||||||
inline const std::vector<DomTreeNode*> &getChildren() const { return Children; }
|
|
||||||
|
|
||||||
/// properlyDominates - Returns true iff this dominates N and this != N.
|
|
||||||
/// Note that this is not a constant time operation!
|
|
||||||
///
|
|
||||||
bool properlyDominates(const DomTreeNode *N) const {
|
|
||||||
const DomTreeNode *IDom;
|
|
||||||
if (this == 0 || N == 0) return false;
|
|
||||||
while ((IDom = N->getIDom()) != 0 && IDom != this)
|
|
||||||
N = IDom; // Walk up the tree
|
|
||||||
return IDom != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// dominates - Returns true iff this dominates N. Note that this is not a
|
|
||||||
/// constant time operation!
|
|
||||||
///
|
|
||||||
inline bool dominates(const DomTreeNode *N) const {
|
|
||||||
if (N == this) return true; // A node trivially dominates itself.
|
|
||||||
return properlyDominates(N);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom) : TheBB(BB), IDom(iDom) {}
|
|
||||||
inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; }
|
|
||||||
|
|
||||||
void setIDom(DomTreeNode *NewIDom);
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DominatorTreeBase(intptr_t ID, bool isPostDom)
|
DominatorTreeBase(intptr_t ID, bool isPostDom)
|
||||||
: DominatorBase(ID, isPostDom) {}
|
: DominatorBase(ID, isPostDom) {}
|
||||||
@ -238,8 +241,8 @@ private:
|
|||||||
/// DominatorTree GraphTraits specialization so the DominatorTree can be
|
/// DominatorTree GraphTraits specialization so the DominatorTree can be
|
||||||
/// iterable by generic graph iterators.
|
/// iterable by generic graph iterators.
|
||||||
///
|
///
|
||||||
template <> struct GraphTraits<DominatorTree::DomTreeNode*> {
|
template <> struct GraphTraits<DomTreeNode*> {
|
||||||
typedef DominatorTree::DomTreeNode NodeType;
|
typedef DomTreeNode NodeType;
|
||||||
typedef NodeType::iterator ChildIteratorType;
|
typedef NodeType::iterator ChildIteratorType;
|
||||||
|
|
||||||
static NodeType *getEntryNode(NodeType *N) {
|
static NodeType *getEntryNode(NodeType *N) {
|
||||||
@ -254,7 +257,7 @@ template <> struct GraphTraits<DominatorTree::DomTreeNode*> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <> struct GraphTraits<DominatorTree*>
|
template <> struct GraphTraits<DominatorTree*>
|
||||||
: public GraphTraits<DominatorTree::DomTreeNode*> {
|
: public GraphTraits<DomTreeNode*> {
|
||||||
static NodeType *getEntryNode(DominatorTree *DT) {
|
static NodeType *getEntryNode(DominatorTree *DT) {
|
||||||
return DT->getRootNode();
|
return DT->getRootNode();
|
||||||
}
|
}
|
||||||
@ -501,9 +504,10 @@ public:
|
|||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
AU.addRequired<DominatorTree>();
|
AU.addRequired<DominatorTree>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const DomSetType &calculate(const DominatorTree &DT,
|
const DomSetType &calculate(const DominatorTree &DT,
|
||||||
const DominatorTree::DomTreeNode *Node);
|
const DomTreeNode *Node);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
|
|||||||
Frontiers.clear();
|
Frontiers.clear();
|
||||||
PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
|
PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
|
||||||
Roots = DT.getRoots();
|
Roots = DT.getRoots();
|
||||||
if (const DominatorTree::DomTreeNode *Root = DT.getRootNode())
|
if (const DomTreeNode *Root = DT.getRootNode())
|
||||||
calculate(DT, Root);
|
calculate(DT, Root);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const DomSetType &calculate(const PostDominatorTree &DT,
|
const DomSetType &calculate(const PostDominatorTree &DT,
|
||||||
const DominatorTree::DomTreeNode *Node);
|
const DomTreeNode *Node);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -188,7 +188,7 @@ void PostDominatorTree::calculate(Function &F) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DominatorTreeBase::DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) {
|
DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) {
|
||||||
DomTreeNode *&BBNode = DomTreeNodes[BB];
|
DomTreeNode *&BBNode = DomTreeNodes[BB];
|
||||||
if (BBNode) return BBNode;
|
if (BBNode) return BBNode;
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ ETNode *PostETForest::getNodeForBlock(BasicBlock *BB) {
|
|||||||
|
|
||||||
// Haven't calculated this node yet? Get or calculate the node for the
|
// Haven't calculated this node yet? Get or calculate the node for the
|
||||||
// immediate dominator.
|
// immediate dominator.
|
||||||
PostDominatorTree::DomTreeNode *node = getAnalysis<PostDominatorTree>().getNode(BB);
|
DomTreeNode *node = getAnalysis<PostDominatorTree>().getNode(BB);
|
||||||
|
|
||||||
// If we are unreachable, we may not have an immediate dominator.
|
// If we are unreachable, we may not have an immediate dominator.
|
||||||
if (!node)
|
if (!node)
|
||||||
@ -245,7 +245,7 @@ void PostETForest::calculate(const PostDominatorTree &DT) {
|
|||||||
ETNode *&BBNode = Nodes[BB];
|
ETNode *&BBNode = Nodes[BB];
|
||||||
if (!BBNode) {
|
if (!BBNode) {
|
||||||
ETNode *IDomNode = NULL;
|
ETNode *IDomNode = NULL;
|
||||||
PostDominatorTree::DomTreeNode *node = DT.getNode(BB);
|
DomTreeNode *node = DT.getNode(BB);
|
||||||
if (node && node->getIDom())
|
if (node && node->getIDom())
|
||||||
IDomNode = getNodeForBlock(node->getIDom()->getBlock());
|
IDomNode = getNodeForBlock(node->getIDom()->getBlock());
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ H("postdomfrontier", "Post-Dominance Frontier Construction", true);
|
|||||||
|
|
||||||
const DominanceFrontier::DomSetType &
|
const DominanceFrontier::DomSetType &
|
||||||
PostDominanceFrontier::calculate(const PostDominatorTree &DT,
|
PostDominanceFrontier::calculate(const PostDominatorTree &DT,
|
||||||
const DominatorTree::DomTreeNode *Node) {
|
const DomTreeNode *Node) {
|
||||||
// Loop over CFG successors to calculate DFlocal[Node]
|
// Loop over CFG successors to calculate DFlocal[Node]
|
||||||
BasicBlock *BB = Node->getBlock();
|
BasicBlock *BB = Node->getBlock();
|
||||||
DomSetType &S = Frontiers[BB]; // The new set to fill in...
|
DomSetType &S = Frontiers[BB]; // The new set to fill in...
|
||||||
@ -287,7 +287,7 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT,
|
|||||||
for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB);
|
for (pred_iterator SI = pred_begin(BB), SE = pred_end(BB);
|
||||||
SI != SE; ++SI) {
|
SI != SE; ++SI) {
|
||||||
// Does Node immediately dominate this predecessor?
|
// Does Node immediately dominate this predecessor?
|
||||||
DominatorTree::DomTreeNode *SINode = DT[*SI];
|
DomTreeNode *SINode = DT[*SI];
|
||||||
if (SINode && SINode->getIDom() != Node)
|
if (SINode && SINode->getIDom() != Node)
|
||||||
S.insert(*SI);
|
S.insert(*SI);
|
||||||
}
|
}
|
||||||
@ -296,9 +296,9 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT,
|
|||||||
// Loop through and visit the nodes that Node immediately dominates (Node's
|
// Loop through and visit the nodes that Node immediately dominates (Node's
|
||||||
// children in the IDomTree)
|
// children in the IDomTree)
|
||||||
//
|
//
|
||||||
for (PostDominatorTree::DomTreeNode::const_iterator
|
for (DomTreeNode::const_iterator
|
||||||
NI = Node->begin(), NE = Node->end(); NI != NE; ++NI) {
|
NI = Node->begin(), NE = Node->end(); NI != NE; ++NI) {
|
||||||
DominatorTree::DomTreeNode *IDominee = *NI;
|
DomTreeNode *IDominee = *NI;
|
||||||
const DomSetType &ChildDF = calculate(DT, IDominee);
|
const DomSetType &ChildDF = calculate(DT, IDominee);
|
||||||
|
|
||||||
DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end();
|
DomSetType::const_iterator CDFI = ChildDF.begin(), CDFE = ChildDF.end();
|
||||||
|
@ -387,8 +387,8 @@ bool ADCE::doADCE() {
|
|||||||
// postdominator that is alive, and the last postdominator that is
|
// postdominator that is alive, and the last postdominator that is
|
||||||
// dead...
|
// dead...
|
||||||
//
|
//
|
||||||
PostDominatorTree::DomTreeNode *LastNode = DT[TI->getSuccessor(i)];
|
DomTreeNode *LastNode = DT[TI->getSuccessor(i)];
|
||||||
PostDominatorTree::DomTreeNode *NextNode = 0;
|
DomTreeNode *NextNode = 0;
|
||||||
|
|
||||||
if (LastNode) {
|
if (LastNode) {
|
||||||
NextNode = LastNode->getIDom();
|
NextNode = LastNode->getIDom();
|
||||||
|
@ -94,7 +94,7 @@ bool GCSE::runOnFunction(Function &F) {
|
|||||||
|
|
||||||
// Traverse the CFG of the function in dominator order, so that we see each
|
// Traverse the CFG of the function in dominator order, so that we see each
|
||||||
// instruction after we see its operands.
|
// instruction after we see its operands.
|
||||||
for (df_iterator<DominatorTree::DomTreeNode*> DI = df_begin(DT.getRootNode()),
|
for (df_iterator<DomTreeNode*> DI = df_begin(DT.getRootNode()),
|
||||||
E = df_end(DT.getRootNode()); DI != E; ++DI) {
|
E = df_end(DT.getRootNode()); DI != E; ++DI) {
|
||||||
BasicBlock *BB = DI->getBlock();
|
BasicBlock *BB = DI->getBlock();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace {
|
|||||||
// For a given block, calculate the generated expressions, temporaries,
|
// For a given block, calculate the generated expressions, temporaries,
|
||||||
// and the AVAIL_OUT set
|
// and the AVAIL_OUT set
|
||||||
void CalculateAvailOut(ValueTable& VN, std::set<Value*, ExprLT>& MS,
|
void CalculateAvailOut(ValueTable& VN, std::set<Value*, ExprLT>& MS,
|
||||||
DominatorTree::DomTreeNode* DI,
|
DomTreeNode* DI,
|
||||||
std::set<Value*, ExprLT>& currExps,
|
std::set<Value*, ExprLT>& currExps,
|
||||||
std::set<PHINode*>& currPhis,
|
std::set<PHINode*>& currPhis,
|
||||||
std::set<Value*>& currTemps,
|
std::set<Value*>& currTemps,
|
||||||
@ -271,7 +271,7 @@ void GVNPRE::dump_unique(GVNPRE::ValueTable& VN, std::set<Value*, ExprLT>& s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set<Value*, ExprLT>& MS,
|
void GVNPRE::CalculateAvailOut(GVNPRE::ValueTable& VN, std::set<Value*, ExprLT>& MS,
|
||||||
DominatorTree::DomTreeNode* DI,
|
DomTreeNode* DI,
|
||||||
std::set<Value*, ExprLT>& currExps,
|
std::set<Value*, ExprLT>& currExps,
|
||||||
std::set<PHINode*>& currPhis,
|
std::set<PHINode*>& currPhis,
|
||||||
std::set<Value*>& currTemps,
|
std::set<Value*>& currTemps,
|
||||||
@ -333,7 +333,7 @@ bool GVNPRE::runOnFunction(Function &F) {
|
|||||||
// First Phase of BuildSets - calculate AVAIL_OUT
|
// First Phase of BuildSets - calculate AVAIL_OUT
|
||||||
|
|
||||||
// Top-down walk of the dominator tree
|
// Top-down walk of the dominator tree
|
||||||
for (df_iterator<DominatorTree::DomTreeNode*> DI = df_begin(DT.getRootNode()),
|
for (df_iterator<DomTreeNode*> DI = df_begin(DT.getRootNode()),
|
||||||
E = df_end(DT.getRootNode()); DI != E; ++DI) {
|
E = df_end(DT.getRootNode()); DI != E; ++DI) {
|
||||||
|
|
||||||
// Get the sets to update for this block
|
// Get the sets to update for this block
|
||||||
@ -359,7 +359,7 @@ bool GVNPRE::runOnFunction(Function &F) {
|
|||||||
std::set<Value*, ExprLT> anticOut;
|
std::set<Value*, ExprLT> anticOut;
|
||||||
|
|
||||||
// Top-down walk of the postdominator tree
|
// Top-down walk of the postdominator tree
|
||||||
for (df_iterator<PostDominatorTree::DomTreeNode*> PDI =
|
for (df_iterator<DomTreeNode*> PDI =
|
||||||
df_begin(PDT.getRootNode()), E = df_end(DT.getRootNode());
|
df_begin(PDT.getRootNode()), E = df_end(DT.getRootNode());
|
||||||
PDI != E; ++PDI) {
|
PDI != E; ++PDI) {
|
||||||
BasicBlock* BB = PDI->getBlock();
|
BasicBlock* BB = PDI->getBlock();
|
||||||
|
@ -107,7 +107,7 @@ namespace {
|
|||||||
/// visit uses before definitions, allowing us to sink a loop body in one
|
/// visit uses before definitions, allowing us to sink a loop body in one
|
||||||
/// pass without iteration.
|
/// pass without iteration.
|
||||||
///
|
///
|
||||||
void SinkRegion(DominatorTree::DomTreeNode *N);
|
void SinkRegion(DomTreeNode *N);
|
||||||
|
|
||||||
/// HoistRegion - Walk the specified region of the CFG (defined by all
|
/// HoistRegion - Walk the specified region of the CFG (defined by all
|
||||||
/// blocks dominated by the specified block, and that are in the current
|
/// blocks dominated by the specified block, and that are in the current
|
||||||
@ -115,7 +115,7 @@ namespace {
|
|||||||
/// visit definitions before uses, allowing us to hoist a loop body in one
|
/// visit definitions before uses, allowing us to hoist a loop body in one
|
||||||
/// pass without iteration.
|
/// pass without iteration.
|
||||||
///
|
///
|
||||||
void HoistRegion(DominatorTree::DomTreeNode *N);
|
void HoistRegion(DomTreeNode *N);
|
||||||
|
|
||||||
/// inSubLoop - Little predicate that returns true if the specified basic
|
/// inSubLoop - Little predicate that returns true if the specified basic
|
||||||
/// block is in a subloop of the current one, not the current one itself.
|
/// block is in a subloop of the current one, not the current one itself.
|
||||||
@ -140,8 +140,8 @@ namespace {
|
|||||||
if (BlockInLoop == LoopHeader)
|
if (BlockInLoop == LoopHeader)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
DominatorTree::DomTreeNode *BlockInLoopNode = DT->getNode(BlockInLoop);
|
DomTreeNode *BlockInLoopNode = DT->getNode(BlockInLoop);
|
||||||
DominatorTree::DomTreeNode *IDom = DT->getNode(ExitBlock);
|
DomTreeNode *IDom = DT->getNode(ExitBlock);
|
||||||
|
|
||||||
// Because the exit block is not in the loop, we know we have to get _at
|
// Because the exit block is not in the loop, we know we have to get _at
|
||||||
// least_ its immediate dominator.
|
// least_ its immediate dominator.
|
||||||
@ -281,7 +281,7 @@ bool LICM::runOnLoop(Loop *L, LPPassManager &LPM) {
|
|||||||
/// uses before definitions, allowing us to sink a loop body in one pass without
|
/// uses before definitions, allowing us to sink a loop body in one pass without
|
||||||
/// iteration.
|
/// iteration.
|
||||||
///
|
///
|
||||||
void LICM::SinkRegion(DominatorTree::DomTreeNode *N) {
|
void LICM::SinkRegion(DomTreeNode *N) {
|
||||||
assert(N != 0 && "Null dominator tree node?");
|
assert(N != 0 && "Null dominator tree node?");
|
||||||
BasicBlock *BB = N->getBlock();
|
BasicBlock *BB = N->getBlock();
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ void LICM::SinkRegion(DominatorTree::DomTreeNode *N) {
|
|||||||
if (!CurLoop->contains(BB)) return;
|
if (!CurLoop->contains(BB)) return;
|
||||||
|
|
||||||
// We are processing blocks in reverse dfo, so process children first...
|
// We are processing blocks in reverse dfo, so process children first...
|
||||||
const std::vector<DominatorTree::DomTreeNode*> &Children = N->getChildren();
|
const std::vector<DomTreeNode*> &Children = N->getChildren();
|
||||||
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
||||||
SinkRegion(Children[i]);
|
SinkRegion(Children[i]);
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ void LICM::SinkRegion(DominatorTree::DomTreeNode *N) {
|
|||||||
/// first order w.r.t the DominatorTree. This allows us to visit definitions
|
/// first order w.r.t the DominatorTree. This allows us to visit definitions
|
||||||
/// before uses, allowing us to hoist a loop body in one pass without iteration.
|
/// before uses, allowing us to hoist a loop body in one pass without iteration.
|
||||||
///
|
///
|
||||||
void LICM::HoistRegion(DominatorTree::DomTreeNode *N) {
|
void LICM::HoistRegion(DomTreeNode *N) {
|
||||||
assert(N != 0 && "Null dominator tree node?");
|
assert(N != 0 && "Null dominator tree node?");
|
||||||
BasicBlock *BB = N->getBlock();
|
BasicBlock *BB = N->getBlock();
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ void LICM::HoistRegion(DominatorTree::DomTreeNode *N) {
|
|||||||
hoist(I);
|
hoist(I);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<DominatorTree::DomTreeNode*> &Children = N->getChildren();
|
const std::vector<DomTreeNode*> &Children = N->getChildren();
|
||||||
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
for (unsigned i = 0, e = Children.size(); i != e; ++i)
|
||||||
HoistRegion(Children[i]);
|
HoistRegion(Children[i]);
|
||||||
}
|
}
|
||||||
|
@ -1986,7 +1986,7 @@ namespace {
|
|||||||
UnreachableBlocks UB;
|
UnreachableBlocks UB;
|
||||||
ValueRanges *VR;
|
ValueRanges *VR;
|
||||||
|
|
||||||
std::vector<DominatorTree::DomTreeNode *> WorkList;
|
std::vector<DomTreeNode *> WorkList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
@ -2012,14 +2012,14 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN Forwards : public InstVisitor<Forwards> {
|
class VISIBILITY_HIDDEN Forwards : public InstVisitor<Forwards> {
|
||||||
friend class InstVisitor<Forwards>;
|
friend class InstVisitor<Forwards>;
|
||||||
PredicateSimplifier *PS;
|
PredicateSimplifier *PS;
|
||||||
DominatorTree::DomTreeNode *DTNode;
|
DomTreeNode *DTNode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InequalityGraph &IG;
|
InequalityGraph &IG;
|
||||||
UnreachableBlocks &UB;
|
UnreachableBlocks &UB;
|
||||||
ValueRanges &VR;
|
ValueRanges &VR;
|
||||||
|
|
||||||
Forwards(PredicateSimplifier *PS, DominatorTree::DomTreeNode *DTNode)
|
Forwards(PredicateSimplifier *PS, DomTreeNode *DTNode)
|
||||||
: PS(PS), DTNode(DTNode), IG(*PS->IG), UB(PS->UB), VR(*PS->VR) {}
|
: PS(PS), DTNode(DTNode), IG(*PS->IG), UB(PS->UB), VR(*PS->VR) {}
|
||||||
|
|
||||||
void visitTerminatorInst(TerminatorInst &TI);
|
void visitTerminatorInst(TerminatorInst &TI);
|
||||||
@ -2040,19 +2040,19 @@ namespace {
|
|||||||
// Used by terminator instructions to proceed from the current basic
|
// Used by terminator instructions to proceed from the current basic
|
||||||
// block to the next. Verifies that "current" dominates "next",
|
// block to the next. Verifies that "current" dominates "next",
|
||||||
// then calls visitBasicBlock.
|
// then calls visitBasicBlock.
|
||||||
void proceedToSuccessors(DominatorTree::DomTreeNode *Current) {
|
void proceedToSuccessors(DomTreeNode *Current) {
|
||||||
for (DominatorTree::DomTreeNode::iterator I = Current->begin(),
|
for (DomTreeNode::iterator I = Current->begin(),
|
||||||
E = Current->end(); I != E; ++I) {
|
E = Current->end(); I != E; ++I) {
|
||||||
WorkList.push_back(*I);
|
WorkList.push_back(*I);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void proceedToSuccessor(DominatorTree::DomTreeNode *Next) {
|
void proceedToSuccessor(DomTreeNode *Next) {
|
||||||
WorkList.push_back(Next);
|
WorkList.push_back(Next);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visits each instruction in the basic block.
|
// Visits each instruction in the basic block.
|
||||||
void visitBasicBlock(DominatorTree::DomTreeNode *Node) {
|
void visitBasicBlock(DomTreeNode *Node) {
|
||||||
BasicBlock *BB = Node->getBlock();
|
BasicBlock *BB = Node->getBlock();
|
||||||
ETNode *ET = Forest->getNodeForBlock(BB);
|
ETNode *ET = Forest->getNodeForBlock(BB);
|
||||||
DOUT << "Entering Basic Block: " << BB->getName()
|
DOUT << "Entering Basic Block: " << BB->getName()
|
||||||
@ -2064,7 +2064,7 @@ namespace {
|
|||||||
|
|
||||||
// Tries to simplify each Instruction and add new properties to
|
// Tries to simplify each Instruction and add new properties to
|
||||||
// the PropertySet.
|
// the PropertySet.
|
||||||
void visitInstruction(Instruction *I, DominatorTree::DomTreeNode *DT, ETNode *ET) {
|
void visitInstruction(Instruction *I, DomTreeNode *DT, ETNode *ET) {
|
||||||
DOUT << "Considering instruction " << *I << "\n";
|
DOUT << "Considering instruction " << *I << "\n";
|
||||||
DEBUG(IG->dump());
|
DEBUG(IG->dump());
|
||||||
|
|
||||||
@ -2132,7 +2132,7 @@ namespace {
|
|||||||
WorkList.push_back(DT->getRootNode());
|
WorkList.push_back(DT->getRootNode());
|
||||||
|
|
||||||
do {
|
do {
|
||||||
DominatorTree::DomTreeNode *DTNode = WorkList.back();
|
DomTreeNode *DTNode = WorkList.back();
|
||||||
WorkList.pop_back();
|
WorkList.pop_back();
|
||||||
if (!UB.isDead(DTNode->getBlock())) visitBasicBlock(DTNode);
|
if (!UB.isDead(DTNode->getBlock())) visitBasicBlock(DTNode);
|
||||||
} while (!WorkList.empty());
|
} while (!WorkList.empty());
|
||||||
@ -2164,7 +2164,7 @@ namespace {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end();
|
for (DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
BasicBlock *Dest = (*I)->getBlock();
|
BasicBlock *Dest = (*I)->getBlock();
|
||||||
DOUT << "Branch thinking about %" << Dest->getName()
|
DOUT << "Branch thinking about %" << Dest->getName()
|
||||||
@ -2194,7 +2194,7 @@ namespace {
|
|||||||
// Set the EQProperty in each of the cases BBs, and the NEProperties
|
// Set the EQProperty in each of the cases BBs, and the NEProperties
|
||||||
// in the default BB.
|
// in the default BB.
|
||||||
|
|
||||||
for (DominatorTree::DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end();
|
for (DomTreeNode::iterator I = DTNode->begin(), E = DTNode->end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
BasicBlock *BB = (*I)->getBlock();
|
BasicBlock *BB = (*I)->getBlock();
|
||||||
DOUT << "Switch thinking about BB %" << BB->getName()
|
DOUT << "Switch thinking about BB %" << BB->getName()
|
||||||
|
@ -203,20 +203,20 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P,
|
|||||||
|
|
||||||
// Should we update DominatorTree information?
|
// Should we update DominatorTree information?
|
||||||
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
|
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>()) {
|
||||||
DominatorTree::DomTreeNode *TINode = DT->getNode(TIBB);
|
DomTreeNode *TINode = DT->getNode(TIBB);
|
||||||
|
|
||||||
// The new block is not the immediate dominator for any other nodes, but
|
// The new block is not the immediate dominator for any other nodes, but
|
||||||
// TINode is the immediate dominator for the new node.
|
// TINode is the immediate dominator for the new node.
|
||||||
//
|
//
|
||||||
if (TINode) { // Don't break unreachable code!
|
if (TINode) { // Don't break unreachable code!
|
||||||
DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, TINode);
|
DomTreeNode *NewBBNode = DT->createNewNode(NewBB, TINode);
|
||||||
DominatorTree::DomTreeNode *DestBBNode = 0;
|
DomTreeNode *DestBBNode = 0;
|
||||||
|
|
||||||
// If NewBBDominatesDestBB hasn't been computed yet, do so with DT.
|
// If NewBBDominatesDestBB hasn't been computed yet, do so with DT.
|
||||||
if (!OtherPreds.empty()) {
|
if (!OtherPreds.empty()) {
|
||||||
DestBBNode = DT->getNode(DestBB);
|
DestBBNode = DT->getNode(DestBB);
|
||||||
while (!OtherPreds.empty() && NewBBDominatesDestBB) {
|
while (!OtherPreds.empty() && NewBBDominatesDestBB) {
|
||||||
if (DominatorTree::DomTreeNode *OPNode = DT->getNode(OtherPreds.back()))
|
if (DomTreeNode *OPNode = DT->getNode(OtherPreds.back()))
|
||||||
NewBBDominatesDestBB = DestBBNode->dominates(OPNode);
|
NewBBDominatesDestBB = DestBBNode->dominates(OPNode);
|
||||||
OtherPreds.pop_back();
|
OtherPreds.pop_back();
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,8 @@ namespace {
|
|||||||
void getLoopValuesUsedOutsideLoop(Loop *L,
|
void getLoopValuesUsedOutsideLoop(Loop *L,
|
||||||
SetVector<Instruction*> &AffectedValues);
|
SetVector<Instruction*> &AffectedValues);
|
||||||
|
|
||||||
Value *GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst,
|
Value *GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst,
|
||||||
std::map<DominatorTree::DomTreeNode*, Value*> &Phis);
|
std::map<DomTreeNode*, Value*> &Phis);
|
||||||
|
|
||||||
/// inLoop - returns true if the given block is within the current loop
|
/// inLoop - returns true if the given block is within the current loop
|
||||||
const bool inLoop(BasicBlock* B) {
|
const bool inLoop(BasicBlock* B) {
|
||||||
@ -146,16 +146,16 @@ void LCSSA::ProcessInstruction(Instruction *Instr,
|
|||||||
++NumLCSSA; // We are applying the transformation
|
++NumLCSSA; // We are applying the transformation
|
||||||
|
|
||||||
// Keep track of the blocks that have the value available already.
|
// Keep track of the blocks that have the value available already.
|
||||||
std::map<DominatorTree::DomTreeNode*, Value*> Phis;
|
std::map<DomTreeNode*, Value*> Phis;
|
||||||
|
|
||||||
DominatorTree::DomTreeNode *InstrNode = DT->getNode(Instr->getParent());
|
DomTreeNode *InstrNode = DT->getNode(Instr->getParent());
|
||||||
|
|
||||||
// Insert the LCSSA phi's into the exit blocks (dominated by the value), and
|
// Insert the LCSSA phi's into the exit blocks (dominated by the value), and
|
||||||
// add them to the Phi's map.
|
// add them to the Phi's map.
|
||||||
for (std::vector<BasicBlock*>::const_iterator BBI = exitBlocks.begin(),
|
for (std::vector<BasicBlock*>::const_iterator BBI = exitBlocks.begin(),
|
||||||
BBE = exitBlocks.end(); BBI != BBE; ++BBI) {
|
BBE = exitBlocks.end(); BBI != BBE; ++BBI) {
|
||||||
BasicBlock *BB = *BBI;
|
BasicBlock *BB = *BBI;
|
||||||
DominatorTree::DomTreeNode *ExitBBNode = DT->getNode(BB);
|
DomTreeNode *ExitBBNode = DT->getNode(BB);
|
||||||
Value *&Phi = Phis[ExitBBNode];
|
Value *&Phi = Phis[ExitBBNode];
|
||||||
if (!Phi && InstrNode->dominates(ExitBBNode)) {
|
if (!Phi && InstrNode->dominates(ExitBBNode)) {
|
||||||
PHINode *PN = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
|
PHINode *PN = new PHINode(Instr->getType(), Instr->getName()+".lcssa",
|
||||||
@ -229,8 +229,8 @@ void LCSSA::getLoopValuesUsedOutsideLoop(Loop *L,
|
|||||||
|
|
||||||
/// GetValueForBlock - Get the value to use within the specified basic block.
|
/// GetValueForBlock - Get the value to use within the specified basic block.
|
||||||
/// available values are in Phis.
|
/// available values are in Phis.
|
||||||
Value *LCSSA::GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *OrigInst,
|
Value *LCSSA::GetValueForBlock(DomTreeNode *BB, Instruction *OrigInst,
|
||||||
std::map<DominatorTree::DomTreeNode*, Value*> &Phis) {
|
std::map<DomTreeNode*, Value*> &Phis) {
|
||||||
// If there is no dominator info for this BB, it is unreachable.
|
// If there is no dominator info for this BB, it is unreachable.
|
||||||
if (BB == 0)
|
if (BB == 0)
|
||||||
return UndefValue::get(OrigInst->getType());
|
return UndefValue::get(OrigInst->getType());
|
||||||
@ -239,7 +239,7 @@ Value *LCSSA::GetValueForBlock(DominatorTree::DomTreeNode *BB, Instruction *Orig
|
|||||||
Value *&V = Phis[BB];
|
Value *&V = Phis[BB];
|
||||||
if (V) return V;
|
if (V) return V;
|
||||||
|
|
||||||
DominatorTree::DomTreeNode *IDom = BB->getIDom();
|
DomTreeNode *IDom = BB->getIDom();
|
||||||
|
|
||||||
// Otherwise, there are two cases: we either have to insert a PHI node or we
|
// Otherwise, there are two cases: we either have to insert a PHI node or we
|
||||||
// don't. We need to insert a PHI node if this block is not dominated by one
|
// don't. We need to insert a PHI node if this block is not dominated by one
|
||||||
|
@ -778,15 +778,15 @@ void LoopSimplify::UpdateDomInfoForRevectoredPreds(BasicBlock *NewBB,
|
|||||||
}
|
}
|
||||||
assert(NewBBIDom && "No immediate dominator found??");
|
assert(NewBBIDom && "No immediate dominator found??");
|
||||||
}
|
}
|
||||||
DominatorTree::DomTreeNode *NewBBIDomNode = DT->getNode(NewBBIDom);
|
DomTreeNode *NewBBIDomNode = DT->getNode(NewBBIDom);
|
||||||
|
|
||||||
// Create the new dominator tree node... and set the idom of NewBB.
|
// Create the new dominator tree node... and set the idom of NewBB.
|
||||||
DominatorTree::DomTreeNode *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode);
|
DomTreeNode *NewBBNode = DT->createNewNode(NewBB, NewBBIDomNode);
|
||||||
|
|
||||||
// If NewBB strictly dominates other blocks, then it is now the immediate
|
// If NewBB strictly dominates other blocks, then it is now the immediate
|
||||||
// dominator of NewBBSucc. Update the dominator tree as appropriate.
|
// dominator of NewBBSucc. Update the dominator tree as appropriate.
|
||||||
if (NewBBDominatesNewBBSucc) {
|
if (NewBBDominatesNewBBSucc) {
|
||||||
DominatorTree::DomTreeNode *NewBBSuccNode = DT->getNode(NewBBSucc);
|
DomTreeNode *NewBBSuccNode = DT->getNode(NewBBSucc);
|
||||||
DT->changeImmediateDominator(NewBBSuccNode, NewBBNode);
|
DT->changeImmediateDominator(NewBBSuccNode, NewBBNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ void DominatorTreeBase::reset() {
|
|||||||
RootNode = 0;
|
RootNode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DominatorTreeBase::DomTreeNode::setIDom(DomTreeNode *NewIDom) {
|
void DomTreeNode::setIDom(DomTreeNode *NewIDom) {
|
||||||
assert(IDom && "No immediate dominator?");
|
assert(IDom && "No immediate dominator?");
|
||||||
if (IDom != NewIDom) {
|
if (IDom != NewIDom) {
|
||||||
std::vector<DomTreeNode*>::iterator I =
|
std::vector<DomTreeNode*>::iterator I =
|
||||||
@ -327,7 +327,7 @@ void DominatorTreeBase::DomTreeNode::setIDom(DomTreeNode *NewIDom) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DominatorTreeBase::DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) {
|
DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) {
|
||||||
DomTreeNode *&BBNode = DomTreeNodes[BB];
|
DomTreeNode *&BBNode = DomTreeNodes[BB];
|
||||||
if (BBNode) return BBNode;
|
if (BBNode) return BBNode;
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ DominatorTreeBase::DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::ostream &operator<<(std::ostream &o,
|
static std::ostream &operator<<(std::ostream &o,
|
||||||
const DominatorTreeBase::DomTreeNode *Node) {
|
const DomTreeNode *Node) {
|
||||||
if (Node->getBlock())
|
if (Node->getBlock())
|
||||||
WriteAsOperand(o, Node->getBlock(), false);
|
WriteAsOperand(o, Node->getBlock(), false);
|
||||||
else
|
else
|
||||||
@ -350,10 +350,10 @@ static std::ostream &operator<<(std::ostream &o,
|
|||||||
return o << "\n";
|
return o << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintDomTree(const DominatorTreeBase::DomTreeNode *N, std::ostream &o,
|
static void PrintDomTree(const DomTreeNode *N, std::ostream &o,
|
||||||
unsigned Lev) {
|
unsigned Lev) {
|
||||||
o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N;
|
o << std::string(2*Lev, ' ') << "[" << Lev << "] " << N;
|
||||||
for (DominatorTreeBase::DomTreeNode::const_iterator I = N->begin(), E = N->end();
|
for (DomTreeNode::const_iterator I = N->begin(), E = N->end();
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
PrintDomTree(*I, o, Lev+1);
|
PrintDomTree(*I, o, Lev+1);
|
||||||
}
|
}
|
||||||
@ -387,19 +387,19 @@ namespace {
|
|||||||
class DFCalculateWorkObject {
|
class DFCalculateWorkObject {
|
||||||
public:
|
public:
|
||||||
DFCalculateWorkObject(BasicBlock *B, BasicBlock *P,
|
DFCalculateWorkObject(BasicBlock *B, BasicBlock *P,
|
||||||
const DominatorTree::DomTreeNode *N,
|
const DomTreeNode *N,
|
||||||
const DominatorTree::DomTreeNode *PN)
|
const DomTreeNode *PN)
|
||||||
: currentBB(B), parentBB(P), DomTreeNode(N), parentNode(PN) {}
|
: currentBB(B), parentBB(P), Node(N), parentNode(PN) {}
|
||||||
BasicBlock *currentBB;
|
BasicBlock *currentBB;
|
||||||
BasicBlock *parentBB;
|
BasicBlock *parentBB;
|
||||||
const DominatorTree::DomTreeNode *DomTreeNode;
|
const DomTreeNode *Node;
|
||||||
const DominatorTree::DomTreeNode *parentNode;
|
const DomTreeNode *parentNode;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const DominanceFrontier::DomSetType &
|
const DominanceFrontier::DomSetType &
|
||||||
DominanceFrontier::calculate(const DominatorTree &DT,
|
DominanceFrontier::calculate(const DominatorTree &DT,
|
||||||
const DominatorTree::DomTreeNode *Node) {
|
const DomTreeNode *Node) {
|
||||||
BasicBlock *BB = Node->getBlock();
|
BasicBlock *BB = Node->getBlock();
|
||||||
DomSetType *Result = NULL;
|
DomSetType *Result = NULL;
|
||||||
|
|
||||||
@ -413,8 +413,8 @@ DominanceFrontier::calculate(const DominatorTree &DT,
|
|||||||
|
|
||||||
BasicBlock *currentBB = currentW->currentBB;
|
BasicBlock *currentBB = currentW->currentBB;
|
||||||
BasicBlock *parentBB = currentW->parentBB;
|
BasicBlock *parentBB = currentW->parentBB;
|
||||||
const DominatorTree::DomTreeNode *currentNode = currentW->DomTreeNode;
|
const DomTreeNode *currentNode = currentW->Node;
|
||||||
const DominatorTree::DomTreeNode *parentNode = currentW->parentNode;
|
const DomTreeNode *parentNode = currentW->parentNode;
|
||||||
assert (currentBB && "Invalid work object. Missing current Basic Block");
|
assert (currentBB && "Invalid work object. Missing current Basic Block");
|
||||||
assert (currentNode && "Invalid work object. Missing current Node");
|
assert (currentNode && "Invalid work object. Missing current Node");
|
||||||
DomSetType &S = Frontiers[currentBB];
|
DomSetType &S = Frontiers[currentBB];
|
||||||
@ -436,9 +436,9 @@ DominanceFrontier::calculate(const DominatorTree &DT,
|
|||||||
// Loop through and visit the nodes that Node immediately dominates (Node's
|
// Loop through and visit the nodes that Node immediately dominates (Node's
|
||||||
// children in the IDomTree)
|
// children in the IDomTree)
|
||||||
bool visitChild = false;
|
bool visitChild = false;
|
||||||
for (DominatorTree::DomTreeNode::const_iterator NI = currentNode->begin(),
|
for (DomTreeNode::const_iterator NI = currentNode->begin(),
|
||||||
NE = currentNode->end(); NI != NE; ++NI) {
|
NE = currentNode->end(); NI != NE; ++NI) {
|
||||||
DominatorTree::DomTreeNode *IDominee = *NI;
|
DomTreeNode *IDominee = *NI;
|
||||||
BasicBlock *childBB = IDominee->getBlock();
|
BasicBlock *childBB = IDominee->getBlock();
|
||||||
if (visited.count(childBB) == 0) {
|
if (visited.count(childBB) == 0) {
|
||||||
workList.push_back(DFCalculateWorkObject(childBB, currentBB,
|
workList.push_back(DFCalculateWorkObject(childBB, currentBB,
|
||||||
@ -927,7 +927,7 @@ ETNode *ETForest::getNodeForBlock(BasicBlock *BB) {
|
|||||||
|
|
||||||
// Haven't calculated this node yet? Get or calculate the node for the
|
// Haven't calculated this node yet? Get or calculate the node for the
|
||||||
// immediate dominator.
|
// immediate dominator.
|
||||||
DominatorTree::DomTreeNode *node= getAnalysis<DominatorTree>().getNode(BB);
|
DomTreeNode *node= getAnalysis<DominatorTree>().getNode(BB);
|
||||||
|
|
||||||
// If we are unreachable, we may not have an immediate dominator.
|
// If we are unreachable, we may not have an immediate dominator.
|
||||||
if (!node || !node->getIDom())
|
if (!node || !node->getIDom())
|
||||||
@ -951,7 +951,7 @@ void ETForest::calculate(const DominatorTree &DT) {
|
|||||||
Function *F = Root->getParent();
|
Function *F = Root->getParent();
|
||||||
// Loop over all of the reachable blocks in the function...
|
// Loop over all of the reachable blocks in the function...
|
||||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
|
||||||
DominatorTree::DomTreeNode* node = DT.getNode(I);
|
DomTreeNode* node = DT.getNode(I);
|
||||||
if (node && node->getIDom()) { // Reachable block.
|
if (node && node->getIDom()) { // Reachable block.
|
||||||
BasicBlock* ImmDom = node->getIDom()->getBlock();
|
BasicBlock* ImmDom = node->getIDom()->getBlock();
|
||||||
ETNode *&BBNode = Nodes[I];
|
ETNode *&BBNode = Nodes[I];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user