[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 18 18:01:45 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAG.cpp updated: 1.3 -> 1.4
---
Log message:

Fix computation of # operands, add a temporary hack for CopyToReg


---
Diffs of the changes:  (+17 -6)

 ScheduleDAG.cpp |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.3 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.4
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.3	Thu Aug 18 15:11:49 2005
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp	Thu Aug 18 20:01:34 2005
@@ -73,11 +73,16 @@
     // Target nodes have any register or immediate operands before any chain
     // nodes.  Check that the DAG matches the TD files's expectation of #
     // operands.
-    assert((unsigned(II.numOperands) == Op.getNumOperands() ||
-            // It could be some number of operands followed by a token chain.
-           (unsigned(II.numOperands)+1 == Op.getNumOperands() &&
-            Op.getOperand(II.numOperands).getValueType() == MVT::Other)) &&
+#ifndef _NDEBUG
+    unsigned Operands = Op.getNumOperands();
+    if (Operands && Op.getOperand(Operands-1).getValueType() == MVT::Other)
+      --Operands;
+    unsigned Results = Op.Val->getNumValues();
+    if (Results && Op.getOperand(Results-1).getValueType() == MVT::Other)
+      --Results;
+    assert(unsigned(II.numOperands) == Operands+Results &&
            "#operands for dag node doesn't match .td file!"); 
+#endif
 
     // Create the new machine instruction.
     MachineInstr *MI = new MachineInstr(Opc, II.numOperands, true, true);
@@ -107,9 +112,15 @@
     BB->insert(BB->end(), MI);
   } else {
     switch (Op.getOpcode()) {
-    default: assert(0 &&
-                    "This target-independent node should have been selected!");
+    default:
+      Op.Val->dump(); 
+      assert(0 && "This target-independent node should have been selected!");
     case ISD::EntryToken: break;
+    case ISD::CopyToReg: {
+      unsigned Val = Emit(Op.getOperand(2));
+      // FIXME: DO THE COPY NOW.
+      break;
+    }
     }
   }
   






More information about the llvm-commits mailing list