[llvm-dev] llvm, new language and inline assembly.

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 14 18:57:15 PST 2015


On 14 November 2015 at 13:09, AlexandreFressange via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> -> I read that "module asm" should be my companion but I am not sure how it works (the doc about it, is only a few lines of not so complete information.

The documentation is unfortunately lacking. But you almost certainly
don't want module-level inline asm; you probably want a "%res = call
TYPE asm ..." type thing instead.

> What is the syntax when the final register the value comes from or goes in doesn't matter? so no explicit %%rax or %%rdx but rather something like %%r?x; here the question mark let the compiler to choose the best register for the value);

Our inline asm is based heavily on GCC style syntax. The main change
is that a "%N" or "%[whatever]" argument to reference an in/out value
becomes $N. Operand modifiers are written "${N:mod}" rather than
"%modN".

The best way to get familiar with it is probably to write what you
want in GCC asm and run "clang -S -o- -emit-llvm" to see what IR gets
produced.

Cheers.

Tim.


More information about the llvm-dev mailing list