File: branch.mir

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (114 lines) | stat: -rw-r--r-- 3,690 bytes parent folder | download | duplicates (3)
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
# RUN: llc %s -mtriple=m68k -start-after=prologepilog -O0 -filetype=obj \
# RUN:  -code-model=small -relocation-model=pic -o - \
# RUN:   | extract-section .text -h \
# RUN:   | FileCheck %s

#------------------------------------------------------------------------------
# Test branch relaxation. By default codegen choses smallest branch instruction,
# during object code generation it might get clear that offset does not fit and
# bigger instruction is required.
#------------------------------------------------------------------------------


--- # TIGHT
# The offset for the small branch is from the PC value, which points to the
# next instruction, because there is no extension word here.
# 000  CHECK:      6078
# 002  CHECK-SAME: 23f9 0000 0000 0000 0000
# 00C  CHECK-SAME: 23f9 0000 0000 0000 0000
# 016  CHECK-SAME: 23f9 0000 0000 0000 0000
# 020  CHECK-SAME: 23f9 0000 0000 0000 0000
# 02A  CHECK-SAME: 23f9 0000 0000 0000 0000
# 034  CHECK-SAME: 23f9 0000 0000 0000 0000
# 03E  CHECK-SAME: 23f9 0000 0000 0000 0000
# 048  CHECK-SAME: 23f9 0000 0000 0000 0000
# 052  CHECK-SAME: 23f9 0000 0000 0000 0000
# 05C  CHECK-SAME: 23f9 0000 0000 0000 0000
# 066  CHECK-SAME: 23f9 0000 0000 0000 0000
# 070  CHECK-SAME: 23f9 0000 0000 0000 0000
# 07A  CHECK-SAME: d0bc 0000 0000
# 080  CHECK-SAME: 4e75
name: TIGHT
body: |
  bb.0:
      successors: %bb.2

      BRA8 %bb.2
  bb.1:
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
  bb.2:
      $d0 = ADD32ri $d0, 0, implicit-def $ccr
      RET 0, $d0

...
--- # RELAXED
# 084  CHECK-SAME  6000 0084
# 088  CHECK-SAME: 23f9 0000 0000 0000 0000
# 092  CHECK-SAME: 23f9 0000 0000 0000 0000
# 09C  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0A6  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0B0  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0BA  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0C4  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0CE  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0D8  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0E2  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0EC  CHECK-SAME: 23f9 0000 0000 0000 0000
# 0F6  CHECK-SAME: 23f9 0000 0000 0000 0000
# 100  CHECK-SAME: 23f9 0000 0000 0000 0000
# 10A  CHECK-SAME: d0bc 0000 0000
# 110  CHECK-SAME: 4e75
name: RELAXED
body: |
  bb.0:
      successors: %bb.2

      BRA8 %bb.2
  bb.1:
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
      MOV32bb 0, 0, implicit-def $ccr
  bb.2:
      $d0 = ADD32ri $d0, 0, implicit-def $ccr
      RET 0, $d0

...
--- # ZERO
# Because of the way M68k encodes branches it is not possible to encode 0
# offset with the smallest insruction(0 in the offset field means exension word
# is used) thus we switch to the wider instruction.
# 114  CHECK-SAME: 6000 0002
# 118  CHECK-SAME: d0bc 0000 0000
# 11E  CHECK-SAME: 4e75
name: ZERO
body: |
  bb.0:
      successors: %bb.1

      BRA8 %bb.1
  bb.1:
      $d0 = ADD32ri $d0, 0, implicit-def $ccr
      RET 0, $d0

...