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!
Hello,
The interface is named Annotation and it allows any Annotable object to
be annotated. Note that the Value class is an Annotable.
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.
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.
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
That's what I get for trusting the documentation in Annotation.h. The
documentation is now fixed.
Reid