diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-08-24 22:02:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-08-24 22:02:41 +0000 |
| commit | ad9565dfbe8e619c2ab8dfa85ef76eab71174a32 (patch) | |
| tree | d0b2e084a752d21b6e9d9d95395f90cd170a95c2 /llvm/lib/CodeGen/SelectionDAG | |
| parent | bb8cc0acb28a77233177681b7b8ea1a3de7b3380 (diff) | |
| download | bcm5719-llvm-ad9565dfbe8e619c2ab8dfa85ef76eab71174a32.tar.gz bcm5719-llvm-ad9565dfbe8e619c2ab8dfa85ef76eab71174a32.zip | |
Add support for external symbols, and support for variable arity instructions
llvm-svn: 23022
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 7fa3c1c9e47..036023e0495 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -82,16 +82,20 @@ unsigned SimpleSched::Emit(SDOperand Op) { 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 @@ unsigned SimpleSched::Emit(SDOperand Op) { } 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. |

