[LLVMdev] Implementing customized intrinsic

Haohui Mai mai4 at uiuc.edu
Wed Jan 21 16:31:12 PST 2009


Dear all,

Currently I'm working on a project that add various checks into the  
LLVM bitcode. For example,  I insert function calls before every  
load / store instructions to guarantee that these instructions are  
safe. I really want to implement them as LLVM intrinsics or ``special  
function calls'' so that I am able to leverage the power of things  
like InstVisitor. However, it seems it is difficult to do it without  
changing LLVM's source codes, cause

i) all constructors of CallInst are private
ii) There's no interfaces for implementing customized intrinsics  
(without changing intrinsics*.td)

It is very helpful to mark these checks as special calls (like  
intrinsics), it would ease the implementation of optimizations since  
they only work on these special calls, say, I could save some  
information in the subclass of CallInst.

I also notice that the access identifier of CallInst are changed after  
LLVM 2.0. I would be appreciated if you guys could explain the  
rationale behind the changes.

Thank you very much.

Best,

Haohui





More information about the llvm-dev mailing list