Walter Bright wrote:
Is the inline assembling actually done by the LLVM back end, or the LDC front end?

The frontend turns it into an GCC-style asm statement (with explicit input and output constraints) that shows up as a function literal in the IR (only valid as target of a 'call' instruction).

The LLVM codegen then uses those constraints to allocate registers, substitutes them in the asm string and emits it directly to the assembler as part of the output[1]. (LLVM, like GCC, normally uses an external assembler)


[1]: With a few exceptions, IIRC. For example, some part of LLVM turns single "bswap"s into an intrinsic llvm.bswap.i<bitsize>() call to help analyses, optimizers and the JIT since they don't generally support inline asm otherwise.

Reply via email to