How to compile OpenCL kernel functions?

Hi All,

I am trying to use Clang (trunk version) to compile some OpenCL kernels.

I’m confused about how the the OpenCL address space is handled.
The test case “clang/test/CodeGenOpenCL/” uses “-ffake-address-space-map” and it can pass when I use llvm-lit.

But when I try to compile it, clang gives a warning that “-ffake-address-space-map” is not used, and in the generated IR, and it seems that all the pointers are treated as “normal” pointers.

Can someone give me some advice?
Or maybe point me to the right documentation.

Thanks in advance!

The -ffake-address-space-map flag is only intended for use during
testing, because we don't actually have any targets in the tree that
define an address space map.

To declare a target with an address space map, you could add a new
target to lib/Basic/Targets.cpp with an address space map, or modify
one of the existing targets.

The attached patch shows how to add a new target with an address
space map.


0001-Define-the-KLEE-OpenCL-target.patch (2.01 KB)