Move MRI liveouts to Mips return instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174410 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2013-02-05 18:12:03 +00:00
parent 6ab5061a2c
commit d073596671
2 changed files with 13 additions and 17 deletions

View File

@ -3454,15 +3454,8 @@ MipsTargetLowering::LowerReturn(SDValue Chain,
// Analize return values. // Analize return values.
CCInfo.AnalyzeReturn(Outs, RetCC_Mips); CCInfo.AnalyzeReturn(Outs, RetCC_Mips);
// If this is the first return lowered for this function, add
// the regs to the liveout set for the function.
if (DAG.getMachineFunction().getRegInfo().liveout_empty()) {
for (unsigned i = 0; i != RVLocs.size(); ++i)
if (RVLocs[i].isRegLoc())
DAG.getMachineFunction().getRegInfo().addLiveOut(RVLocs[i].getLocReg());
}
SDValue Flag; SDValue Flag;
SmallVector<SDValue, 4> RetOps(1, Chain);
// Copy the result values into the output registers. // Copy the result values into the output registers.
for (unsigned i = 0; i != RVLocs.size(); ++i) { for (unsigned i = 0; i != RVLocs.size(); ++i) {
@ -3471,9 +3464,9 @@ MipsTargetLowering::LowerReturn(SDValue Chain,
Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), OutVals[i], Flag); Chain = DAG.getCopyToReg(Chain, dl, VA.getLocReg(), OutVals[i], Flag);
// guarantee that all emitted copies are // Guarantee that all emitted copies are stuck together with flags.
// stuck together, avoiding something bad
Flag = Chain.getValue(1); Flag = Chain.getValue(1);
RetOps.push_back(DAG.getRegister(VA.getLocReg(), VA.getLocVT()));
} }
// The mips ABIs for returning structs by value requires that we copy // The mips ABIs for returning structs by value requires that we copy
@ -3492,15 +3485,17 @@ MipsTargetLowering::LowerReturn(SDValue Chain,
Chain = DAG.getCopyToReg(Chain, dl, V0, Val, Flag); Chain = DAG.getCopyToReg(Chain, dl, V0, Val, Flag);
Flag = Chain.getValue(1); Flag = Chain.getValue(1);
MF.getRegInfo().addLiveOut(V0); RetOps.push_back(DAG.getRegister(V0, getPointerTy()));
} }
// Return on Mips is always a "jr $ra" RetOps[0] = Chain; // Update chain.
if (Flag.getNode())
return DAG.getNode(MipsISD::Ret, dl, MVT::Other, Chain, Flag);
// Return Void // Add the flag if we have it.
return DAG.getNode(MipsISD::Ret, dl, MVT::Other, Chain); if (Flag.getNode())
RetOps.push_back(Flag);
// Return on Mips is always a "jr $ra"
return DAG.getNode(MipsISD::Ret, dl, MVT::Other, &RetOps[0], RetOps.size());
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -72,7 +72,8 @@ def MipsTprelLo : SDNode<"MipsISD::TprelLo", SDTIntUnaryOp>;
def MipsThreadPointer: SDNode<"MipsISD::ThreadPointer", SDT_MipsThreadPointer>; def MipsThreadPointer: SDNode<"MipsISD::ThreadPointer", SDT_MipsThreadPointer>;
// Return // Return
def MipsRet : SDNode<"MipsISD::Ret", SDTNone, [SDNPHasChain, SDNPOptInGlue]>; def MipsRet : SDNode<"MipsISD::Ret", SDTNone,
[SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;
// These are target-independent nodes, but have target-specific formats. // These are target-independent nodes, but have target-specific formats.
def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart,