[LLVMdev] annotate a value

Chris Lattner sabre at nondot.org
Wed Jun 15 12:03:33 PDT 2005


On Tue, 14 Jun 2005, Reid Spencer wrote:

> Hello,
>
> The interface is named Annotation and it allows any Annotable object to
> be annotated.

This is correct.

> Note that the Value class is an Annotable.

This is not.

Shuhan, you have two options:

1. You can store the information you want in an std::map somewhere on the
    side.
2. You can add the fields you want to the LLVM Instruction subclasses
    corresponding to the instructions you want to modify.  This is how the
    'volatile' flag for load/store are handled, for example.

-Chris

> HOWEVER, if the annotation information is something that might be useful
> to other developers or to other analysis/transformation passes, you're
> strongly encouraged to create an Analysis instead. See the various
> analyses in include/llvm/Analysis for examples.
>
> Reid.
>
> On Mon, 2005-06-13 at 10:46 -0400, shding at mtu.edu wrote:
>> Hi,
>>    I want to annotate values in llvm, like making a flag for the operands
>> and result of  an instruction for future use. I wonder if there's any
>> interface to do such a thing? Thanks!
>>
>>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list