File: machine-outliner-patchable.mir

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (162 lines) | stat: -rw-r--r-- 5,690 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-outliner -verify-machineinstrs -enable-machine-outliner %s -o - | FileCheck %s
--- |
  ; Function Attrs: minsize
  declare void @foo(i32, i32, i32, i32) #0
    
  ; Function Attrs: nounwind
  define void @xray0(i1 %a) #1 {
  entry:
    br i1 %a, label %if.then, label %if.end
  
  if.then:                                          ; preds = %entry
    call void @foo(i32 1, i32 2, i32 3, i32 4)
    br label %if.end
  
  if.end:                                           ; preds = %if.then, %entry
    call void @foo(i32 5, i32 6, i32 7, i32 8)
    ret void
  }
  
  ; Function Attrs: nounwind
  define void @xray1(i1 %a) #1 {
  entry:
    br i1 %a, label %if.then, label %if.end
  
  if.then:                                          ; preds = %entry
    call void @foo(i32 1, i32 2, i32 3, i32 4)
    br label %if.end
  
  if.end:                                           ; preds = %if.then, %entry
    call void @foo(i32 5, i32 6, i32 7, i32 8)
    ret void
  }
  
  attributes #0 = { minsize }
  attributes #1 = { nounwind "function-instrument"="xray-always" }

...
---
name:            xray0
tracksRegLiveness: true
liveins:
  - { reg: '$w0', virtual-reg: '' }
stack:
  - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16, 
      stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true, 
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
machineFunctionInfo:
  hasRedZone:      false
body:             |
  ; CHECK-LABEL: name: xray0
  ; CHECK:       bb.0.entry:
  ; CHECK:         PATCHABLE_FUNCTION_ENTER
  ; CHECK:       bb.1.if.then:
  ; CHECK:         BL @[[OUTLINED_FUNCTION:OUTLINED_FUNCTION_[0-9]]]
  ; CHECK:       bb.2.if.end:
  ; CHECK-NEXT:    $w0 = MOVZWi 5, 0
  ; CHECK-NEXT:    $w1 = MOVZWi 6, 0
  ; CHECK-NEXT:    $w2 = MOVZWi 7, 0
  ; CHECK-NEXT:    $w3 = MOVZWi 8, 0
  ; CHECK-NEXT:    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
  ; CHECK:         $w0 = MOVZWi 5, 0
  ; CHECK-NEXT:    $w1 = MOVZWi 6, 0
  ; CHECK-NEXT:    PATCHABLE_FUNCTION_EXIT
  ; CHECK-NEXT:    RET undef $lr

  bb.0.entry:
    successors: %bb.1(0x40000000), %bb.2(0x40000000)
    liveins: $w0, $lr
  
    PATCHABLE_FUNCTION_ENTER
    early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
    TBZW killed renamable $w0, 0, %bb.2
  
  bb.1.if.then:
    successors: %bb.2(0x80000000)
  
    $w0 = MOVZWi 1, 0
    $w1 = MOVZWi 2, 0
    $w2 = MOVZWi 3, 0
    $w3 = MOVZWi 4, 0
    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
  
  bb.2.if.end:
    $w0 = MOVZWi 5, 0
    $w1 = MOVZWi 6, 0
    $w2 = MOVZWi 7, 0
    $w3 = MOVZWi 8, 0
    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
    early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
    $w0 = MOVZWi 5, 0
    $w1 = MOVZWi 6, 0
    PATCHABLE_FUNCTION_EXIT
    RET undef $lr

...
---
name:            xray1
tracksRegLiveness: true
liveins:
  - { reg: '$w0', virtual-reg: '' }
stack:
  - { id: 0, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16, 
      stack-id: default, callee-saved-register: '$lr', callee-saved-restored: true, 
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
machineFunctionInfo:
  hasRedZone:      false
body:             |
  ; CHECK-LABEL: name: xray1
  ; CHECK:       bb.0.entry:
  ; CHECK:         PATCHABLE_FUNCTION_ENTER
  ; CHECK:       bb.1.if.then:
  ; CHECK:         BL @[[OUTLINED_FUNCTION]]
  ; CHECK:       bb.2.if.end:
  ; CHECK-NEXT:    $w0 = MOVZWi 5, 0
  ; CHECK-NEXT:    $w1 = MOVZWi 6, 0
  ; CHECK-NEXT:    $w2 = MOVZWi 7, 0
  ; CHECK-NEXT:    $w3 = MOVZWi 8, 0
  ; CHECK-NEXT:    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
  ; CHECK:         $w0 = MOVZWi 5, 0
  ; CHECK-NEXT:    $w1 = MOVZWi 6, 0
  ; CHECK-NEXT:    PATCHABLE_FUNCTION_EXIT
  ; CHECK-NEXT:    RET undef $lr

  bb.0.entry:
    successors: %bb.1(0x40000000), %bb.2(0x40000000)
    liveins: $w0, $lr
  
    PATCHABLE_FUNCTION_ENTER
    early-clobber $sp = frame-setup STRXpre killed $lr, $sp, -16 :: (store (s64) into %stack.0)
    TBZW killed renamable $w0, 0, %bb.2
  
  bb.1.if.then:
    successors: %bb.2(0x80000000)
  
    $w0 = MOVZWi 1, 0
    $w1 = MOVZWi 2, 0
    $w2 = MOVZWi 3, 0
    $w3 = MOVZWi 4, 0
    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
  
  bb.2.if.end:
    $w0 = MOVZWi 5, 0
    $w1 = MOVZWi 6, 0
    $w2 = MOVZWi 7, 0
    $w3 = MOVZWi 8, 0
    BL @foo, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit killed $w2, implicit killed $w3, implicit-def $sp
    early-clobber $sp, $lr = frame-destroy LDRXpost $sp, 16 :: (load (s64) from %stack.0)
    $w0 = MOVZWi 5, 0
    $w1 = MOVZWi 6, 0
    PATCHABLE_FUNCTION_EXIT
    RET undef $lr

  ; CHECK: name: [[OUTLINED_FUNCTION]]
  ; CHECK:     bb.0:
  ; CHECK:       $w0 = MOVZWi 1, 0
  ; CHECK-NEXT:  $w1 = MOVZWi 2, 0
  ; CHECK-NEXT:  $w2 = MOVZWi 3, 0
  ; CHECK-NEXT:  $w3 = MOVZWi 4, 0
  ; CHECK-NEXT:  TCRETURNdi @foo, 0, implicit $sp

...