From 1207209677921a27bb6bb176022d7adc00699ccf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 19 Aug 2005 01:01:34 +0000 Subject: [PATCH] Fix computation of # operands, add a temporary hack for CopyToReg llvm-svn: 22896 --- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index bf77d4c7f73..d44717aaa52 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -73,11 +73,16 @@ unsigned SimpleSched::Emit(SDOperand Op) { // 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 @@ unsigned SimpleSched::Emit(SDOperand Op) { 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; + } } }