[llvm-dev] llvm.annotation arguments

Son Tuan VU via llvm-dev llvm-dev at lists.llvm.org
Wed May 30 09:36:10 PDT 2018


Hello all,

According to *clang/lib/CodeGen/CodeGenFunction.cpp*, a LLVM annotation
intrinsic call has 4 arguments:

- llvm::Value *AnnotatedVal,
- Builder.CreateBitCast(CGM.EmitAnnotationString(AnnotationStr), Int8PtrTy),
- Builder.CreateBitCast(CGM.EmitAnnotationUnit(Location), Int8PtrTy),
- CGM.EmitAnnotationLineNo(Location)

However, this is what an annotation intrinsic *char
__attribute__((annotate("DIFF"))) diff* looks like in the IR:

@.str = private unnamed_addr constant [5 x i8] c"DIFF\00", section
"llvm.metadata"
@.str.1 = private unnamed_addr constant [6 x i8] c"pin.c\00", section
"llvm.metadata"

call void @llvm.var.annotation(i8* %diff,
                                                       i8* getelementptr
inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0),
                                                       i8* getelementptr
inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0),
                                                       i32 38)

So my question is, why don't we find any BitCast here, but a GEP?

Thanks for your help,

Son Tuan Vu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180530/22dbfcdf/attachment.html>


More information about the llvm-dev mailing list