llvm.org GIT mirror llvm / 614057b
add support for calling functions that return double git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30771 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 13 years ago
2 changed file(s) with 26 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
307307 NodeTys.clear();
308308
309309 // If the call has results, copy the values out of the ret val registers.
310 switch (Op.Val->getValueType(0)) {
311 default: assert(0 && "Unexpected ret value!");
312 case MVT::Other:
313 break;
314 case MVT::i32:
315 Chain = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag).getValue(1);
316 ResultVals.push_back(Chain.getValue(0));
317 NodeTys.push_back(MVT::i32);
310 MVT::ValueType VT = Op.Val->getValueType(0);
311 if (VT != MVT::Other) {
312 assert(VT == MVT::i32 || VT == MVT::f32 || VT == MVT::f64);
313 SDOperand Value;
314
315 SDOperand Value1 = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag);
316 Chain = Value1.getValue(1);
317 InFlag = Value1.getValue(2);
318 if (VT == MVT::i32)
319 Value = Value1;
320 if (VT == MVT::f32)
321 Value = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, Value1);
322 if (VT == MVT::f64) {
323 SDOperand Value2 = DAG.getCopyFromReg(Chain, ARM::R1, MVT::i32, InFlag);
324 Chain = Value2.getValue(1);
325 Value = DAG.getNode(ARMISD::FMDRR, MVT::f64, Value1, Value2);
326 }
327 ResultVals.push_back(Value);
328 NodeTys.push_back(VT);
318329 }
319330
320331 Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, Chain,
2828 ret double %a
2929 }
3030
31 void %f3(double %a) {
32 call void %f4( double %a)
33 ret void
31 void %f3() {
32 entry:
33 %tmp = call double %f5() ; [#uses=1]
34 call void %f4(double %tmp )
35 ret void
3436 }
37
3538 declare void %f4(double)
39 declare double %f5()