[LLVMdev] Annotate a value.

Chris Lattner sabre at nondot.org
Sat Feb 9 09:01:45 PST 2008


On Feb 9, 2008, at 7:42 AM, Óscar Fuentes wrote:

> Hello.
>
> It would be very useful for my project being able to annotate
> Value's. An int would do fine.
>
> I found an old message with this same subject talking about the
> Annotation interface and Annotable object, but the doxygen graphs says
> that only Function is annotable.
>
> Could I use the ValueName for the job? It would be enough, although
> quite clumsy. Seems that Value's of type void can't be named (no
> problem) but I'll need to name Constants, and this is not allowed.
>
> Any suggestion, apart from modifying my LLVM sources?

I strongly suggest just using a hash table or map like  
DenseMap<Value*,int>.  This is generally more efficiently than a  
separately allocated annotation object.

-Chris



More information about the llvm-dev mailing list