Inline assembler in D and LDC, round 2
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Wed Feb 4 16:50:08 PST 2009
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.
More information about the Digitalmars-d
mailing list