File: statepoint-vreg-twoaddr.mir

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (94 lines) | stat: -rw-r--r-- 4,178 bytes parent folder | download | duplicates (5)
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
# RUN: llc -x mir -run-pass=twoaddressinstruction < %s | FileCheck %s

# This test checks that TwoAddressInstruction pass does not create redundate COPY
# instruction for STATEPOINT tied operands.

--- |
  ; ModuleID = 'statepoint-vreg-twoaddr.ll'
  source_filename = "statepoint-vreg-twoaddr.ll"
  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-pc-linux-gnu"

  declare i1 @return_i1()

  declare void @consume(ptr addrspace(1))
  declare void @consume1(ptr addrspace(1), ptr addrspace(1))

  define i1 @test_relocate(ptr addrspace(1) %a) gc "statepoint-example" {
  entry:
    %safepoint_token = tail call token (i64, i32, ptr, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0) [ "gc-live"(ptr addrspace(1) %a) ]
    %rel1 = call ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token %safepoint_token, i32 0, i32 0) ; (%a, %a)
    %res1 = call zeroext i1 @llvm.experimental.gc.result.i1(token %safepoint_token)
    call void @consume(ptr addrspace(1) %rel1)
    ret i1 %res1
  }

  define void @test_duplicate_gcregs(ptr addrspace(1) %a) gc "statepoint-example" {
    ret void
  }

  ; Function Attrs: nounwind readnone
  declare ptr addrspace(1) @llvm.experimental.gc.relocate.p1(token, i32 immarg, i32 immarg) #0

  declare token @llvm.experimental.gc.statepoint.p0(i64 immarg, i32 immarg, ptr, i32 immarg, i32 immarg, ...)

  ; Function Attrs: nounwind readnone
  declare i1 @llvm.experimental.gc.result.i1(token) #0

  attributes #0 = { nounwind readnone }

...
---
name:            test_relocate
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr64 }
  - { id: 1, class: gr64 }
  - { id: 2, class: gr8 }
machineFunctionInfo: {}
body:             |
  bb.0:
    liveins: $rdi

    ; CHECK-LABEL: name: test_relocate
    ; CHECK: [[VREG1:%[0-9]+]]:gr64 = COPY killed $rdi
    ; CHECK-NOT: [[VREG2:%[0-9]+]]:gr64 = COPY [[VREG1]]
    ; CHECK: [[VREG1]]:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 1, killed [[VREG1]](tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def $al
    ; CHECK: $rdi = COPY killed [[VREG1]]
    ; CHECK: CALL64pcrel32 target-flags(x86-plt) @consume, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp

    %0:gr64 = COPY killed $rdi
    %1:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 1, killed %0(tied-def 0), 2, 0, 2, 1, 0, 0, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def $al
    %2:gr8 = COPY killed $al
    $rdi = COPY killed %1
    CALL64pcrel32 target-flags(x86-plt) @consume, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def $rsp, implicit-def $ssp
    $al = COPY killed %2
    RET 0, killed $al

...
---
name:            test_duplicate_gcregs
alignment:       16
tracksRegLiveness: true
liveins:
  - { reg: '$rdi', virtual-reg: '%0' }
body:             |
  bb.0 (%ir-block.0):
    liveins: $rdi

    ; CHECK-LABEL: name: test_duplicate_gcregs
    ; CHECK:   %1:gr64 = COPY %0
    ; CHECK:   %2:gr64 = COPY %0
    ; CHECK:   %1:gr64, %2:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 2, %1(tied-def 0), %2(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, csr_64
    ; CHECK:   $rdi = COPY killed %1
    ; CHECK:   $rsi = COPY killed %2
    ; CHECK:   CALL64pcrel32 target-flags(x86-plt) @consume1, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rsp, implicit-def $ssp
    ; CHECK:   RET 0
    %0:gr64 = COPY killed $rdi
    %1:gr64, %2:gr64 = STATEPOINT 0, 0, 0, target-flags(x86-plt) @return_i1, 2, 0, 2, 0, 2, 0, 2, 2, killed %0(tied-def 0), killed %0(tied-def 1), 2, 0, 2, 2, 0, 0, 1, 1, csr_64, implicit-def $rsp, implicit-def $ssp, implicit-def dead $al
    $rdi = COPY killed %1
    $rsi = COPY killed %2
    CALL64pcrel32 target-flags(x86-plt) @consume1, csr_64, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit killed $rsi, implicit-def $rsp, implicit-def $ssp
    RET 0
...