summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGOpenCLRuntime.h
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2017-10-04 20:32:17 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2017-10-04 20:32:17 +0000
commit8dd6284b7c70a2489e722480ba4a264a374922cc (patch)
tree225bc9fdfce37c60623d579552cb2710feb9e2a0 /lib/CodeGen/CGOpenCLRuntime.h
parent5915ee7c6af36d47631cb8194b9ff4b61378e691 (diff)
[OpenCL] Clean up and add missing fields for block struct
Currently block is translated to a structure equivalent to struct Block { void *isa; int flags; int reserved; void *invoke; void *descriptor; }; Except invoke, which is the pointer to the block invoke function, all other fields are useless for OpenCL, which clutter the IR and also waste memory since the block struct is passed to the block invoke function as argument. On the other hand, the size and alignment of the block struct is not stored in the struct, which causes difficulty to implement __enqueue_kernel as library function, since the library function needs to know the size and alignment of the argument which needs to be passed to the kernel. This patch removes the useless fields from the block struct and adds size and align fields. The equivalent block struct will become struct Block { int size; int align; generic void *invoke; /* custom fields */ }; It also changes the pointer to the invoke function to be a generic pointer since the address space of a function may not be private on certain targets. Differential Revision: https://reviews.llvm.org/D37822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGOpenCLRuntime.h')
-rw-r--r--lib/CodeGen/CGOpenCLRuntime.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGOpenCLRuntime.h b/lib/CodeGen/CGOpenCLRuntime.h
index f28d414cd7..2df28c2c7c 100644
--- a/lib/CodeGen/CGOpenCLRuntime.h
+++ b/lib/CodeGen/CGOpenCLRuntime.h
@@ -59,6 +59,9 @@ public:
// \brief Returnes a value which indicates the alignment in bytes of the pipe
// element.
virtual llvm::Value *getPipeElemAlign(const Expr *PipeArg);
+
+ /// \return __generic void* type.
+ llvm::PointerType *getGenericVoidPointerType();
};
}