[llvm] r179808 - Set the compact unwind encoding to 'requires EH DWARF' if we cannot generate a CU encoding.

Eric Christopher echristo at gmail.com
Thu Apr 18 16:06:37 PDT 2013


Figured you had some way of reproducing them :)

-eric

On Thu, Apr 18, 2013 at 4:05 PM, Bill Wendling <isanbard at gmail.com> wrote:
> These two fixes don't really have much in the way of testcases that I can add... I.e., these should be edge cases if there at all. But I'll try my best...
>
> -bw
>
> On Apr 18, 2013, at 4:01 PM, Eric Christopher <echristo at gmail.com> wrote:
>
>> Testcase? ;)
>>
>> -eric
>>
>> On Thu, Apr 18, 2013 at 3:55 PM, Bill Wendling <isanbard at gmail.com> wrote:
>>> Author: void
>>> Date: Thu Apr 18 17:55:29 2013
>>> New Revision: 179808
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=179808&view=rev
>>> Log:
>>> Set the compact unwind encoding to 'requires EH DWARF' if we cannot generate a CU encoding.
>>>
>>> Modified:
>>>    llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
>>>
>>> Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=179808&r1=179807&r2=179808&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
>>> +++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Thu Apr 18 17:55:29 2013
>>> @@ -528,11 +528,11 @@ uint32_t X86FrameLowering::getCompactUnw
>>>     if (!MI.getFlag(MachineInstr::FrameSetup)) break;
>>>
>>>     // We don't exect any more prolog instructions.
>>> -    if (ExpectEnd) return 0;
>>> +    if (ExpectEnd) return 0x04000000;
>>>
>>>     if (Opc == PushInstr) {
>>>       // If there are too many saved registers, we cannot use compact encoding.
>>> -      if (SavedRegIdx >= CU_NUM_SAVED_REGS) return 0;
>>> +      if (SavedRegIdx >= CU_NUM_SAVED_REGS) return 0x04000000;
>>>
>>>       SavedRegs[SavedRegIdx++] = MI.getOperand(0).getReg();
>>>       StackAdjust += OffsetSize;
>>> @@ -542,7 +542,7 @@ uint32_t X86FrameLowering::getCompactUnw
>>>       unsigned DstReg = MI.getOperand(0).getReg();
>>>
>>>       if (DstReg != FramePtr || SrcReg != StackPtr)
>>> -        return 0;
>>> +        return 0x04000000;
>>>
>>>       StackAdjust = 0;
>>>       memset(SavedRegs, 0, sizeof(SavedRegs));
>>> @@ -552,7 +552,7 @@ uint32_t X86FrameLowering::getCompactUnw
>>>                Opc == X86::SUB32ri || Opc == X86::SUB32ri8) {
>>>       if (StackSize)
>>>         // We already have a stack size.
>>> -        return 0;
>>> +        return 0x04000000;
>>>
>>>       if (!MI.getOperand(0).isReg() ||
>>>           MI.getOperand(0).getReg() != MI.getOperand(1).getReg() ||
>>> @@ -560,7 +560,7 @@ uint32_t X86FrameLowering::getCompactUnw
>>>         // We need this to be a stack adjustment pointer. Something like:
>>>         //
>>>         //   %RSP<def> = SUB64ri8 %RSP, 48
>>> -        return 0;
>>> +        return 0x04000000;
>>>
>>>       StackSize = MI.getOperand(2).getImm() / StackDivide;
>>>       SubtractInstrIdx += InstrOffset;
>>> @@ -574,11 +574,11 @@ uint32_t X86FrameLowering::getCompactUnw
>>>   if (HasFP) {
>>>     if ((StackAdjust & 0xFF) != StackAdjust)
>>>       // Offset was too big for compact encoding.
>>> -      return 0;
>>> +      return 0x04000000;
>>>
>>>     // Get the encoding of the saved registers when we have a frame pointer.
>>>     uint32_t RegEnc = encodeCompactUnwindRegistersWithFrame(SavedRegs, Is64Bit);
>>> -    if (RegEnc == ~0U) return 0;
>>> +    if (RegEnc == ~0U) return 0x04000000;
>>>
>>>     CompactUnwindEncoding |= 0x01000000;
>>>     CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16;
>>> @@ -595,7 +595,7 @@ uint32_t X86FrameLowering::getCompactUnw
>>>     } else {
>>>       if ((StackAdjust & 0x7) != StackAdjust)
>>>         // The extra stack adjustments are too big for us to handle.
>>> -        return 0;
>>> +        return 0x04000000;
>>>
>>>       // Frameless stack with an offset too large for us to encode compactly.
>>>       CompactUnwindEncoding |= 0x03000000;
>>> @@ -616,7 +616,7 @@ uint32_t X86FrameLowering::getCompactUnw
>>>     uint32_t RegEnc =
>>>       encodeCompactUnwindRegistersWithoutFrame(SavedRegs, SavedRegIdx,
>>>                                                Is64Bit);
>>> -    if (RegEnc == ~0U) return 0;
>>> +    if (RegEnc == ~0U) return 0x04000000;
>>>
>>>     // Encode the register encoding.
>>>     CompactUnwindEncoding |= RegEnc & 0x3FF;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list