[llvm-dev] llvm.annotation arguments

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Wed May 30 10:45:18 PDT 2018


Pointer casts are considered less canonical. The GEP is the same as writing
&array[0] in C to convert from a pointer to an array to a pointer to an
array element, without relying on pointer decay.

On Wed, May 30, 2018 at 9:37 AM Son Tuan VU via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180530/5670991a/attachment.html>


More information about the llvm-dev mailing list