mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-25 12:49:50 +00:00
implement calls to functions that return long
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
42b62f3f81
commit
26a76d1024
@ -283,7 +283,6 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
|
||||
assert(CallConv == CallingConv::C && "unknown calling convention");
|
||||
bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
|
||||
bool isTailCall = cast<ConstantSDNode>(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,
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user