Inserting annotations


Hello together,

how can i insert annotations in IR ?

I want actually write something like:


<br>CallInst *call = CallInst::Create( ??? , aBasicBlock);<br><br>in my pass.<br><br><br>Regards<br>Raad<br><br>



|

how can i insert annotations in IR ?

See http://llvm.org/docs/LangRef.html#int_annotation.

I want actually write something like:
CallInst *call = CallInst::Create( ??? , aBasicBlock);

It's illegal to take the address of a basic block in LLVM IR.

-Eli

Hi,

As far as I know, Instruction class does not inherit “Annotable” Class. Only Function inherits annotable according to the documentation of annotable class.

What you are asking would require adding annotations at instruction level, which does not seem to be possible. You can maintain external maps between instructions and your annotations,

–Kapil

Read about the @llvm.annotation family of intrinsics.

http://llvm.org/docs/LangRef.html#int_var_annotation

llvm::Annotatable is a deprecated means of maintaining “on the side” data structures internal to the compiler. Its name is misleading, and it has nothing to do with the sort of annotations most people are interested in. We would like it to go away; it is currently used only to attach the temporary MachineFunction data structure to a Function during code generation. Developers with interest Annotatable as it stands are advised to use a SmallPtrSet instead.