mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-10-31 08:16:47 +00:00 
			
		
		
		
	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
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			910 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			910 B
		
	
	
	
		
			LLVM
		
	
	
	
	
	
| ; RUN: opt %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
 | |
| 
 | |
| ; CHECK: derived %next.i64 base %base_obj
 | |
| 
 | |
| define void @test(i64 addrspace(1)* %base_obj) gc "statepoint-example" {
 | |
| entry:
 | |
|   %obj = getelementptr i64, i64 addrspace(1)* %base_obj, i32 1
 | |
|   br label %loop
 | |
| 
 | |
| loop:
 | |
|   %current = phi i64 addrspace(1)* [ %obj, %entry ], [ %next.i64, %loop ]
 | |
|   %current.i32 = bitcast i64 addrspace(1)* %current to i32 addrspace(1)*
 | |
|   %next.i32 = getelementptr i32, i32 addrspace(1)* %current.i32, i32 1
 | |
|   %next.i64 = bitcast i32 addrspace(1)* %next.i32 to i64 addrspace(1)*
 | |
|   %safepoint_token = call i32 (void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
 | |
|   br label %loop
 | |
| }
 | |
| 
 | |
| declare void @do_safepoint()
 | |
| declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...)
 |