reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
  163
  164
  165
  166
  167
  168
  169
# RUN: llc -mtriple=aarch64--- -run-pass=prologepilog -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
--- |

  @x = common global i32 0, align 4

  define void @baz() #0 {
    ret void
  }

  define i32 @main() #0 {
    ret i32 0
  }

  define void @bar(i32 %a) #0 {
    ret void
  }

  attributes #0 = { noinline noredzone "no-frame-pointer-elim"="true" }
...
---
# This test ensures that we
# - Create outlined functions
# - Don't outline anything to do with LR or W30
# - Save LR when it's not available
# - Functions whose addresses are taken can still be outlined
#
# CHECK-LABEL: main
# CHECK-LABEL: bb.1:
# CHECK-DAG: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]]
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG:[0-9]+]], 0
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
# CHECK-NEXT: $lr = ORRXri $xzr, 1

# CHECK-DAG: bb.2
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 0
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
# CHECK-NEXT: $lr = ORRXri $xzr, 1

# CHECK-DAG: bb.3
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
# CHECK-NEXT: $lr = ORRXrs $xzr, $x[[REG]], 0
# CHECK-NEXT: STRHHroW $w12, $x9, $w30, 1, 1
# CHECK-NEXT: $lr = ORRXri $xzr, 1
name:            main
tracksRegLiveness: true
body:             |
  bb.0:
  liveins: $lr
    $sp = frame-setup SUBXri $sp, 16, 0
    renamable $x9 = ADRP target-flags(aarch64-page) @bar
    $x9 = ORRXri $xzr, 1
    $w12 = ORRWri $wzr, 1
    $w30 = ORRWri $wzr, 1
    $lr = ORRXri $xzr, 1
  bb.1:
  liveins: $lr
    $x20, $x19 = LDPXi $sp, 10
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    renamable $x9 = ADRP target-flags(aarch64-page) @x
    $x12 = ADDXri $sp, 48, 0;
    STRHHroW $w12, $x9, $w30, 1, 1
    $lr = ORRXri $xzr, 1
  bb.2:
  liveins: $lr
    $x20, $x19 = LDPXi $sp, 10
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    renamable $x9 = ADRP target-flags(aarch64-page) @x
    $x12 = ADDXri $sp, 48, 0;
    STRHHroW $w12, $x9, $w30, 1, 1
    $lr = ORRXri $xzr, 1
  bb.3:
  liveins: $lr
    $x20, $x19 = LDPXi $sp, 10
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    $w12 = ORRWri $wzr, 1
    renamable $x9 = ADRP target-flags(aarch64-page) @x
    $x12 = ADDXri $sp, 48, 0;
    STRHHroW $w12, $x9, $w30, 1, 1
    $lr = ORRXri $xzr, 1
    $sp = ADDXri $sp, 16, 0
  bb.4:
  liveins: $lr
    RET undef $lr

...
---
# This test ensures that we can avoid saving LR when it's available.
# It also makes sure that KILL instructions don't impact outlining.
# CHECK-LABEL: bb.1:
# CHECK-NOT: BL @baz, implicit-def dead $lr, implicit $sp
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def $lr, implicit $sp
# CHECK-NEXT: $w11 = ORRWri $wzr, 2
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def $lr, implicit $sp
# CHECK-NEXT: $w8 = ORRWri $wzr, 0
# CHECK-NOT: $w11 = KILL renamable $w11, implicit killed $w11
name:            bar
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $w0, $lr, $w8
    $sp = frame-setup SUBXri $sp, 32, 0
    $fp = frame-setup ADDXri $sp, 16, 0

  bb.1:
    BL @baz, implicit-def dead $lr, implicit $sp
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    $w11 = KILL renamable $w11, implicit killed $w11
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    BL @baz, implicit-def dead $lr, implicit $sp
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 2
    BL @baz, implicit-def dead $lr, implicit $sp
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    BL @baz, implicit-def dead $lr, implicit $sp
    $w11 = ORRWri $wzr, 1
    $w11 = ORRWri $wzr, 1
    $w8 = ORRWri $wzr, 0

  bb.2:
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $x15 = ADDXri $sp, 48, 0;
    $w9 = ORRWri $wzr, 0
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $w15 = ORRWri $wzr, 1
    $x15 = ADDXri $sp, 48, 0;
    $w8 = ORRWri $wzr, 0

  bb.3:
    $fp, $lr = LDPXi $sp, 2
    $sp = ADDXri $sp, 32, 0
    RET undef $lr

...
---
name:            baz
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $w0, $lr, $w8
    RET undef $lr

# CHECK-LABEL: name:            OUTLINED_FUNCTION_{{[0-9]}}
# CHECK=LABEL: name:            OUTLINED_FUNCTION_{{[1-9]}}