Use newly-added type inspection support in InstTreeNode subclasses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3501 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve 2002-08-24 21:02:09 +00:00
parent 685133382d
commit 74c83e44fa
2 changed files with 8 additions and 10 deletions

View File

@ -201,7 +201,6 @@ inline void
InstrForest::noteTreeNodeForInstr(Instruction *instr, InstrForest::noteTreeNodeForInstr(Instruction *instr,
InstructionNode *treeNode) InstructionNode *treeNode)
{ {
assert(treeNode->getNodeType() == InstrTreeNode::NTInstructionNode);
(*this)[instr] = treeNode; (*this)[instr] = treeNode;
treeRoots.push_back(treeNode); // mark node as root of a new tree treeRoots.push_back(treeNode); // mark node as root of a new tree
} }
@ -212,8 +211,8 @@ InstrForest::setLeftChild(InstrTreeNode *parent, InstrTreeNode *child)
{ {
parent->LeftChild = child; parent->LeftChild = child;
child->Parent = parent; child->Parent = parent;
if (child->getNodeType() == InstrTreeNode::NTInstructionNode) if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
eraseRoot((InstructionNode*) child); // no longer a tree root eraseRoot(instrNode); // no longer a tree root
} }
inline void inline void
@ -221,8 +220,8 @@ InstrForest::setRightChild(InstrTreeNode *parent, InstrTreeNode *child)
{ {
parent->RightChild = child; parent->RightChild = child;
child->Parent = parent; child->Parent = parent;
if (child->getNodeType() == InstrTreeNode::NTInstructionNode) if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
eraseRoot((InstructionNode*) child); // no longer a tree root eraseRoot(instrNode); // no longer a tree root
} }

View File

@ -201,7 +201,6 @@ inline void
InstrForest::noteTreeNodeForInstr(Instruction *instr, InstrForest::noteTreeNodeForInstr(Instruction *instr,
InstructionNode *treeNode) InstructionNode *treeNode)
{ {
assert(treeNode->getNodeType() == InstrTreeNode::NTInstructionNode);
(*this)[instr] = treeNode; (*this)[instr] = treeNode;
treeRoots.push_back(treeNode); // mark node as root of a new tree treeRoots.push_back(treeNode); // mark node as root of a new tree
} }
@ -212,8 +211,8 @@ InstrForest::setLeftChild(InstrTreeNode *parent, InstrTreeNode *child)
{ {
parent->LeftChild = child; parent->LeftChild = child;
child->Parent = parent; child->Parent = parent;
if (child->getNodeType() == InstrTreeNode::NTInstructionNode) if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
eraseRoot((InstructionNode*) child); // no longer a tree root eraseRoot(instrNode); // no longer a tree root
} }
inline void inline void
@ -221,8 +220,8 @@ InstrForest::setRightChild(InstrTreeNode *parent, InstrTreeNode *child)
{ {
parent->RightChild = child; parent->RightChild = child;
child->Parent = parent; child->Parent = parent;
if (child->getNodeType() == InstrTreeNode::NTInstructionNode) if (InstructionNode* instrNode = dyn_cast<InstructionNode>(child))
eraseRoot((InstructionNode*) child); // no longer a tree root eraseRoot(instrNode); // no longer a tree root
} }