The compact unwinding offsets are divided by 8 on 64-bit machines.
authorBill Wendling <isanbard@gmail.com>
Tue, 26 Jul 2011 08:03:49 +0000 (08:03 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 26 Jul 2011 08:03:49 +0000 (08:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136065 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FrameLowering.cpp

index cdc83054aa03d7f2d409c536b1ed4de2a8abbbd8..d5e9aa6d6422b87a2b0433956459feb3ba93dbfa 100644 (file)
@@ -490,6 +490,8 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
   unsigned SubtractInstr = getSUBriOpcode(Is64Bit, -TailCallReturnAddrDelta);
   unsigned SubtractInstrIdx = (Is64Bit ? 3 : 2);
 
+  unsigned StackDivide = (Is64Bit ? 8 : 4);
+
   unsigned InstrOffset = 0;
   unsigned CFAOffset = 0;
   unsigned StackAdjust = 0;
@@ -536,7 +538,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
         //   %RSP<def> = SUB64ri8 %RSP, 48
         return 0;
 
-      StackAdjust = MI.getOperand(2).getImm() / 4;
+      StackAdjust = MI.getOperand(2).getImm() / StackDivide;
       SubtractInstrIdx += InstrOffset;
       ExpectEnd = true;
     }
@@ -544,7 +546,7 @@ uint32_t X86FrameLowering::getCompactUnwindEncoding(MachineFunction &MF) const {
 
   // Encode that we are using EBP/RBP as the frame pointer.
   uint32_t CompactUnwindEncoding = 0;
-  CFAOffset /= 4;
+  CFAOffset /= StackDivide;
   if (HasFP) {
     if ((CFAOffset & 0xFF) != CFAOffset)
       // Offset was too big for compact encoding.