[LLVMdev] LLVM Newb: Getting started

Andrew Lenharth andrewl at lenharth.org
Sat Nov 25 04:01:38 PST 2006


On 11/25/06, Wolfgang Draxinger <wdraxinger at darkstargames.de> wrote:
> void foo(){
>     version(x86) {
>         asm {
> /* x86 assembler */
>         }
>     } else version(llvm) {
>         asm {
> /* llvm assembler */
>         }
>     } else {
> /* plain D implementation */
>     }
> }

If you don't mind the output being target specific, you can just put
the inline asm into the llvm bytecode files.  LLVM has growing support
for inline asm; there is no reason to split them out, unless you want
to capture all the above versions of the asm and not pick one until
late in compilation.

Andrew



More information about the llvm-dev mailing list