File: global_address_pic.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (62 lines) | stat: -rw-r--r-- 2,865 bytes parent folder | download | duplicates (25)
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
; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -relocation-model=pic -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32_PIC

declare i32 @f(i32 %a, i32 %b);

define internal i32 @f_with_local_linkage(i32 %x, i32 %y) {
  ; MIPS32_PIC-LABEL: name: f_with_local_linkage
  ; MIPS32_PIC: bb.1.entry:
  ; MIPS32_PIC:   liveins: $a0, $a1
  ; MIPS32_PIC:   [[COPY:%[0-9]+]]:_(s32) = COPY $a0
  ; MIPS32_PIC:   [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
  ; MIPS32_PIC:   [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY1]], [[COPY]]
  ; MIPS32_PIC:   $v0 = COPY [[ADD]](s32)
  ; MIPS32_PIC:   RetRA implicit $v0
entry:
  %add = add i32 %y, %x
  ret i32 %add
}

define i32 @call_global(i32 %a, i32 %b) {
  ; MIPS32_PIC-LABEL: name: call_global
  ; MIPS32_PIC: bb.1.entry:
  ; MIPS32_PIC:   liveins: $a0, $a1, $t9, $v0
  ; MIPS32_PIC:   [[ADDu:%[0-9]+]]:gpr32 = ADDu $v0, $t9
  ; MIPS32_PIC:   [[COPY:%[0-9]+]]:_(s32) = COPY $a0
  ; MIPS32_PIC:   [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
  ; MIPS32_PIC:   ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
  ; MIPS32_PIC:   [[GV:%[0-9]+]]:gpr32(p0) = G_GLOBAL_VALUE target-flags(mips-got-call) @f
  ; MIPS32_PIC:   $a0 = COPY [[COPY]](s32)
  ; MIPS32_PIC:   $a1 = COPY [[COPY1]](s32)
  ; MIPS32_PIC:   $gp = COPY [[ADDu]]
  ; MIPS32_PIC:   JALRPseudo [[GV]](p0), csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $gp, implicit-def $v0
  ; MIPS32_PIC:   [[COPY2:%[0-9]+]]:_(s32) = COPY $v0
  ; MIPS32_PIC:   ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
  ; MIPS32_PIC:   $v0 = COPY [[COPY2]](s32)
  ; MIPS32_PIC:   RetRA implicit $v0
entry:
  %call = call i32 @f(i32 %a, i32 %b)
  ret i32 %call
}

define i32 @call_global_with_local_linkage(i32 %a, i32 %b) {
  ; MIPS32_PIC-LABEL: name: call_global_with_local_linkage
  ; MIPS32_PIC: bb.1.entry:
  ; MIPS32_PIC:   liveins: $a0, $a1, $t9, $v0
  ; MIPS32_PIC:   [[ADDu:%[0-9]+]]:gpr32 = ADDu $v0, $t9
  ; MIPS32_PIC:   [[COPY:%[0-9]+]]:_(s32) = COPY $a0
  ; MIPS32_PIC:   [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
  ; MIPS32_PIC:   ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
  ; MIPS32_PIC:   [[GV:%[0-9]+]]:gpr32(p0) = G_GLOBAL_VALUE @f_with_local_linkage
  ; MIPS32_PIC:   $a0 = COPY [[COPY]](s32)
  ; MIPS32_PIC:   $a1 = COPY [[COPY1]](s32)
  ; MIPS32_PIC:   $gp = COPY [[ADDu]]
  ; MIPS32_PIC:   JALRPseudo [[GV]](p0), csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit-def $gp, implicit-def $v0
  ; MIPS32_PIC:   [[COPY2:%[0-9]+]]:_(s32) = COPY $v0
  ; MIPS32_PIC:   ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
  ; MIPS32_PIC:   $v0 = COPY [[COPY2]](s32)
  ; MIPS32_PIC:   RetRA implicit $v0
entry:
  %call = call i32 @f_with_local_linkage(i32 %a, i32 %b)
  ret i32 %call
}