[cfe-dev] Clang C asm and LLVM

Patrick Moran patrick.a.moran at gmail.com
Sun Jan 24 17:03:04 PST 2010


Hello everyone,

     I was wondering if there was any way to cause LLVM to interpret
the asm or __asm__ inline assembly syntax as containing LLVM IR.  That
is, if I wanted to inject LLVM IR directly into a function, is there
any way to do so?

     In case the context is relevant, I'm writing a compiler for a
higher-level language and I'm debating between generating C (simpler)
and generating LLVM IR directly.  Generating C would be preferable,
but since I will need to emulate try/catch, I need to be able to
instruct the compiler to use the invoke instruction from the IR
instead of the call function.  I figured I could simplify this in C by
wrapping a varargs macro that generates an __asm__ actually performing
the invoke.

     Any ideas?

Thanks,
Patrick Moran



More information about the cfe-dev mailing list