llvm.org GIT mirror llvm / 2fc0483
Merging r181540: ------------------------------------------------------------------------ r181540 | void | 2013-05-09 13:10:38 -0700 (Thu, 09 May 2013) | 11 lines Generate a compact unwind encoding in the face of a stack alignment push. We generate a `push' of a random register (%rax) if the stack needs to be aligned by the size of that register. However, this could mess up compact unwind generation. In particular, we want to still generate compact unwind in the presence of this monstrosity. Check if the push of of the %rax/%eax register. If it is and it's marked with the `FrameSetup' flag, then we can generate a compact unwind encoding for the function only if the push is the last FrameSetup instruction. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@181955 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
2 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
532532 if (Opc == PushInstr) {
533533 // If there are too many saved registers, we cannot use compact encoding.
534534 if (SavedRegIdx >= CU_NUM_SAVED_REGS) return CU::UNWIND_MODE_DWARF;
535
536 unsigned Reg = MI.getOperand(0).getReg();
537 if (Reg == (Is64Bit ? X86::RAX : X86::EAX)) {
538 ExpectEnd = true;
539 continue;
540 }
535541
536542 SavedRegs[SavedRegIdx++] = MI.getOperand(0).getReg();
537543 StackAdjust += OffsetSize;
0 ; RUN: llc < %s -disable-cfi -disable-fp-elim -mtriple x86_64-apple-darwin11 | FileCheck %s
1
2 %ty = type { i8* }
3
4 @gv = external global i32
5
6 ; This is aligning the stack with a push of a random register.
7 ; CHECK: pushq %rax
8
9 ; Even though we can't encode %rax into the compact unwind, We still want to be
10 ; able to generate a compact unwind encoding in this particular case.
11 ;
12 ; CHECK: __LD,__compact_unwind
13 ; CHECK: _foo ## Range Start
14 ; CHECK: 16842753 ## Compact Unwind Encoding: 0x1010001
15
16 define i8* @foo(i64 %size) {
17 %addr = alloca i64, align 8
18 %tmp20 = load i32* @gv, align 4
19 %tmp21 = call i32 @bar()
20 %tmp25 = load i64* %addr, align 8
21 %tmp26 = inttoptr i64 %tmp25 to %ty*
22 %tmp29 = getelementptr inbounds %ty* %tmp26, i64 0, i32 0
23 %tmp34 = load i8** %tmp29, align 8
24 %tmp35 = getelementptr inbounds i8* %tmp34, i64 %size
25 store i8* %tmp35, i8** %tmp29, align 8
26 ret i8* null
27 }
28
29 declare i32 @bar()