Hi Zheng,
You can find some examples in test/CodeGenOpenCL/, but they are not builtin 
functions.
The warning is because these buitin functions need implementation for the 
target device, so it is normal that these builtin functions does not have 
declarations of definitions in clang.
If you want to see some llvm ir of a OpenCL implementation you can try Beignet 
http://www.freedesktop.org/wiki/Software/Beignet/ on Linux or Intel CodeBuilder 
on Windows, they both use clang as front-end and can dump llvm ir.
ThanksXiuli

Date: Fri, 15 Jan 2016 18:12:00 +0000
To: cfe-users@lists.llvm.org
Subject: [cfe-users] Emit LLVM IR from OpenCL
From: cfe-users@lists.llvm.org

Hi,
Could anybody give me an example of emitting LLVM IR from OpenCL code?
I tried this for the backprop benchmark from the rodinia benchmark suite:
clang -x cl backprop_kernel.cl  -emit-llvm -S -o backprop_kernel.ll
and the the following warning:backprop_kernel.cl:24:13: warning: implicit 
declaration of function 'get_group_id' is invalid in C99 
[-Wimplicit-function-declaration]   int by = get_group_id(1);            
^backprop_kernel.cl:25:13: warning: implicit declaration of function 
'get_local_id' is invalid in C99 [-Wimplicit-function-declaration]   int tx = 
get_local_id(0);            ^backprop_kernel.cl:34:3: warning: implicit 
declaration of function 'barrier' is invalid in C99 
[-Wimplicit-function-declaration]                barrier(CLK_LOCAL_MEM_FENCE);  
              ^3 warnings generated.
Does it seem okay? 
-- 
Cheers,Zheng


_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users                        
                  
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to