Summary: This change adds two new parameters to the statepoint intrinsic, `i64 id` and `i32 num_patch_bytes`. `id` gets propagated to the ID field in the generated StackMap section. If the `num_patch_bytes` is non-zero then the statepoint is lowered to `num_patch_bytes` bytes of nops instead of a call (the spill and reload code remains unchanged). A non-zero `num_patch_bytes` is useful in situations where a language runtime requires complete control over how a call is lowered. This change brings statepoints one step closer to patchpoints. With some additional work (that is not part of this patch) it should be possible to get rid of `TargetOpcode::STATEPOINT` altogether. PlaceSafepoints generates `statepoint` wrappers with `id` set to `0xABCDEF00` (the old default value for the ID reported in the stackmap) and `num_patch_bytes` set to `0`. This can be made more sophisticated later. Reviewers: reames, pgavlin, swaroop.sridhar, AndyAyers Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9546 llvm-svn: 237214
34 lines
1.3 KiB
LLVM
34 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 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, 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 7, i32 7)
|
|
%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(i64, i32, i1 ()*, i32, i32, ...)
|
|
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) |