• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple=aarch64-linux-gnu %s -run-pass=aarch64-jump-tables -o - | FileCheck %s
2--- |
3  define i32 @test_jumptable(i32 %in) {
4    unreachable
5  }
6
7...
8---
9name:            test_jumptable
10alignment:       4
11exposesReturnsTwice: false
12legalized:       false
13regBankSelected: false
14selected:        false
15tracksRegLiveness: true
16liveins:
17  - { reg: '$w0' }
18frameInfo:
19  isFrameAddressTaken: false
20  isReturnAddressTaken: false
21  hasStackMap:     false
22  hasPatchPoint:   false
23  stackSize:       0
24  offsetAdjustment: 0
25  maxAlignment:    0
26  adjustsStack:    false
27  hasCalls:        false
28  maxCallFrameSize: 0
29  hasOpaqueSPAdjustment: false
30  hasVAStart:      false
31  hasMustTailInVarArgFunc: false
32jumpTable:
33  kind:            block-address
34  entries:
35    - id:              0
36      blocks:          [ '%bb.2', '%bb.3' ]
37    - id:              1
38      blocks:          [ '%bb.4', '%bb.5' ]
39    - id:              2
40      blocks:          [ '%bb.7' ]
41    - id:              3
42      blocks:          [ '%bb.9' ]
43    - id:              4
44      blocks:          [ '%bb.9' ]
45    - id:              5
46      blocks:          [ '%bb.11' ]
47body:             |
48  bb.0 (%ir-block.0):
49    liveins: $x8
50
51  bb.1 (%ir-block.0):
52    ; CHECK-LABEL: body:
53    ; CHECK-LABEL: bb.1
54    ; CHECK: JumpTableDest8
55    liveins: $x8
56    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.0
57    BR killed $x10
58
59  bb.2:
60    ; Last destination is 4 * 255 = 1020 bytes after first. Byte is OK.
61    dead $xzr = SPACE 1020, undef $xzr
62
63  bb.3:
64    ; CHECK-LABEL: bb.3
65    ; CHECK: JumpTableDest16
66    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.1
67    BR killed $x10
68
69  bb.4:
70    ; Last destination is 4 * 256 = 1024 bytes after first. Half needed.
71    dead $xzr = SPACE 1024, undef $xzr
72
73  bb.5:
74    ; CHECK-LABEL: bb.5
75    ; CHECK: JumpTableDest8
76    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.2
77    BR killed $x10
78
79  bb.6:
80    ; First destination is (2^20 - 4) after reference. Just reachable by ADR so can use compressed table.
81    dead $xzr = SPACE 1048556, undef $xzr
82
83  bb.7:
84    ; CHECK-LABEL: bb.7
85    ; CHECK: JumpTableDest32
86    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.3
87    BR killed $x10
88
89  bb.8:
90    ; First destination is 2^20 after reference. Compressed table cannot reach it.
91    dead $xzr = SPACE 1048560, undef $xzr
92
93  bb.9:
94    ; First destination is 2^20 before reference. Just within reach of ADR.
95    dead $xzr = SPACE 1048576, undef $xzr
96
97  bb.10:
98    ; CHECK-LABEL: bb.10
99    ; CHECK: JumpTableDest8
100    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.4
101    BR killed $x10
102
103  bb.11:
104    ; First destination is 2^20 before reference. Just within reach of ADR.
105    dead $xzr = SPACE 1048580, undef $xzr
106
107  bb.12:
108    ; CHECK-LABEL: bb.12
109    ; CHECK: JumpTableDest32
110    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.5
111    BR killed $x10
112...
113