[LLVMdev] x86 frame pointer and EHSjLjSetJmp

Robison, Arch arch.robison at intel.com
Mon Nov 17 14:33:13 PST 2014


I'm trying to fix the bug noted in http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-May/062343.html , where RBX is not correctly restored by __builtin_setjmp/__builtin_longjmp.   (Our Cilk implementation hits the bug.)  My strategy is to allocate an extra slot relative to the frame pointer (RBP), and save RBX there.  Ideally I'd like the "RBX save slot" to be *below* where the GPRs are saved.  Doing so would save a stack-adjustment instruction on return.  But emitEHSjLjSetJmp runs before the set of saved GPRs is known.

Question: Is there a way to build a machine instruction using a symbolic constant for the offset, in a way that I can define the symbolic constant later (during prologue generation)?  Here's an example of what I have so far, using a hard-coded constant -8.  I'd like to make the -8 symbolic and set its value later.

    if (RegInfo->hasBasePointer(*MF)) {
        ...
       addRegOffset(BuildMI(restoreMBB, DL, TII->get(X86::MOV64rm), BasePtr),
            FramePtr, true, -8)
           .setMIFlag(MachineInstr::FrameSetup);
    }

- Arch D. Robison






More information about the llvm-dev mailing list