Hello,<br><br>I would like to use clang  to build a source level tool that generates OpenCL code.<br><br>Basically, the idea is that given an annotation of a loop, the tool can convert the loop to an OpenCL kernel. <br><br>
For example, a C program with an pragma annotation will look like:<br><br>#pragma opencl parallel for private(v1, v2)<br>for (...)<br>{<br>   ...<br>}<br><br>and the tool will read the source code in, parse the source and generate an OpenCL kernel as a C-like program.<br>
<br>I am wondering whether the CLANG AST can keep information about the loop, such as the loop index, the loop boundary, and statements of the loop body?<br><br>I don't know whether I need to go into the LLVM bitcode level to retrieve such information. However, I generally don't want to go to such a low level.<br>
<br>If anyone can point out whether there is an example that I can refer to, it will be fantastic. <br><br>Thanks!<br><br>Cheers,<br>Zheng<br><br>