From 26a76d1024e944669a80dd86bcd0b81d7394a4f5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 13 Oct 2006 16:47:22 +0000 Subject: [PATCH] implement calls to functions that return long git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30929 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMISelDAGToDAG.cpp | 25 ++++++++++++++++--------- test/CodeGen/ARM/long.ll | 7 +++++++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index 5dca92abf0a..0423cc8c6cc 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -283,7 +283,6 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) { assert(CallConv == CallingConv::C && "unknown calling convention"); bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; bool isTailCall = cast(Op.getOperand(3))->getValue() != 0; - assert(isTailCall == false && "tail call not supported"); SDOperand Callee = Op.getOperand(4); unsigned NumOps = (Op.getNumOperands() - 5) / 2; SDOperand StackPtr = DAG.getRegister(ARM::R13, MVT::i32); @@ -377,22 +376,30 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) { MVT::ValueType VT = Op.Val->getValueType(0); if (VT != MVT::Other) { assert(VT == MVT::i32 || VT == MVT::f32 || VT == MVT::f64); - SDOperand Value; SDOperand Value1 = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag); Chain = Value1.getValue(1); InFlag = Value1.getValue(2); - if (VT == MVT::i32) - Value = Value1; - if (VT == MVT::f32) - Value = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, Value1); + NodeTys.push_back(VT); + if (VT == MVT::i32) { + ResultVals.push_back(Value1); + if (Op.Val->getValueType(1) == MVT::i32) { + SDOperand Value2 = DAG.getCopyFromReg(Chain, ARM::R1, MVT::i32, InFlag); + Chain = Value2.getValue(1); + ResultVals.push_back(Value2); + NodeTys.push_back(VT); + } + } + if (VT == MVT::f32) { + SDOperand Value = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, Value1); + ResultVals.push_back(Value); + } if (VT == MVT::f64) { SDOperand Value2 = DAG.getCopyFromReg(Chain, ARM::R1, MVT::i32, InFlag); Chain = Value2.getValue(1); - Value = DAG.getNode(ARMISD::FMDRR, MVT::f64, Value1, Value2); + SDOperand Value = DAG.getNode(ARMISD::FMDRR, MVT::f64, Value1, Value2); + ResultVals.push_back(Value); } - ResultVals.push_back(Value); - NodeTys.push_back(VT); } Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain, diff --git a/test/CodeGen/ARM/long.ll b/test/CodeGen/ARM/long.ll index 7a1c5703727..f08ee6a336a 100644 --- a/test/CodeGen/ARM/long.ll +++ b/test/CodeGen/ARM/long.ll @@ -37,3 +37,10 @@ entry: %tmp1 = add ulong %y, 1 ret ulong %tmp1 } + +void %f7() { +entry: + %tmp = call long %f8() + ret void +} +declare long %f8() -- 2.34.1