aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/InstrSelection/InstrForest.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-12 16:34:03 +0000
committerChris Lattner <sabre@nondot.org>2001-09-12 16:34:03 +0000
commit5f6baf78ea26168d328444f15bc1da355afd88a8 (patch)
treeb06192fbb6951125def21f0da83b290c7ff9b358 /lib/CodeGen/InstrSelection/InstrForest.cpp
parent4ddb4c82d7451f7ab0269a4d0ca948f96e80402e (diff)
More cleanups, preparing to revamp InstrForest to, among other things,
not leak all its allocated memory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@553 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/InstrSelection/InstrForest.cpp')
-rw-r--r--lib/CodeGen/InstrSelection/InstrForest.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp
index 50c4f98721..0ecf1c2fe9 100644
--- a/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -176,11 +176,6 @@ inline void InstrForest::setRightChild(InstrTreeNode *Par, InstrTreeNode *Chld){
}
-void InstrForest::buildTreesForMethod(Method *M) {
- for_each(M->inst_begin(), M->inst_end(),
- bind_obj(this, &InstrForest::buildTreeForInstruction));
-}
-
InstructionNode *InstrForest::buildTreeForInstruction(Instruction *Inst) {
InstructionNode *treeNode = getTreeNodeForInstr(Inst);
if (treeNode) {
@@ -210,8 +205,7 @@ InstructionNode *InstrForest::buildTreeForInstruction(Instruction *Inst) {
static InstrTreeNode *fixedChildArray[MAX_CHILD];
InstrTreeNode **childArray =
(Inst->getNumOperands() > MAX_CHILD)
- ? new (InstrTreeNode*)[Inst->getNumOperands()]
- : fixedChildArray;
+ ? new (InstrTreeNode*)[Inst->getNumOperands()] : fixedChildArray;
//
// Walk the operands of the instruction
@@ -309,3 +303,8 @@ InstructionNode *InstrForest::buildTreeForInstruction(Instruction *Inst) {
return treeNode;
}
+
+InstrForest::InstrForest(Method *M) {
+ for_each(M->inst_begin(), M->inst_end(),
+ bind_obj(this, &InstrForest::buildTreeForInstruction));
+}