File: cfi-inserter-basic-block-sections-callee-save-registers.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,245,064 kB
  • sloc: cpp: 7,619,731; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,676; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (53 lines) | stat: -rw-r--r-- 2,041 bytes parent folder | download | duplicates (17)
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
;; This test checks if CFI instructions for all callee saved registers are emitted
;; correctly with basic block sections.
; RUN: llc  %s -mtriple=x86_64 -filetype=asm --basic-block-sections=all --frame-pointer=all -o - | FileCheck --check-prefix=SECTIONS_CFI %s

; SECTIONS_CFI:       _Z3foob:
; SECTIONS_CFI:      .cfi_offset %rbp, -16
; SECTIONS_CFI:      .cfi_offset [[RA:%r.+]], -56
; SECTIONS_CFI-NEXT: .cfi_offset [[RB:%r.+]], -48
; SECTIONS_CFI-NEXT: .cfi_offset [[RC:%r.+]], -40
; SECTIONS_CFI-NEXT: .cfi_offset [[RD:%r.+]], -32
; SECTIONS_CFI-NEXT: .cfi_offset [[RE:%r.+]], -24

; SECTIONS_CFI:      _Z3foob.__part.1:
; SECTIONS_CFI:      .cfi_offset %rbp, -16
; SECTIONS_CFI:      .cfi_offset [[RA]], -56
; SECTIONS_CFI-NEXT: .cfi_offset [[RB]], -48
; SECTIONS_CFI-NEXT: .cfi_offset [[RC]], -40
; SECTIONS_CFI-NEXT: .cfi_offset [[RD]], -32
; SECTIONS_CFI-NEXT: .cfi_offset [[RE]], -24

; SECTIONS_CFI:      _Z3foob.__part.2:
; SECTIONS_CFI:      .cfi_offset %rbp, -16
; SECTIONS_CFI:      .cfi_offset [[RA]], -56
; SECTIONS_CFI-NEXT: .cfi_offset [[RB]], -48
; SECTIONS_CFI-NEXT: .cfi_offset [[RC]], -40
; SECTIONS_CFI-NEXT: .cfi_offset [[RD]], -32
; SECTIONS_CFI-NEXT: .cfi_offset [[RE]], -24


;; void foo(bool b) {
;;   if (b) // adds a basic block
;;     // clobber all callee-save registers to force them to be callee-saved and to
;;     // be described by cfi_offset directives.
;;     asm("nop" ::: "r12", "r13", "r14", "r15", "rbx");
;; }

define dso_local void @_Z3foob(i1 zeroext %b) {
entry:
  %b.addr = alloca i8, align 1
  %frombool = zext i1 %b to i8
  store i8 %frombool, ptr %b.addr, align 1
  %0 = load i8, ptr %b.addr, align 1
  %tobool = trunc i8 %0 to i1
  br i1 %tobool, label %if.then, label %if.end

if.then:                                          ; preds = %entry
  call void asm sideeffect "nop", "~{r12},~{r13},~{r14},~{r15},~{rbx},~{dirflag},~{fpsr},~{flags}"() #1, !srcloc !2
  br label %if.end

if.end:                                           ; preds = %if.then, %entry
  ret void
}
!2 = !{i32 38}