[cfe-dev] Generating strict LLVM IR out of C/C++ headers
Dmitry N. Mikushin
maemarcus at gmail.com
Sat Jun 9 14:43:16 PDT 2012
Dear colleagues,
Consider there is a need to mix sources and headers that are in two
different high-level languages. It should be possible, if both languages
are lowered down to LLVM IR and merged. But the problem is that clang is
unable to generate strict IR code for headers. For example the code
extern __attribute__((device)) int var;
__attribute__((always_inline)) void kernel()
{
var = 2;
}
with
clang -cc1 test.cu -emit-llvm -triple ptx64-unknown-unknown
-fcuda-is-device test.cu -o -
reasonably produces empty module: the only function is inline and not used.
So the question: is there an easy way to generate IR with clang strictly
for entire header file, with all inlined functions and unused types?
Probably one way would be to write a plugin to add a fictive call of every
function and declare fictive variable of every type, but this is stupid.
Any better solution?
Thanks,
- Dima.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120609/7a060668/attachment.html>
More information about the cfe-dev
mailing list