mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 02:29:22 +00:00
Arguments to indirect calls were being passed incorrectly. They are not fixed to start after return value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68705 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a1cd83a258
commit
e206b1d142
@ -877,7 +877,10 @@ LowerIndirectCallArguments(SDValue Op, SDValue Chain, SDValue InFlag,
|
|||||||
std::vector<SDValue> Ops;
|
std::vector<SDValue> Ops;
|
||||||
SDVTList Tys = DAG.getVTList(MVT::Other, MVT::Flag);
|
SDVTList Tys = DAG.getVTList(MVT::Other, MVT::Flag);
|
||||||
SDValue Arg, StoreRet;
|
SDValue Arg, StoreRet;
|
||||||
for (unsigned i=0; i<NumOps; i++) {
|
|
||||||
|
// For PIC16 ABI the arguments come after the return value.
|
||||||
|
unsigned RetVals = TheCall->getNumRetVals();
|
||||||
|
for (unsigned i = 0, ArgOffset = RetVals; i < NumOps; i++) {
|
||||||
// Get the arguments
|
// Get the arguments
|
||||||
Arg = TheCall->getArg(i);
|
Arg = TheCall->getArg(i);
|
||||||
Ops.clear();
|
Ops.clear();
|
||||||
@ -885,13 +888,14 @@ LowerIndirectCallArguments(SDValue Op, SDValue Chain, SDValue InFlag,
|
|||||||
Ops.push_back(Arg);
|
Ops.push_back(Arg);
|
||||||
Ops.push_back(DataAddr_Lo);
|
Ops.push_back(DataAddr_Lo);
|
||||||
Ops.push_back(DataAddr_Hi);
|
Ops.push_back(DataAddr_Hi);
|
||||||
Ops.push_back(DAG.getConstant(i, MVT::i8));
|
Ops.push_back(DAG.getConstant(ArgOffset, MVT::i8));
|
||||||
Ops.push_back(InFlag);
|
Ops.push_back(InFlag);
|
||||||
|
|
||||||
StoreRet = DAG.getNode (PIC16ISD::PIC16StWF, dl, Tys, &Ops[0], Ops.size());
|
StoreRet = DAG.getNode (PIC16ISD::PIC16StWF, dl, Tys, &Ops[0], Ops.size());
|
||||||
|
|
||||||
Chain = getChain(StoreRet);
|
Chain = getChain(StoreRet);
|
||||||
InFlag = getOutFlag(StoreRet);
|
InFlag = getOutFlag(StoreRet);
|
||||||
|
ArgOffset++;
|
||||||
}
|
}
|
||||||
return Chain;
|
return Chain;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user