[PATCH] D13793: [X86AsmBackend] Emit compact unwind for register-sized stacks

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 05:56:59 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350623: [X86][Darwin] Emit compact-unwind for register-sized stack adjustments (authored by thegameg, committed by ).
Herald added subscribers: dexonsmith, jkorous.

Changed prior to commit:
  https://reviews.llvm.org/D13793?vs=37536&id=180648#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D13793/new/

https://reviews.llvm.org/D13793

Files:
  llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/trunk/test/MC/X86/compact-unwind.s


Index: llvm/trunk/test/MC/X86/compact-unwind.s
===================================================================
--- llvm/trunk/test/MC/X86/compact-unwind.s
+++ llvm/trunk/test/MC/X86/compact-unwind.s
@@ -64,6 +64,24 @@
 	retq
 	.cfi_endproc
 
+# Check that a adjustment through a push %rax is the same as a sub.
+
+# CHECK:   Entry at offset 0x40:
+# CHECK-NEXT:     start:                0x2a _testrax
+# CHECK-NEXT:     length:               0x5
+# CHECK-NEXT:     compact encoding:     0x02020000
+	.globl	_testrax
+_testrax:                               ## @testrax
+	.cfi_startproc
+## %bb.0:                               ## %entry
+	pushq	%rax
+Ltmp15:
+	.cfi_def_cfa_offset 16
+	xorl	%eax, %eax
+	popq	%rax
+	retq
+	.cfi_endproc
+
 	.section	__TEXT,__cstring,cstring_literals
 L_.str:                                 ## @.str
 	.asciz	"%d\n"
Index: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -635,16 +635,6 @@
       CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16;
       CompactUnwindEncoding |= RegEnc & CU::UNWIND_BP_FRAME_REGISTERS;
     } else {
-      // If the amount of the stack allocation is the size of a register, then
-      // we "push" the RAX/EAX register onto the stack instead of adjusting the
-      // stack pointer with a SUB instruction. We don't support the push of the
-      // RAX/EAX register with compact unwind. So we check for that situation
-      // here.
-      if ((NumDefCFAOffsets == SavedRegIdx + 1 &&
-           StackSize - PrevStackSize == 1) ||
-          (Instrs.size() == 1 && NumDefCFAOffsets == 1 && StackSize == 2))
-        return CU::UNWIND_MODE_DWARF;
-
       SubtractInstrIdx += InstrOffset;
       ++StackAdjust;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13793.180648.patch
Type: text/x-patch
Size: 1891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190108/6d5e168a/attachment.bin>


More information about the llvm-commits mailing list