aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/RISCV/stack-probing-frame-setup.mir
blob: 9ab7f41045c4df213c4dd9245401f11523dbfe41 (plain)
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
# RUN: llc -mtriple=riscv64 -x mir -run-pass=prologepilog  -verify-machineinstrs < %s \
# RUN:  | FileCheck %s -check-prefixes=RV64I
# RUN: llc -mtriple=riscv32 -x mir -run-pass=prologepilog  -verify-machineinstrs < %s \
# RUN:  | FileCheck %s -check-prefixes=RV32I
--- |
  ; Function Attrs: uwtable
  define void @no_reserved_call_frame(i64 %n) #0 {
  entry:
    %v = alloca i32, i64 %n, align 4
    call void @callee_stack_args(ptr %v, [518 x i64] poison)
    ret void
  }

  declare void @callee_stack_args(ptr, [518 x i64]) #1

  attributes #0 = { uwtable "frame-pointer"="none" "probe-stack"="inline-asm" "target-features"="+m" }
  attributes #1 = { "target-features"="+m" }
...
---
name:            no_reserved_call_frame
alignment:       4
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
hasWinCFI:       false
noPhis:          true
isSSA:           false
noVRegs:         true
hasFakeUses:     false
callsEHReturn:   false
callsUnwindInit: false
hasEHContTarget: false
hasEHScopes:     false
hasEHFunclets:   false
isOutlined:      false
debugInstrRef:   false
failsVerification: false
tracksDebugUserValues: true
registers:       []
liveins:
  - { reg: '$x10', virtual-reg: '' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    8
  adjustsStack:    true
  hasCalls:        true
  stackProtector:  ''
  functionContext: ''
  maxCallFrameSize: 4294967295
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  hasTailCall:     false
  isCalleeSavedInfoValid: false
  localFrameSize:  0
  savePoint:       ''
  restorePoint:    ''
fixedStack:      []
stack:
  - { id: 0, name: v, type: variable-sized, offset: 0, alignment: 1, stack-id: default,
      callee-saved-register: '', callee-saved-restored: true, local-offset: 0,
      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
entry_values:    []
callSites:       []
debugValueSubstitutions: []
constants:       []
machineFunctionInfo:
  varArgsFrameIndex: 0
  varArgsSaveSize: 0
body:             |
  ; RV64I-LABEL: name: no_reserved_call_frame
  ; RV64I: bb.0.entry:
  ; RV64I-NEXT:   successors: %bb.1(0x80000000)
  ; RV64I-NEXT:   liveins: $x10, $x1
  ; RV64I-NEXT: {{  $}}
  ; RV64I-NEXT:   $x2 = frame-setup ADDI $x2, -16
  ; RV64I-NEXT:   frame-setup CFI_INSTRUCTION def_cfa_offset 16
  ; RV64I-NEXT:   frame-setup SD killed $x1, $x2, 8 :: (store (s64) into %stack.1)
  ; RV64I-NEXT:   frame-setup SD killed $x8, $x2, 0 :: (store (s64) into %stack.2)
  ; RV64I-NEXT:   frame-setup CFI_INSTRUCTION offset $x1, -8
  ; RV64I-NEXT:   frame-setup CFI_INSTRUCTION offset $x8, -16
  ; RV64I-NEXT:   $x8 = frame-setup ADDI $x2, 16
  ; RV64I-NEXT:   frame-setup CFI_INSTRUCTION def_cfa $x8, 0
  ; RV64I-NEXT:   renamable $x10 = SLLI killed renamable $x10, 2
  ; RV64I-NEXT:   renamable $x10 = nuw ADDI killed renamable $x10, 15
  ; RV64I-NEXT:   renamable $x10 = ANDI killed renamable $x10, -16
  ; RV64I-NEXT:   renamable $x10 = SUB $x2, killed renamable $x10
  ; RV64I-NEXT:   renamable $x11 = LUI 1
  ; RV64I-NEXT: {{  $}}
  ; RV64I-NEXT: bb.1.entry:
  ; RV64I-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
  ; RV64I-NEXT:   liveins: $x10, $x11
  ; RV64I-NEXT: {{  $}}
  ; RV64I-NEXT:   $x2 = SUB $x2, renamable $x11
  ; RV64I-NEXT:   SD $x0, $x2, 0
  ; RV64I-NEXT:   BLT renamable $x10, $x2, %bb.1
  ; RV64I-NEXT: {{  $}}
  ; RV64I-NEXT: bb.2.entry:
  ; RV64I-NEXT:   liveins: $x10
  ; RV64I-NEXT: {{  $}}
  ; RV64I-NEXT:   $x2 = ADDI renamable $x10, 0
  ; RV64I-NEXT:   $x11 = LUI 1
  ; RV64I-NEXT:   $x2 = SUB $x2, killed $x11
  ; RV64I-NEXT:   PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2
  ; RV64I-NEXT:   $x10 = LUI 1
  ; RV64I-NEXT:   $x2 = ADD $x2, killed $x10
  ; RV64I-NEXT:   $x2 = frame-destroy ADDI $x8, -16
  ; RV64I-NEXT:   frame-destroy CFI_INSTRUCTION def_cfa $x2, 16
  ; RV64I-NEXT:   $x1 = frame-destroy LD $x2, 8 :: (load (s64) from %stack.1)
  ; RV64I-NEXT:   $x8 = frame-destroy LD $x2, 0 :: (load (s64) from %stack.2)
  ; RV64I-NEXT:   frame-destroy CFI_INSTRUCTION restore $x1
  ; RV64I-NEXT:   frame-destroy CFI_INSTRUCTION restore $x8
  ; RV64I-NEXT:   $x2 = frame-destroy ADDI $x2, 16
  ; RV64I-NEXT:   frame-destroy CFI_INSTRUCTION def_cfa_offset 0
  ; RV64I-NEXT:   PseudoRET
  ;
  ; RV32I-LABEL: name: no_reserved_call_frame
  ; RV32I: bb.0.entry:
  ; RV32I-NEXT:   successors: %bb.1(0x80000000)
  ; RV32I-NEXT:   liveins: $x10, $x1
  ; RV32I-NEXT: {{  $}}
  ; RV32I-NEXT:   $x2 = frame-setup ADDI $x2, -16
  ; RV32I-NEXT:   frame-setup CFI_INSTRUCTION def_cfa_offset 16
  ; RV32I-NEXT:   frame-setup SW killed $x1, $x2, 12 :: (store (s32) into %stack.1)
  ; RV32I-NEXT:   frame-setup SW killed $x8, $x2, 8 :: (store (s32) into %stack.2)
  ; RV32I-NEXT:   frame-setup CFI_INSTRUCTION offset $x1, -4
  ; RV32I-NEXT:   frame-setup CFI_INSTRUCTION offset $x8, -8
  ; RV32I-NEXT:   $x8 = frame-setup ADDI $x2, 16
  ; RV32I-NEXT:   frame-setup CFI_INSTRUCTION def_cfa $x8, 0
  ; RV32I-NEXT:   renamable $x10 = SLLI killed renamable $x10, 2
  ; RV32I-NEXT:   renamable $x10 = nuw ADDI killed renamable $x10, 15
  ; RV32I-NEXT:   renamable $x10 = ANDI killed renamable $x10, -16
  ; RV32I-NEXT:   renamable $x10 = SUB $x2, killed renamable $x10
  ; RV32I-NEXT:   renamable $x11 = LUI 1
  ; RV32I-NEXT: {{  $}}
  ; RV32I-NEXT: bb.1.entry:
  ; RV32I-NEXT:   successors: %bb.2(0x40000000), %bb.1(0x40000000)
  ; RV32I-NEXT:   liveins: $x10, $x11
  ; RV32I-NEXT: {{  $}}
  ; RV32I-NEXT:   $x2 = SUB $x2, renamable $x11
  ; RV32I-NEXT:   SD $x0, $x2, 0
  ; RV32I-NEXT:   BLT renamable $x10, $x2, %bb.1
  ; RV32I-NEXT: {{  $}}
  ; RV32I-NEXT: bb.2.entry:
  ; RV32I-NEXT:   liveins: $x10
  ; RV32I-NEXT: {{  $}}
  ; RV32I-NEXT:   $x2 = ADDI renamable $x10, 0
  ; RV32I-NEXT:   $x11 = LUI 1
  ; RV32I-NEXT:   $x2 = SUB $x2, killed $x11
  ; RV32I-NEXT:   PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2
  ; RV32I-NEXT:   $x10 = LUI 1
  ; RV32I-NEXT:   $x2 = ADD $x2, killed $x10
  ; RV32I-NEXT:   $x2 = frame-destroy ADDI $x8, -16
  ; RV32I-NEXT:   frame-destroy CFI_INSTRUCTION def_cfa $x2, 16
  ; RV32I-NEXT:   $x1 = frame-destroy LW $x2, 12 :: (load (s32) from %stack.1)
  ; RV32I-NEXT:   $x8 = frame-destroy LW $x2, 8 :: (load (s32) from %stack.2)
  ; RV32I-NEXT:   frame-destroy CFI_INSTRUCTION restore $x1
  ; RV32I-NEXT:   frame-destroy CFI_INSTRUCTION restore $x8
  ; RV32I-NEXT:   $x2 = frame-destroy ADDI $x2, 16
  ; RV32I-NEXT:   frame-destroy CFI_INSTRUCTION def_cfa_offset 0
  ; RV32I-NEXT:   PseudoRET
  bb.0.entry:
    successors: %bb.1(0x80000000)
    liveins: $x10

    renamable $x10 = SLLI killed renamable $x10, 2
    renamable $x10 = nuw ADDI killed renamable $x10, 15
    renamable $x10 = ANDI killed renamable $x10, -16
    renamable $x10 = SUB $x2, killed renamable $x10
    renamable $x11 = LUI 1

  bb.1.entry:
    successors: %bb.2(0x40000000), %bb.1(0x40000000)
    liveins: $x10, $x11

    $x2 = SUB $x2, renamable $x11
    SD $x0, $x2, 0
    BLT renamable $x10, $x2, %bb.1

  bb.2.entry:
    liveins: $x10

    $x2 = ADDI renamable $x10, 0
    ADJCALLSTACKDOWN 4088, 0, implicit-def dead $x2, implicit $x2
    PseudoCALL target-flags(riscv-call) @callee_stack_args, csr_ilp32_lp64, implicit-def dead $x1, implicit $x10, implicit undef $x11, implicit undef $x12, implicit undef $x13, implicit undef $x14, implicit undef $x15, implicit undef $x16, implicit undef $x17, implicit-def $x2
    ADJCALLSTACKUP 4088, 0, implicit-def dead $x2, implicit $x2
    PseudoRET
...