Is there a way by which we can change bitcode generated from clang ? i.e. can we inject some special identified data in generated bitcode ?
Asked
Active
Viewed 157 times
1 Answers
1
Yea, you can read bitcode, modify it, and write it back out.
The opt tool does this when optimizing modules.

Colin LeMahieu
- 610
- 5
- 7
-
Thanks colin for response. What I am looking for is can we add some information defined by us in llvm bitcode when we generte bitcode from source cpp file, keping all the previous bitcode generation logic of clang intact. – Nimish Sakalkale Nov 06 '15 at 15:23
-
It sounds like what you want is to create a pass http://llvm.org/docs/WritingAnLLVMPass.html Then if you want to add it directly to clang you could do what these guys did http://stackoverflow.com/questions/23130821/llvm-run-own-pass-automatically-with-clang – Colin LeMahieu Nov 06 '15 at 16:34