@@ -2992,16 +2992,6 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
2992
2992
if (IsTailCall)
2993
2993
++NumTailCalls;
2994
2994
2995
- // Chain is the output chain of the last Load/Store or CopyToReg node.
2996
- // ByValChain is the output chain of the last Memcpy node created for copying
2997
- // byval arguments to the stack.
2998
- unsigned StackAlignment = TFL->getStackAlignment ();
2999
- NextStackOffset = alignTo (NextStackOffset, StackAlignment);
3000
- SDValue NextStackOffsetVal = DAG.getIntPtrConstant (NextStackOffset, DL, true );
3001
-
3002
- if (!IsTailCall)
3003
- Chain = DAG.getCALLSEQ_START (Chain, NextStackOffset, 0 , DL);
3004
-
3005
2995
SDValue StackPtr =
3006
2996
DAG.getCopyFromReg (Chain, DL, ABI.IsN64 () ? Mips::SP_64 : Mips::SP,
3007
2997
getPointerTy (DAG.getDataLayout ()));
@@ -3030,7 +3020,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
3030
3020
assert (ByValIdx < CCInfo.getInRegsParamsCount ());
3031
3021
assert (!IsTailCall &&
3032
3022
" Do not tail-call optimize if there is a byval argument." );
3033
- passByValArg (Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3023
+ Chain = passByValArg (Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
3034
3024
FirstByValReg, LastByValReg, Flags, Subtarget.isLittle (),
3035
3025
VA);
3036
3026
CCInfo.nextInRegsParam ();
@@ -3122,6 +3112,16 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
3122
3112
EVT Ty = Callee.getValueType ();
3123
3113
bool GlobalOrExternal = false , IsCallReloc = false ;
3124
3114
3115
+ // Chain is the output chain of the last Load/Store or CopyToReg node.
3116
+ // ByValChain is the output chain of the last Memcpy node created for copying
3117
+ // byval arguments to the stack.
3118
+ unsigned StackAlignment = TFL->getStackAlignment ();
3119
+ NextStackOffset = alignTo (NextStackOffset, StackAlignment);
3120
+ SDValue NextStackOffsetVal = DAG.getIntPtrConstant (NextStackOffset, DL, true );
3121
+
3122
+ if (!IsTailCall)
3123
+ Chain = DAG.getCALLSEQ_START (Chain, NextStackOffset, 0 , DL);
3124
+
3125
3125
// The long-calls feature is ignored in case of PIC.
3126
3126
// While we do not support -mshared / -mno-shared properly,
3127
3127
// ignore long-calls in case of -mabicalls too.
@@ -4095,7 +4095,7 @@ void MipsTargetLowering::copyByValRegs(
4095
4095
}
4096
4096
4097
4097
// Copy byVal arg to registers and stack.
4098
- void MipsTargetLowering::passByValArg (
4098
+ SDValue MipsTargetLowering::passByValArg (
4099
4099
SDValue Chain, const SDLoc &DL,
4100
4100
std::deque<std::pair<unsigned , SDValue>> &RegsToPass,
4101
4101
SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
@@ -4128,7 +4128,7 @@ void MipsTargetLowering::passByValArg(
4128
4128
4129
4129
// Return if the struct has been fully copied.
4130
4130
if (ByValSizeInBytes == OffsetInBytes)
4131
- return ;
4131
+ return Chain ;
4132
4132
4133
4133
// Copy the remainder of the byval argument with sub-word loads and shifts.
4134
4134
if (LeftoverBytes) {
@@ -4173,7 +4173,7 @@ void MipsTargetLowering::passByValArg(
4173
4173
4174
4174
unsigned ArgReg = ArgRegs[FirstReg + I];
4175
4175
RegsToPass.push_back (std::make_pair (ArgReg, Val));
4176
- return ;
4176
+ return Chain ;
4177
4177
}
4178
4178
}
4179
4179
@@ -4183,12 +4183,13 @@ void MipsTargetLowering::passByValArg(
4183
4183
DAG.getConstant (OffsetInBytes, DL, PtrTy));
4184
4184
SDValue Dst = DAG.getNode (ISD::ADD, DL, PtrTy, StackPtr,
4185
4185
DAG.getIntPtrConstant (VA.getLocMemOffset (), DL));
4186
- Chain = DAG.getMemcpy (Chain, DL, Dst, Src,
4187
- DAG.getConstant (MemCpySize, DL, PtrTy),
4188
- Alignment, /* isVolatile=*/ false , /* AlwaysInline=*/ false ,
4189
- /* isTailCall=*/ false ,
4190
- MachinePointerInfo (), MachinePointerInfo ());
4186
+ Chain = DAG.getMemcpy (
4187
+ Chain, DL, Dst, Src, DAG.getConstant (MemCpySize, DL, PtrTy), Alignment,
4188
+ /* isVolatile=*/ false , /* AlwaysInline=*/ false ,
4189
+ /* isTailCall=*/ false , MachinePointerInfo (), MachinePointerInfo ());
4191
4190
MemOpChains.push_back (Chain);
4191
+
4192
+ return Chain;
4192
4193
}
4193
4194
4194
4195
void MipsTargetLowering::writeVarArgRegs (std::vector<SDValue> &OutChains,
0 commit comments