[llvm-dev] Typeless pointers and intrinsics

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 25 05:04:28 PDT 2019


On Thu, 25 Jul 2019 at 12:49, De Azevedo Piovezan, Felipe
<felipe.de.azevedo.piovezan at intel.com> wrote:
> >> I took a look earlier and didn't notice any target-independent ones that would need a separate type parameter
>
> Do you know what would happen  with the llvm.ptr.annotation intrinsic? Frontends use that to annotate members of structs:
>
> struct S {
>    [[some_annotation]] int annotated_array[10];
>    int not_annotated_array[100;
> };
>
> However, there is a big difference between annotating a pointer of type S*, a pointer of type [10 x i32]*, and a pointer of type i8*.  The intrinsic is overloaded for "any pointer"  type to allow distinguishing between those three cases. Do you think we can represent this in a different way once pointers become opaque?

I hadn't thought about that one specifically. I'm not entirely
convinced it merits special treatment if I'm honest: I can't imagine
we'd add an extra facility if we were designing the facility from
scratch in a world with opaque pointers; we'd probably just tell
people to mangle the type into the string somehow if it matters to
them since the whole point is to provide such a side channel anyway.

That said, I strongly suspect at least one intrinsic *will* need an
extra parameter, and once the machinery is in place applying it to
@llvm.ptr.annotate wouldn't be difficult if we do decide it's a good
idea.

Cheers.

Tim.


More information about the llvm-dev mailing list