mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
5c7f7462e4
This changes the shape of the statepoint intrinsic from: @llvm.experimental.gc.statepoint(anyptr target, i32 # call args, i32 unused, ...call args, i32 # deopt args, ...deopt args, ...gc args) to: @llvm.experimental.gc.statepoint(anyptr target, i32 # call args, i32 flags, ...call args, i32 # transition args, ...transition args, i32 # deopt args, ...deopt args, ...gc args) This extension offers the backend the opportunity to insert (somewhat) arbitrary code to manage the transition from GC-aware code to code that is not GC-aware and back. In order to support the injection of transition code, this extension wraps the STATEPOINT ISD node generated by the usual lowering lowering with two additional nodes: GC_TRANSITION_START and GC_TRANSITION_END. The transition arguments that were passed passed to the intrinsic (if any) are lowered and provided as operands to these nodes and may be used by the backend during code generation. Eventually, the lowering of the GC_TRANSITION_{START,END} nodes should be informed by the GC strategy in use for the function containing the intrinsic call; for now, these nodes are instead replaced with no-ops. Differential Revision: http://reviews.llvm.org/D9501 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236888 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
1.3 KiB
LLVM
35 lines
1.3 KiB
LLVM
; RUN: opt -print-memderefs -analyze -S <%s | FileCheck %s
|
|
|
|
; Uses the print-deref (+ analyze to print) pass to run
|
|
; isDereferenceablePointer() on many load instruction operands
|
|
|
|
target datalayout = "e"
|
|
|
|
declare zeroext i1 @return_i1()
|
|
|
|
@globalstr = global [6 x i8] c"hello\00"
|
|
|
|
define void @test(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
|
|
; CHECK: The following are dereferenceable:
|
|
; CHECK: %globalptr
|
|
; CHECK: %alloca
|
|
; CHECK: %dparam
|
|
; CHECK: %relocate
|
|
; CHECK-NOT: %nparam
|
|
entry:
|
|
%globalptr = getelementptr inbounds [6 x i8], [6 x i8]* @globalstr, i32 0, i32 0
|
|
%load1 = load i8, i8* %globalptr
|
|
%alloca = alloca i1
|
|
%load2 = load i1, i1* %alloca
|
|
%load3 = load i32, i32 addrspace(1)* %dparam
|
|
%tok = tail call i32 (i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
|
|
%relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 5, i32 5)
|
|
%load4 = load i32, i32 addrspace(1)* %relocate
|
|
%nparam = getelementptr i32, i32 addrspace(1)* %dparam, i32 5
|
|
%load5 = load i32, i32 addrspace(1)* %nparam
|
|
ret void
|
|
}
|
|
|
|
declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...)
|
|
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
|