[llvm-commits] [PATH] Fix unwind info in x86 JIT for functions without stack space
Bill Wendling
isanbard at gmail.com
Sun Aug 2 04:48:11 PDT 2009
On Jul 31, 2009, at 10:56 AM, Zoltan Varga wrote:
> Hi,
>
> This is a resend of a patch sent earlier which got lost in the ml
> traffic.
>
> The x86 jit doesn't generate a def_cfa_offset unwind instruction
> after the
> pushes in the function prolog if the function doesn't
>
> have any stack space, i.e. for a prolog like:
>
> 0x40011870: push %r15
>
> 0x40011872: push %r14
>
> 0x40011874: push %rbx
>
> The attached patch fixes this.
>
Hi Zoltan,
(Sorry it took me a while to look at this email.)
I don't think that this patch is the correct solution. The unwind info
for callee-saved registers should be emitted in this code:
// Skip the callee-saved push instructions.
bool RegsSaved = false;
while (MBBI != MBB.end() &&
(MBBI->getOpcode() == X86::PUSH32r ||
MBBI->getOpcode() == X86::PUSH64r)) {
RegsSaved = true;
++MBBI;
}
if (RegsSaved && needsFrameMoves) {
// Mark end of callee-saved push instructions.
unsigned LabelId = MMI->NextLabelID();
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addImm(LabelId);
// Emit DWARF info specifying the offsets of the callee-saved
registers.
emitCalleeSavedFrameMoves(MF, LabelId, HasFP ? FramePtr :
StackPtr);
}
The code you modified is placing a label/machine-move after the "subl
X, %esp" instruction when there isn't a frame pointer. (N.B., this
instruction won't exist if NumBytes == 0.)
Do you have a code example for me to look at?
-bw
More information about the llvm-commits
mailing list