[llvm-commits] [llvm] r68705 - /llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
Sanjiv Gupta
sanjiv.gupta at microchip.com
Thu Apr 9 03:29:42 PDT 2009
Author: sgupta
Date: Thu Apr 9 05:29:32 2009
New Revision: 68705
URL: http://llvm.org/viewvc/llvm-project?rev=68705&view=rev
Log:
Arguments to indirect calls were being passed incorrectly. They are not fixed to start after return value.
Modified:
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=68705&r1=68704&r2=68705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Thu Apr 9 05:29:32 2009
@@ -877,7 +877,10 @@
std::vector<SDValue> Ops;
SDVTList Tys = DAG.getVTList(MVT::Other, MVT::Flag);
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
Arg = TheCall->getArg(i);
Ops.clear();
@@ -885,13 +888,14 @@
Ops.push_back(Arg);
Ops.push_back(DataAddr_Lo);
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);
StoreRet = DAG.getNode (PIC16ISD::PIC16StWF, dl, Tys, &Ops[0], Ops.size());
Chain = getChain(StoreRet);
InFlag = getOutFlag(StoreRet);
+ ArgOffset++;
}
return Chain;
}
More information about the llvm-commits
mailing list