File: out-of-reach-emergency-slot.mir

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-16
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,496,368 kB
  • sloc: cpp: 5,593,980; ansic: 986,873; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,547; xml: 953; cs: 573; fortran: 567
file content (78 lines) | stat: -rw-r--r-- 2,986 bytes parent folder | download | duplicates (4)
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
# NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
# REQUIRES: asserts
# RUN: llc -mtriple riscv64 -start-before=prologepilog -o - \
# RUN:     -verify-machineinstrs %s | FileCheck %s
#
# RUN: llc -mtriple riscv64 -start-before=prologepilog -o /dev/null \
# RUN:     -debug-only=prologepilog -verify-machineinstrs %s 2>&1 \
# RUN:     | FileCheck --check-prefix=DEBUG %s
#
# DEBUG: Adjusting emergency spill slots!
# DEBUG: Adjusting offset of emergency spill slot #4 from -4112 to -8192

--- |
  ; ModuleID = 'reduced.ll'
  source_filename = "frame_layout-1253b1.cpp"
  target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
  target triple = "riscv64"

  ; Function Attrs: nounwind
  define weak_odr dso_local void @foo(i8* %ay) nounwind {
  ; CHECK-LABEL: foo:
  ; CHECK:       # %bb.0: # %entry
  ; CHECK-NEXT:    addi sp, sp, -2032
  ; CHECK-NEXT:    sd ra, 2024(sp) # 8-byte Folded Spill
  ; CHECK-NEXT:    sd s0, 2016(sp) # 8-byte Folded Spill
  ; CHECK-NEXT:    addi s0, sp, 2032
  ; CHECK-NEXT:    sd a1, 0(sp)
  ; CHECK-NEXT:    lui a1, 2
  ; CHECK-NEXT:    addiw a1, a1, -2032
  ; CHECK-NEXT:    sub sp, sp, a1
  ; CHECK-NEXT:    srli a1, sp, 12
  ; CHECK-NEXT:    slli sp, a1, 12
  ; CHECK-NEXT:    lui a1, 1
  ; CHECK-NEXT:    addiw a1, a1, -8
  ; CHECK-NEXT:    add a1, sp, a1
  ; CHECK-NEXT:    sd a0, 0(a1)
  ; CHECK-NEXT:    ld a1, 0(sp)
  ; CHECK-NEXT:    call foo@plt
  ; CHECK-NEXT:    lui a0, 2
  ; CHECK-NEXT:    sub sp, s0, a0
  ; CHECK-NEXT:    lui a0, 2
  ; CHECK-NEXT:    addiw a0, a0, -2032
  ; CHECK-NEXT:    add sp, sp, a0
  ; CHECK-NEXT:    ld ra, 2024(sp) # 8-byte Folded Reload
  ; CHECK-NEXT:    ld s0, 2016(sp) # 8-byte Folded Reload
  ; CHECK-NEXT:    addi sp, sp, 2032
  ; CHECK-NEXT:    ret
  entry:
    ret void
  }


...
---
name:            foo
alignment:       2
tracksRegLiveness: false
frameInfo:
  maxAlignment:    4096
stack:
  - { id: 0, size: 8, alignment: 4096 }
  - { id: 1, type: spill-slot, size: 8, alignment: 8 }
machineFunctionInfo: {}
body:             |
  bb.0.entry:
    liveins: $x1, $x5, $x6, $x7, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x28, $x29, $x30, $x31

    ; This is to store something to the (non-emergency) spill slot %stack.1.
    SD $x10, %stack.1, 0
    ; This is here just to make all the eligible registers live at this point.
    ; This way when we replace the frame index %stack.1 with its actual address
    ; we have to allocate a virtual register to compute it.
    ; A later run of the the register scavenger won't find an available register
    ; either so it will have to spill one to the emergency spill slot.
    PseudoCALL target-flags(riscv-plt) @foo, csr_ilp32_lp64, implicit-def $x1, implicit-def $x2, implicit $x1, implicit $x5, implicit $x6, implicit $x7, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit $x14, implicit $x15, implicit $x16, implicit $x17, implicit $x28, implicit $x29, implicit $x30, implicit $x31
    PseudoRET

...