MIR Serialization: Change MIR syntax - use custom syntax for MBBs.
[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   bb.0.body:
37     liveins: %edi
38
39     %eax = COPY killed %edi
40     RETQ killed %eax
41 ...
42 ---
43 name:            func
44 tracksRegLiveness: true
45 frameInfo:
46   stackSize:       24
47   maxAlignment:    4
48   adjustsStack:    true
49   hasCalls:        true
50 fixedStack:
51   # CHECK: [[@LINE+1]]:93: expected a named register
52   - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '%0' }
53 stack:
54   - { id: 0, name: b, offset: -20, size: 4, alignment: 4 }
55 body: |
56   bb.0.entry:
57     successors: %bb.1.check
58     liveins: %edi, %rbx
59
60     frame-setup PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp
61     %rsp = frame-setup SUB64ri8 %rsp, 16, implicit-def dead %eflags
62     %ebx = COPY %edi
63     MOV32mr %rsp, 1, _, 12, _, %ebx
64
65   bb.1.check:
66     successors: %bb.2.loop, %bb.3.exit
67     liveins: %ebx
68
69     CMP32ri8 %ebx, 10, implicit-def %eflags
70     JG_1 %bb.3.exit, implicit killed %eflags
71     JMP_1 %bb.2.loop
72
73   bb.2.loop:
74     successors: %bb.1.check
75     liveins: %ebx
76
77     %edi = MOV32rm %rsp, 1, _, 12, _
78     CALL64pcrel32 @compute, csr_64, implicit %rsp, implicit %edi, implicit-def %rsp, implicit-def %eax
79     %eax = DEC32r killed %eax, implicit-def dead %eflags
80     MOV32mr %rsp, 1, _, 12, _, killed %eax
81     JMP_1 %bb.1.check
82
83   bb.3.exit:
84     %eax = MOV32r0 implicit-def dead %eflags
85     %rsp = ADD64ri8 %rsp, 16, implicit-def dead %eflags
86     %rbx = POP64r implicit-def %rsp, implicit %rsp
87     RETQ %eax
88 ...