[cfe-dev] annotations not working with functions

Vasudev.Negi at microchip.com Vasudev.Negi at microchip.com
Wed Jul 1 23:03:37 PDT 2009


 Annotations work with global variables but do not work with functions.
Is it supposed to work or am I missing something?

 

I have test case :

void  foo() __attribute__((annotate("test")));

int global __attribute__ ((annotate("test_global")));

int i;

void  foo() {

 i =20;

}

 

The .ll generated for it is :

target triple = "i386-pc-linux-gnu"

      type { i8*, i8*, i8*, i32 }         ; type %0

@i = common global i32 0, align 4         ; <i32*> [#uses=1]

@global = common global i32 0, align 4          ; <i32*> [#uses=1]

@global.str = internal global [12 x i8] c"test_global\00"         ; <[12
x i8]*> [#uses=1]

@.str = internal global [7 x i8] c"test.c\00"         ; <[7 x i8]*>
[#uses=1]

@llvm.global.annotations = appending global [1 x %0] [%0 { i8* bitcast
(i32* @global to i8*), i8* getelementptr ([12 x i8]* @global.str, i32 0,
i32 0), i8* getelementptr ([7 x i8]* @.str, i32 0, i32 0), i32 2 }],
section "llvm.metadata"            ; <[1 x %0]*> [#uses=0]

 

define void @foo() nounwind {

entry:

      store i32 20, i32* @i

      ret void

}

 

Regards

Vasudev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090701/a81c9d93/attachment.html>


More information about the cfe-dev mailing list