From 63ce5682e29f62d5c779e54a6362ba8ff038d350 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 28 Jul 2006 00:10:59 +0000 Subject: [PATCH] Another duh. Determine topological order before any target node is added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29371 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelDAGToDAG.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 798337c03c7..fe4d3bca72d 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -99,7 +99,8 @@ namespace { : SelectionDAGISel(X86Lowering), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()), - DAGSize(0), ReachibilityMatrix(NULL) {} + DAGSize(0), TopOrder(NULL), IdToOrder(NULL), + RMRange(NULL), ReachibilityMatrix(NULL) {} virtual bool runOnFunction(Function &Fn) { // Make sure we re-emit a set of the global base reg if necessary @@ -242,7 +243,6 @@ bool X86DAGToDAGISel::IsFoldableBy(SDNode *N, SDNode *U) { /// DetermineTopologicalOrdering - Determine topological ordering of the nodes /// in the DAG. void X86DAGToDAGISel::DetermineTopologicalOrdering() { - DAGSize = CurDAG->AssignNodeIds(); TopOrder = new SDNode*[DAGSize]; IdToOrder = new unsigned[DAGSize]; memset(IdToOrder, 0, DAGSize * sizeof(unsigned)); @@ -280,7 +280,6 @@ void X86DAGToDAGISel::DetermineTopologicalOrdering() { void X86DAGToDAGISel::DeterminReachibility(SDNode *f, SDNode *t) { if (!ReachibilityMatrix) { - DetermineTopologicalOrdering(); unsigned RMSize = (DAGSize * DAGSize + 7) / 8; ReachibilityMatrix = new unsigned char[RMSize]; memset(ReachibilityMatrix, 0, RMSize); @@ -323,25 +322,26 @@ void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { DEBUG(BB->dump()); MachineFunction::iterator FirstMBB = BB; + DAGSize = DAG.AssignNodeIds(); + DetermineTopologicalOrdering(); + // Codegen the basic block. #ifndef NDEBUG DEBUG(std::cerr << "===== Instruction selection begins:\n"); Indent = 0; #endif DAG.setRoot(SelectRoot(DAG.getRoot())); - assert(InFlightSet.empty() && "ISel InFlightSet has not been emptied!"); #ifndef NDEBUG DEBUG(std::cerr << "===== Instruction selection ends:\n"); #endif - if (ReachibilityMatrix) { - delete[] ReachibilityMatrix; - delete[] TopOrder; - delete[] IdToOrder; - delete[] RMRange; - ReachibilityMatrix = NULL; - TopOrder = NULL; - IdToOrder = RMRange = NULL; - } + + delete[] ReachibilityMatrix; + delete[] TopOrder; + delete[] IdToOrder; + delete[] RMRange; + ReachibilityMatrix = NULL; + TopOrder = NULL; + IdToOrder = RMRange = NULL; CodeGenMap.clear(); HandleMap.clear(); ReplaceMap.clear();