[LLVMdev] Using annotation attributes

Bart Coppens Bart.Coppens at elis.ugent.be
Thu Jun 5 07:04:12 PDT 2008


Hi,

I'm trying to annotate certain functions in C code, and do something with 
these functions in my LLVM pass. I annotate the C code like this:

int __attribute__((annotate("annot"))) function() {

This nicely gets added to the LLVM bitcode in an 
@llvm.global.annotations global. Now I had hoped that it'd be easy to extract 
a list of functions annotated with my annotation using

AnnotationManager::getID("annot")
and later on:
function->getAnnotation(AnnotID).

This does not seem to work, unfortunately. Is this supposed to work in this 
way, or am I using the wrong functions? I could of course just try to 
manually parse the @llvm.global.annotations constant, but that seems rather 
tiresome :-)

Thanks,
Bart Coppens



More information about the llvm-dev mailing list