Modify ObjC blocks impl wrt address spaces as follows: - keep default private address space for blocks generated as local variables (with captures); - add global address space for global block literals (no captures); - make the block invoke function and enqueue_kernel prototype with the generic AS block pointer parameter to accommodate both private and global AS cases from above; - add block handling into default AS because it's implemented as a special pointer type (BlockPointer) in the frontend and therefore it is used as a pointer everywhere. This is also needed to accommodate both private and global AS blocks for the two cases above. - removes ObjC RT specific symbols (NSConcreteStackBlock and NSConcreteGlobalBlock) in the OpenCL mode. Review: https://reviews.llvm.org/D28814 llvm-svn: 293286
20 lines
963 B
Common Lisp
20 lines
963 B
Common Lisp
// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s --check-prefix=COMMON
|
|
// RUN: %clang_cc1 %s -cl-std=CL2.0 -emit-llvm -o - -O0 -triple amdgcn-amd-amdhsa-opencl | FileCheck %s --check-prefix=AMD
|
|
|
|
// Checking for null instead of @__NSConcreteGlobalBlock symbol
|
|
// COMMON: @__block_literal_global = internal addrspace(1) constant { i8**, i32, i32, i8*, %struct.__block_descriptor addrspace(2)* } { i8** null
|
|
// AMD: @__block_literal_global = internal addrspace(1) constant { i8**, i32, i32, i8*, %struct.__block_descriptor addrspace(2)* } { i8** addrspacecast (i8* addrspace(4)* null to i8**)
|
|
void (^block_A)(local void *) = ^(local void *a) {
|
|
return;
|
|
};
|
|
|
|
void foo(){
|
|
int i;
|
|
// Checking for null instead of @_NSConcreteStackBlock symbol
|
|
// COMMON: store i8* null, i8** %block.isa
|
|
// AMD: store i8* addrspacecast (i8 addrspace(4)* null to i8*), i8** %block.isa,
|
|
int (^ block_B)(void) = ^{
|
|
return i;
|
|
};
|
|
}
|