An attempt to fix the problem Anton reported with

ARM tail calls.  Don't know if it works, but it
doesn't break Darwin.

llvm-svn: 106309
This commit is contained in:
Dale Johannesen 2010-06-18 20:44:28 +00:00
parent 24ceda8eb0
commit a06c2f79fc
3 changed files with 8 additions and 2 deletions

View File

@ -1658,7 +1658,8 @@ emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const {
addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(), addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(),
JumpTarget.getTargetFlags()); JumpTarget.getTargetFlags());
} else if (RetOpcode == ARM::TCRETURNdiND) { } else if (RetOpcode == ARM::TCRETURNdiND) {
BuildMI(MBB, MBBI, dl, TII.get(ARM::TAILJMPdND)). BuildMI(MBB, MBBI, dl,
TII.get(STI.isThumb() ? ARM::TAILJMPdNDt : ARM::TAILJMPdND)).
addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(), addGlobalAddress(JumpTarget.getGlobal(), JumpTarget.getOffset(),
JumpTarget.getTargetFlags()); JumpTarget.getTargetFlags());
} else if (RetOpcode == ARM::TCRETURNri) { } else if (RetOpcode == ARM::TCRETURNri) {

View File

@ -1085,7 +1085,11 @@ let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in {
def TAILJMPdND : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops), def TAILJMPdND : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
IIC_Br, "b.w\t$dst @ TAILCALL", IIC_Br, "b.w\t$dst @ TAILCALL",
[]>, Requires<[IsNotDarwin]>; []>, Requires<[IsARM, IsNotDarwin]>;
def TAILJMPdNDt : ABXI<0b1010, (outs), (ins brtarget:$dst, variable_ops),
IIC_Br, "b\t$dst @ TAILCALL",
[]>, Requires<[IsThumb, IsNotDarwin]>;
def TAILJMPrND : AXI<(outs), (ins tGPR:$dst, variable_ops), def TAILJMPrND : AXI<(outs), (ins tGPR:$dst, variable_ops),
BrMiscFrm, IIC_Br, "bx\t$dst @ TAILCALL", BrMiscFrm, IIC_Br, "bx\t$dst @ TAILCALL",

View File

@ -1579,6 +1579,7 @@ bool ARMDecoderEmitter::ARMDEBackend::populateInstruction(
if (Name == "TCRETURNdi" || Name == "TCRETURNdiND" || if (Name == "TCRETURNdi" || Name == "TCRETURNdiND" ||
Name == "TCRETURNri" || Name == "TCRETURNriND" || Name == "TCRETURNri" || Name == "TCRETURNriND" ||
Name == "TAILJMPd" || Name == "TAILJMPdND" || Name == "TAILJMPd" || Name == "TAILJMPdND" ||
Name == "TAILJMPdNDt" ||
Name == "TAILJMPr" || Name == "TAILJMPrND" || Name == "TAILJMPr" || Name == "TAILJMPrND" ||
Name == "MOVr_TC") Name == "MOVr_TC")
return false; return false;