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

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 24 15:02:53 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAG.cpp updated: 1.12 -> 1.13
---
Log message:

Add support for external symbols, and support for variable arity instructions


---
Diffs of the changes:  (+12 -5)

 ScheduleDAG.cpp |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.12 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.13
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.12	Sun Aug 21 20:04:32 2005
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp	Wed Aug 24 17:02:41 2005
@@ -82,16 +82,20 @@
     unsigned NumResults = Op.Val->getNumValues();
     if (NumResults && Op.Val->getValueType(NumResults-1) == MVT::Other)
       --NumResults;
+
+    unsigned NodeOperands = Op.getNumOperands();
+    if (NodeOperands &&    // Ignore chain if it exists.
+        Op.getOperand(NodeOperands-1).getValueType() == MVT::Other)
+      --NodeOperands;
+   
+    unsigned NumMIOperands = NodeOperands+NumResults;
 #ifndef _NDEBUG
-    unsigned Operands = Op.getNumOperands();
-    if (Operands && Op.getOperand(Operands-1).getValueType() == MVT::Other)
-      --Operands;
-    assert(unsigned(II.numOperands) == Operands+NumResults &&
+    assert((unsigned(II.numOperands) == NumMIOperands || II.numOperands == -1)&&
            "#operands for dag node doesn't match .td file!"); 
 #endif
 
     // Create the new machine instruction.
-    MachineInstr *MI = new MachineInstr(Opc, II.numOperands, true, true);
+    MachineInstr *MI = new MachineInstr(Opc, NumMIOperands, true, true);
     
     // Add result register values for things that are defined by this
     // instruction.
@@ -136,6 +140,9 @@
       } else if (ConstantPoolSDNode *CP = 
                     dyn_cast<ConstantPoolSDNode>(Op.getOperand(i))) {
         MI->addConstantPoolIndexOperand(CP->getIndex());
+      } else if (ExternalSymbolSDNode *ES = 
+                 dyn_cast<ExternalSymbolSDNode>(Op.getOperand(i))) {
+        MI->addExternalSymbolOperand(ES->getSymbol(), false);
       } else {
         unsigned R = Emit(Op.getOperand(i));
         // Add an operand, unless this corresponds to a chain node.






More information about the llvm-commits mailing list