[llvm-dev] The use of token type

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 6 12:13:16 PDT 2018


I don't think token was envisioned as something that could be exposed via C
builtins. Perhaps you could modify CGBuiltins.cpp to avoid the bitcast, but
you still won't be able to store the token to a variable in C. It will only
be usable in an expression, like this:
  consume_token(produce_token(), foo(), bar());

This doesn't seem like a particularly good design direction either.

On Thu, Aug 2, 2018 at 7:34 PM Dounia Khaldi via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hello,
> I would like to add an intrinsic that returns a token type argument. The
> equivalent in C that I found other builtins using is void *(coro_id for
> instance).
>
> My question is how to generate the code in CGBuiltins.cpp to generate
> token type instead of void *. The usual code is not working.
>
> The intrinsic I get generated is:
> %1 = call token @llvm.new_intrinsic()
>
> but it wants to convert the token into void* like the following:
> %2 = bitcast token %1 to i8*
> store i8* %2, i8** %myvariable
>
>  How to get it to use directly token type like this:
> %myvariale = call token @llvm.new_intrinsic()
>
> Did anyone have done this before: token in the intrinsic and void* in the
> builtin?
>
> Thanks,
> Dounia
>
> _______________________________________________
> 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/20180806/0c6c7600/attachment.html>


More information about the llvm-dev mailing list