summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsISelLowering.cpp
diff options
context:
space:
mode:
authorAleksandar Beserminji <Aleksandar.Beserminji@imgtec.com>2017-10-20 14:35:41 +0000
committerAleksandar Beserminji <Aleksandar.Beserminji@imgtec.com>2017-10-20 14:35:41 +0000
commit143572984d706d200e0058213f4a9244a5ba4450 (patch)
treed6f32c317b2d0b1c3a03c006836eeb347e1fbf20 /llvm/lib/Target/Mips/MipsISelLowering.cpp
parent27b226fb654830e4e5511df9bac883af9d4816e8 (diff)
downloadbcm5719-llvm-143572984d706d200e0058213f4a9244a5ba4450.tar.gz
bcm5719-llvm-143572984d706d200e0058213f4a9244a5ba4450.zip
Revert "[mips] Reordering callseq* nodes to be linear"
This reverts commit r314507, because the original patch is causing test failures. llvm-svn: 316215
Diffstat (limited to 'llvm/lib/Target/Mips/MipsISelLowering.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsISelLowering.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index d12da4bc32f..38b3c3fb160 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -2992,6 +2992,16 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
if (IsTailCall)
++NumTailCalls;
+ // Chain is the output chain of the last Load/Store or CopyToReg node.
+ // ByValChain is the output chain of the last Memcpy node created for copying
+ // byval arguments to the stack.
+ unsigned StackAlignment = TFL->getStackAlignment();
+ NextStackOffset = alignTo(NextStackOffset, StackAlignment);
+ SDValue NextStackOffsetVal = DAG.getIntPtrConstant(NextStackOffset, DL, true);
+
+ if (!IsTailCall)
+ Chain = DAG.getCALLSEQ_START(Chain, NextStackOffset, 0, DL);
+
SDValue StackPtr =
DAG.getCopyFromReg(Chain, DL, ABI.IsN64() ? Mips::SP_64 : Mips::SP,
getPointerTy(DAG.getDataLayout()));
@@ -3020,7 +3030,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
assert(ByValIdx < CCInfo.getInRegsParamsCount());
assert(!IsTailCall &&
"Do not tail-call optimize if there is a byval argument.");
- Chain = passByValArg(Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
+ passByValArg(Chain, DL, RegsToPass, MemOpChains, StackPtr, MFI, DAG, Arg,
FirstByValReg, LastByValReg, Flags, Subtarget.isLittle(),
VA);
CCInfo.nextInRegsParam();
@@ -3111,16 +3121,6 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
EVT Ty = Callee.getValueType();
bool GlobalOrExternal = false, IsCallReloc = false;
- // Chain is the output chain of the last Load/Store or CopyToReg node.
- // ByValChain is the output chain of the last Memcpy node created for copying
- // byval arguments to the stack.
- unsigned StackAlignment = TFL->getStackAlignment();
- NextStackOffset = alignTo(NextStackOffset, StackAlignment);
- SDValue NextStackOffsetVal = DAG.getIntPtrConstant(NextStackOffset, DL, true);
-
- if (!IsTailCall)
- Chain = DAG.getCALLSEQ_START(Chain, NextStackOffset, 0, DL);
-
// The long-calls feature is ignored in case of PIC.
// While we do not support -mshared / -mno-shared properly,
// ignore long-calls in case of -mabicalls too.
@@ -4094,7 +4094,7 @@ void MipsTargetLowering::copyByValRegs(
}
// Copy byVal arg to registers and stack.
-SDValue MipsTargetLowering::passByValArg(
+void MipsTargetLowering::passByValArg(
SDValue Chain, const SDLoc &DL,
std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
@@ -4127,7 +4127,7 @@ SDValue MipsTargetLowering::passByValArg(
// Return if the struct has been fully copied.
if (ByValSizeInBytes == OffsetInBytes)
- return Chain;
+ return;
// Copy the remainder of the byval argument with sub-word loads and shifts.
if (LeftoverBytes) {
@@ -4172,7 +4172,7 @@ SDValue MipsTargetLowering::passByValArg(
unsigned ArgReg = ArgRegs[FirstReg + I];
RegsToPass.push_back(std::make_pair(ArgReg, Val));
- return Chain;
+ return;
}
}
@@ -4182,13 +4182,12 @@ SDValue MipsTargetLowering::passByValArg(
DAG.getConstant(OffsetInBytes, DL, PtrTy));
SDValue Dst = DAG.getNode(ISD::ADD, DL, PtrTy, StackPtr,
DAG.getIntPtrConstant(VA.getLocMemOffset(), DL));
- Chain = DAG.getMemcpy(
- Chain, DL, Dst, Src, DAG.getConstant(MemCpySize, DL, PtrTy), Alignment,
- /*isVolatile=*/false, /*AlwaysInline=*/false,
- /*isTailCall=*/false, MachinePointerInfo(), MachinePointerInfo());
+ Chain = DAG.getMemcpy(Chain, DL, Dst, Src,
+ DAG.getConstant(MemCpySize, DL, PtrTy),
+ Alignment, /*isVolatile=*/false, /*AlwaysInline=*/false,
+ /*isTailCall=*/false,
+ MachinePointerInfo(), MachinePointerInfo());
MemOpChains.push_back(Chain);
-
- return Chain;
}
void MipsTargetLowering::writeVarArgRegs(std::vector<SDValue> &OutChains,
OpenPOWER on IntegriCloud