MIR Serialization: Serialize MachineFrameInfo's callee saved information.
[oota-llvm.git] / test / CodeGen / MIR / X86 / expected-named-register-in-callee-saved-register.mir
1 # RUN: not llc -march=x86-64 -start-after prologepilog -stop-after prologepilog -o /dev/null %s 2>&1 | FileCheck %s
2
3 --- |
4
5   define i32 @compute(i32 %a) {
6   body:
7     ret i32 %a
8   }
9
10   define i32 @func(i32 %a) {
11   entry:
12     %b = alloca i32
13     store i32 %a, i32* %b
14     br label %check
15
16   check:
17     %comp = icmp sle i32 %a, 10
18     br i1 %comp, label %loop, label %exit
19
20   loop:
21     %c = load i32, i32* %b
22     %d = call i32 @compute(i32 %c)
23     %e = sub i32 %d, 1
24     store i32 %e, i32* %b
25     br label %check
26
27   exit:
28     ret i32 0
29   }
30
31 ...
32 ---
33 name:            compute
34 tracksRegLiveness: true
35 body:
36   - id:          0
37     name:        body
38     liveins:     [ '%edi' ]
39     instructions:
40       - '%eax = COPY killed %edi'
41       - 'RETQ killed %eax'
42 ...
43 ---
44 name:            func
45 tracksRegLiveness: true
46 frameInfo:
47   stackSize:       24
48   maxAlignment:    4
49   adjustsStack:    true
50   hasCalls:        true
51 fixedStack:
52   # CHECK: [[@LINE+1]]:93: expected a named register
53   - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '%0' }
54 stack:
55   - { id: 0, name: b, offset: -20, size: 4, alignment: 4 }
56 body:
57   - id:          0
58     name:        entry
59     successors:  [ '%bb.1.check' ]
60     liveins:     [ '%edi', '%rbx' ]
61     instructions:
62       - 'frame-setup PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp'
63       - '%rsp = frame-setup SUB64ri8 %rsp, 16, implicit-def dead %eflags'
64       - '%ebx = COPY %edi'
65       - 'MOV32mr %rsp, 1, _, 12, _, %ebx'
66   - id:          1
67     name:        check
68     successors:  [ '%bb.2.loop', '%bb.3.exit' ]
69     liveins:     [ '%ebx' ]
70     instructions:
71       - 'CMP32ri8 %ebx, 10, implicit-def %eflags'
72       - 'JG_1 %bb.3.exit, implicit killed %eflags'
73       - 'JMP_1 %bb.2.loop'
74   - id:          2
75     name:        loop
76     successors:  [ '%bb.1.check' ]
77     liveins:     [ '%ebx' ]
78     instructions:
79       - '%edi = MOV32rm %rsp, 1, _, 12, _'
80       - 'CALL64pcrel32 @compute, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp, implicit-def %eax'
81       - '%eax = DEC32r killed %eax, implicit-def dead %eflags'
82       - 'MOV32mr %rsp, 1, _, 12, _, killed %eax'
83       - 'JMP_1 %bb.1.check'
84   - id:          3
85     name:        exit
86     instructions:
87       - '%eax = MOV32r0 implicit-def dead %eflags'
88       - '%rsp = ADD64ri8 %rsp, 16, implicit-def dead %eflags'
89       - '%rbx = POP64r implicit-def %rsp, implicit %rsp'
90       - 'RETQ %eax'
91 ...