[LLVMdev] adding header files to code

Kshitiz Garg ksh.cseiitk at gmail.com
Wed Apr 1 01:23:03 PDT 2009


Hi,
   I was wondering how to add header files to code in LLVM. I am trying to
create a small profiler to track the actual time spent in functions.
For this i am adding call to clock() in the C code of the given program.
However this will require adding the file time.h to C code. Can some  tell
me a way to do so.
I have tried using Module.addLibrary("time.h"); but this doesn't seem to
address the problem because I am not able to get the type clock_t by using
Module.getType() .Moreover only adding just the module.addlibrary does not
add the header file in the generated c code.
 It would be a great help if someone could shed light as to how to introduce
header files by a transformation pass and able to use the types defined in
the header file in the pass itself.
A similar scenario can arise in a parallelizing transformation where one is
trying to create threads but this requires inclusion of pthread.h to access
the types like pthread_t. etc.
-- 
Kshitiz Garg
Graduate Student
Department of Computer Science & Engineering
IIT Kanpur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090401/066db204/attachment.html>


More information about the llvm-dev mailing list