mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
3ad7648361
Extend FixupStatepointCallerSaved pass with ability to spill statepoint GC pointer arguments (optionally allowing them on CSRs). Special handling is required for invoke statepoints, because at MI level single landing pad may be shared by multiple statepoints, so we must ensure we spill landing pad's live-ins into the same stack slots. Full statepoint refactoring change set is available at D81603. Reviewed By: skatkov Differential Revision: https://reviews.llvm.org/D81647
146 lines
6.2 KiB
YAML
146 lines
6.2 KiB
YAML
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
|
|
# RUN: llc -o - %s -fixup-allow-gcptr-in-csr=false -run-pass fixup-statepoint-caller-saved | FileCheck %s
|
|
|
|
--- |
|
|
; ModuleID = 'test/CodeGen/X86/statepoint-fixup-invoke.mir'
|
|
source_filename = "test/CodeGen/X86/statepoint-fixup-invoke.mir"
|
|
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 void @some_call(i64 addrspace(1)*)
|
|
|
|
declare i32 @personality_function()
|
|
|
|
define i64 addrspace(1)* @test_basic(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1) gc "statepoint-example" personality i32 ()* @personality_function {
|
|
entry:
|
|
%0 = invoke token (i64, i32, void (i64 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 0, i32 0, void (i64 addrspace(1)*)* @some_call, i32 1, i32 0, i64 addrspace(1)* %obj, i32 0, i32 0) [ "gc-live"(i64 addrspace(1)* %obj, i64 addrspace(1)* %obj1), "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
|
to label %invoke_safepoint_normal_dest unwind label %exceptional_return
|
|
|
|
invoke_safepoint_normal_dest: ; preds = %entry
|
|
%obj.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 0, i32 0) ; (%obj, %obj)
|
|
%obj1.relocated = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %0, i32 1, i32 1) ; (%obj1, %obj1)
|
|
br label %normal_return
|
|
|
|
normal_return: ; preds = %invoke_safepoint_normal_dest
|
|
ret i64 addrspace(1)* %obj.relocated
|
|
|
|
exceptional_return: ; preds = %entry
|
|
%landing_pad = landingpad token
|
|
cleanup
|
|
%obj.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 0, i32 0) ; (%obj, %obj)
|
|
%obj1.relocated1 = call coldcc i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token %landing_pad, i32 1, i32 1) ; (%obj1, %obj1)
|
|
ret i64 addrspace(1)* %obj1.relocated1
|
|
}
|
|
|
|
declare token @llvm.experimental.gc.statepoint.p0f_isVoidp1i64f(i64 immarg, i32 immarg, void (i64 addrspace(1)*)*, i32 immarg, i32 immarg, ...)
|
|
|
|
; Function Attrs: nounwind readonly
|
|
declare i64 addrspace(1)* @llvm.experimental.gc.relocate.p1i64(token, i32 immarg, i32 immarg) #0
|
|
|
|
; Function Attrs: nounwind
|
|
declare void @llvm.stackprotector(i8*, i8**) #1
|
|
|
|
attributes #0 = { nounwind readonly }
|
|
attributes #1 = { nounwind }
|
|
|
|
...
|
|
---
|
|
name: test_basic
|
|
alignment: 16
|
|
exposesReturnsTwice: false
|
|
legalized: false
|
|
regBankSelected: false
|
|
selected: false
|
|
failedISel: false
|
|
tracksRegLiveness: true
|
|
hasWinCFI: false
|
|
registers: []
|
|
liveins:
|
|
- { reg: '$rdi', virtual-reg: '' }
|
|
- { reg: '$rsi', virtual-reg: '' }
|
|
frameInfo:
|
|
isFrameAddressTaken: false
|
|
isReturnAddressTaken: false
|
|
hasStackMap: false
|
|
hasPatchPoint: false
|
|
stackSize: 0
|
|
offsetAdjustment: 0
|
|
maxAlignment: 1
|
|
adjustsStack: false
|
|
hasCalls: true
|
|
stackProtector: ''
|
|
maxCallFrameSize: 4294967295
|
|
cvBytesOfCalleeSavedRegisters: 0
|
|
hasOpaqueSPAdjustment: false
|
|
hasVAStart: false
|
|
hasMustTailInVarArgFunc: false
|
|
localFrameSize: 0
|
|
savePoint: ''
|
|
restorePoint: ''
|
|
fixedStack: []
|
|
stack: []
|
|
callSites: []
|
|
constants: []
|
|
machineFunctionInfo: {}
|
|
body: |
|
|
; CHECK-LABEL: name: test_basic
|
|
; CHECK: bb.0.entry:
|
|
; CHECK: successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
|
|
; CHECK: liveins: $rdi, $rsi
|
|
; CHECK-DAG: MOV64mr %stack.0, 1, $noreg, 0, $noreg, $rsi :: (store 8 into %stack.0)
|
|
; CHECK-DAG: MOV64mr %stack.1, 1, $noreg, 0, $noreg, $rdi :: (store 8 into %stack.1)
|
|
; CHECK: EH_LABEL <mcsymbol .Ltmp0>
|
|
; CHECK: ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
|
|
; CHECK: STATEPOINT 0, 0, 1, @some_call, $rdi, 2, 0, 2, 0, 2, 5, 2, 0, 2, -1, 2, 0, 2, 0, 2, 0, 1, 8, %stack.0, 0, 1, 8, %stack.0, 0, 1, 8, %stack.1, 0, 1, 8, %stack.1, 0, csr_64, implicit-def $rsp, implicit-def $ssp :: (load store 8 on %stack.1), (load store 8 on %stack.0)
|
|
; CHECK-DAG: $r14 = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load 8 from %stack.0)
|
|
; CHECK-DAG: $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load 8 from %stack.1)
|
|
; CHECK: ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
|
|
; CHECK: EH_LABEL <mcsymbol .Ltmp1>
|
|
; CHECK: JMP_1 %bb.1
|
|
; CHECK: bb.1.invoke_safepoint_normal_dest:
|
|
; CHECK: successors: %bb.2(0x80000000)
|
|
; CHECK: liveins: $rbx
|
|
; CHECK: bb.2.normal_return:
|
|
; CHECK: liveins: $rbx
|
|
; CHECK: $rax = COPY killed renamable $rbx
|
|
; CHECK: RET 0, $rax
|
|
; CHECK: bb.3.exceptional_return (landing-pad):
|
|
; CHECK: liveins: $rax, $rdx, $r14
|
|
; CHECK: EH_LABEL <mcsymbol .Ltmp2>
|
|
; CHECK-DAG: $r14 = MOV64rm %stack.0, 1, $noreg, 0, $noreg :: (load 8 from %stack.0)
|
|
; CHECK-DAG: $rbx = MOV64rm %stack.1, 1, $noreg, 0, $noreg :: (load 8 from %stack.1)
|
|
; CHECK: $rax = COPY killed renamable $r14
|
|
; CHECK: RET 0, $rax
|
|
bb.0.entry:
|
|
successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
|
|
liveins: $rdi, $rsi
|
|
|
|
renamable $r14 = COPY $rsi
|
|
renamable $rbx = COPY $rdi
|
|
EH_LABEL <mcsymbol .Ltmp0>
|
|
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
|
|
renamable $r14, renamable $rbx = STATEPOINT 0, 0, 1, @some_call, $rdi, 2, 0, 2, 0, 2, 5, 2, 0, 2, -1, 2, 0, 2, 0, 2, 0, killed renamable $r14, renamable $r14(tied-def 0), killed renamable $rbx, renamable $rbx(tied-def 1), csr_64, implicit-def $rsp, implicit-def $ssp
|
|
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp
|
|
EH_LABEL <mcsymbol .Ltmp1>
|
|
JMP_1 %bb.1
|
|
|
|
bb.1.invoke_safepoint_normal_dest:
|
|
successors: %bb.2(0x80000000)
|
|
liveins: $rbx
|
|
|
|
|
|
bb.2.normal_return:
|
|
liveins: $rbx
|
|
|
|
$rax = COPY killed renamable $rbx
|
|
RET 0, $rax
|
|
|
|
bb.3.exceptional_return (landing-pad):
|
|
liveins: $rax, $rdx, $r14
|
|
|
|
EH_LABEL <mcsymbol .Ltmp2>
|
|
$rax = COPY killed renamable $r14
|
|
RET 0, $rax
|
|
|
|
...
|