Add llvm instrinsic function llvm.memset and llvm.memcpy support.
authorYang Rong <rong.r.yang@intel.com>
Thu, 16 Jan 2014 07:38:30 +0000 (15:38 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Thu, 16 Jan 2014 06:45:14 +0000 (14:45 +0800)
commit3661c2d35f40fd1e6e9153fd888f33579db7e543
treecfc756ced85cde23301327419ce0310206e1ca34
parent2462bb57a19bd45b6f4353aaeae9547e1b4a066f
Add llvm instrinsic function llvm.memset and llvm.memcpy support.

SPIR 1.2 require llvm.memcpy support. And llvm will emit llvm.memset sometimes.
So adding a pass to lower these two intrinsic function, and then inline them.

In intrinsic lowering pass, find all llvm.memset and llvm.memcpy and then replace
them with a function call __gen_memset_x and __gen_memcpy_xx, x and xx is for address space.

Because this pass is after clang, but after clang, the unused function seems be stripped, so
implement the __gen_memset_x and __gen_memcpy_xx functions in pre compiled module, then link
them.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
backend/src/CMakeLists.txt
backend/src/llvm/llvm_gen_backend.hpp
backend/src/llvm/llvm_intrinsic_lowering.cpp [new file with mode: 0644]
backend/src/llvm/llvm_passes.cpp
backend/src/llvm/llvm_to_gen.cpp
backend/src/ocl_memcpy.ll [new file with mode: 0644]
backend/src/ocl_memset.ll [new file with mode: 0644]