Changes in directory llvm/lib/Target/IA64:
IA64ISelDAGToDAG.cpp updated: 1.11 -> 1.12 --- Log message: add support for dynamic_stackalloc to the dag isel (thanks andrew ;) next up: support argument passing in memory, not just registers --- Diffs of the changes: (+31 -3) IA64ISelDAGToDAG.cpp | 34 +++++++++++++++++++++++++++++++--- 1 files changed, 31 insertions(+), 3 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp diff -u llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.11 llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.12 --- llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp:1.11 Mon Nov 21 08:14:54 2005 +++ llvm/lib/Target/IA64/IA64ISelDAGToDAG.cpp Fri Nov 25 01:49:25 2005 @@ -536,9 +536,37 @@ case ISD::SREM: case ISD::UREM: return SelectDIV(Op); -/* todo: - * case ISD::DYNAMIC_STACKALLOC: -*/ + case ISD::DYNAMIC_STACKALLOC: { + if (!isa<ConstantSDNode>(N->getOperand(2)) || + cast<ConstantSDNode>(N->getOperand(2))->getValue() != 0) { + std::cerr << "Cannot allocate stack object with greater alignment than" + << " the stack alignment yet!"; + abort(); + } + + SDOperand Chain = Select(N->getOperand(0)); + SDOperand Amt = Select(N->getOperand(1)); + SDOperand Reg = CurDAG->getRegister(IA64::r12, MVT::i64); + SDOperand Val = CurDAG->getCopyFromReg(Chain, IA64::r12, MVT::i64); + Chain = Val.getValue(1); + + // Subtract the amount (guaranteed to be a multiple of the stack alignment) + // from the stack pointer, giving us the result pointer. + SDOperand Result = Select(CurDAG->getNode(ISD::SUB, MVT::i64, Val, Amt)); + + // Copy this result back into r12. + Chain = CurDAG->getNode(ISD::CopyToReg, MVT::Other, Chain, Reg, Result); + + // Copy this result back out of r12 to make sure we're not using the stack + // space without decrementing the stack pointer. + Result = CurDAG->getCopyFromReg(Chain, IA64::r12, MVT::i64); + + // Finally, replace the DYNAMIC_STACKALLOC with the copyfromreg. + CodeGenMap[Op.getValue(0)] = Result; + CodeGenMap[Op.getValue(1)] = Result.getValue(1); + return SDOperand(Result.Val, Op.ResNo); + } + case ISD::ConstantFP: { SDOperand Chain = CurDAG->getEntryNode(); // this is a constant, so.. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits