More cleanups, preparing to revamp InstrForest to, among other things,
not leak all its allocated memory.
llvm-svn: 553
diff --git a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp
index 50c4f98..0ecf1c2 100644
--- a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp
+++ b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp
@@ -176,11 +176,6 @@
}
-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 @@
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 @@
return treeNode;
}
+
+InstrForest::InstrForest(Method *M) {
+ for_each(M->inst_begin(), M->inst_end(),
+ bind_obj(this, &InstrForest::buildTreeForInstruction));
+}