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
# RUN: llc -o - %s -mtriple=aarch64-windows -start-before=prologepilog \
# RUN:   -stop-after=prologepilog | FileCheck %s
# Test that stack probe results in Nop unwind codes in the prologue.  Test
# save_fplr, save_reg_x and stack_alloc with multiple updates

# CHECK:      early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -2
# CHECK-NEXT: frame-setup SEH_SaveFPLR_X -16
# CHECK-NEXT: $fp = frame-setup ADDXri $sp, 0, 0
# CHECK-NEXT: frame-setup SEH_SetFP
# CHECK-NEXT: $sp = frame-setup SUBXri $sp, 32, 0
# CHECK-NEXT: frame-setup SEH_StackAlloc 32
# CHECK-NEXT: frame-setup SEH_PrologEnd
# CHECK:      frame-destroy SEH_EpilogStart
# CHECK-NEXT: $sp = frame-destroy ADDXri $fp, 0, 0
# CHECK-NEXT: frame-destroy SEH_SetFP
# CHECK-NEXT: early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2
# CHECK-NEXT: frame-destroy SEH_SaveFPLR_X -16
# CHECK-NEXT: frame-destroy SEH_EpilogEnd
# CHECK-NEXT: RET_ReallyLR implicit killed $w0
--- |
  target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-unknown-windows-msvc19.11.0"

  ; Function Attrs: noinline optnone
  define dso_local i32 @"?func@@YAHHHHH@Z"(i32 %n, i32 %idx, i32 %b, i32 %c) #0 {
  entry:
    %c.addr = alloca i32, align 4
    %b.addr = alloca i32, align 4
    %idx.addr = alloca i32, align 4
    %n.addr = alloca i32, align 4
    %a = alloca i32*, align 8
    store i32 %c, i32* %c.addr, align 4
    store i32 %b, i32* %b.addr, align 4
    store i32 %idx, i32* %idx.addr, align 4
    store i32 %n, i32* %n.addr, align 4
    %0 = load i32, i32* %n.addr, align 4
    %conv = sext i32 %0 to i64
    %1 = alloca i8, i64 %conv, align 16
    %2 = bitcast i8* %1 to i32*
    store i32* %2, i32** %a, align 8
    %3 = load i32*, i32** %a, align 8
    call void @"?init@@YAXPEAH@Z"(i32* %3)
    ret i32 0
  }

  declare dso_local void @"?init@@YAXPEAH@Z"(i32*) #1

  ; Function Attrs: nounwind
  declare void @llvm.stackprotector(i8*, i8**) #2

  attributes #0 = { noinline optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
  attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
  attributes #2 = { nounwind }

...
---
name:            '?func@@YAHHHHH@Z'
alignment:       4
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
hasWinCFI:       false
registers:
liveins:
  - { reg: '$w0', virtual-reg: '' }
  - { reg: '$w1', virtual-reg: '' }
  - { reg: '$w2', virtual-reg: '' }
  - { reg: '$w3', virtual-reg: '' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    8
  adjustsStack:    true
  hasCalls:        true
  stackProtector:  ''
  maxCallFrameSize: 0
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  24
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
  - { id: 0, name: c.addr, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -4, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 1, name: b.addr, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -8, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 2, name: idx.addr, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -12, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 3, name: n.addr, type: default, offset: 0, size: 4, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -16, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 4, name: a, type: default, offset: 0, size: 8, alignment: 8,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -24, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 5, name: '', type: variable-sized, offset: 0,
      alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -24, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
  - { id: 6, name: '', type: spill-slot, offset: 0, size: 8, alignment: 8,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
constants:
body:             |
  bb.0.entry:
    liveins: $w0, $w1, $w2, $w3

    STRWui killed renamable $w3, %stack.0.c.addr, 0 :: (store 4 into %ir.c.addr)
    STRWui killed renamable $w2, %stack.1.b.addr, 0 :: (store 4 into %ir.b.addr)
    STRWui killed renamable $w1, %stack.2.idx.addr, 0 :: (store 4 into %ir.idx.addr)
    STRWui killed renamable $w0, %stack.3.n.addr, 0 :: (store 4 into %ir.n.addr)
    renamable $x8 = LDRSWui %stack.3.n.addr, 0 :: (dereferenceable load 4 from %ir.n.addr)
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    renamable $x8 = nuw ADDXri killed renamable $x8, 15, 0
    renamable $x8 = UBFMXri killed renamable $x8, 4, 63
    $x15 = COPY renamable $x8
    STRXui killed $x8, %stack.6, 0 :: (store 8 into %stack.6)
    BL &__chkstk, csr_aarch64_stackprobe_windows, implicit-def dead $lr, implicit $sp, implicit killed $x15
    renamable $x8 = COPY $sp
    $x15 = LDRXui %stack.6, 0 :: (load 8 from %stack.6)
    renamable $x8 = SUBSXrs killed renamable $x8, killed renamable $x15, 4, implicit-def dead $nzcv
    $sp = COPY renamable $x8
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    STRXui killed renamable $x8, %stack.4.a, 0 :: (store 8 into %ir.a)
    renamable $x0 = LDRXui %stack.4.a, 0 :: (dereferenceable load 8 from %ir.a)
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    BL @"?init@@YAXPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    renamable $w1 = COPY $wzr
    $w0 = COPY killed renamable $w1
    RET_ReallyLR implicit killed $w0

...