mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-15 16:38:41 +00:00
Fix some liveout handling related to tail calls, see comments.
I don't think this ever resulted in problems on x86, but it would on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105509 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f2aac4db4e
commit
88004c25c7
@ -609,7 +609,12 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) {
|
|||||||
|
|
||||||
// Finally, if the last instruction in the block is a return, make sure to
|
// Finally, if the last instruction in the block is a return, make sure to
|
||||||
// mark it as using all of the live-out values in the function.
|
// mark it as using all of the live-out values in the function.
|
||||||
if (!MBB->empty() && MBB->back().getDesc().isReturn()) {
|
// Things marked both call and return are tail calls; do not do this for
|
||||||
|
// them. The tail callee need not take the same registers as input
|
||||||
|
// that it produces as output, and there are dependencies for its input
|
||||||
|
// registers elsewhere.
|
||||||
|
if (!MBB->empty() && MBB->back().getDesc().isReturn()
|
||||||
|
&& !MBB->back().getDesc().isCall()) {
|
||||||
MachineInstr *Ret = &MBB->back();
|
MachineInstr *Ret = &MBB->back();
|
||||||
|
|
||||||
for (MachineRegisterInfo::liveout_iterator
|
for (MachineRegisterInfo::liveout_iterator
|
||||||
|
@ -2150,17 +2150,12 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
|||||||
Ops.push_back(InFlag);
|
Ops.push_back(InFlag);
|
||||||
|
|
||||||
if (isTailCall) {
|
if (isTailCall) {
|
||||||
// If this is the first return lowered for this function, add the regs
|
// We used to do:
|
||||||
// to the liveout set for the function.
|
//// If this is the first return lowered for this function, add the regs
|
||||||
if (MF.getRegInfo().liveout_empty()) {
|
//// to the liveout set for the function.
|
||||||
SmallVector<CCValAssign, 16> RVLocs;
|
// This isn't right, although it's probably harmless on x86; liveouts
|
||||||
CCState CCInfo(CallConv, isVarArg, getTargetMachine(), RVLocs,
|
// should be computed from returns not tail calls. Consider a void
|
||||||
*DAG.getContext());
|
// function making a tail call to a function returning int.
|
||||||
CCInfo.AnalyzeCallResult(Ins, RetCC_X86);
|
|
||||||
for (unsigned i = 0; i != RVLocs.size(); ++i)
|
|
||||||
if (RVLocs[i].isRegLoc())
|
|
||||||
MF.getRegInfo().addLiveOut(RVLocs[i].getLocReg());
|
|
||||||
}
|
|
||||||
return DAG.getNode(X86ISD::TC_RETURN, dl,
|
return DAG.getNode(X86ISD::TC_RETURN, dl,
|
||||||
NodeTys, &Ops[0], Ops.size());
|
NodeTys, &Ops[0], Ops.size());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user