[LLVMdev] string input for the integrated assembler

Tim Northover t.p.northover at gmail.com
Tue Mar 17 18:14:30 PDT 2015

> As a simplification, the compiler deals almost exclusively in pseudo
> instructions.  By x86 analogy, using pseudos to unfold a TEST32rm into
> MOV32rm + TEST32rr means I can skip the complex operand fitting effort
> needed to pick specific machine instructions.  There are many such
> examples where handling real instructions would become a gross
> overload.
> One drawback of this approach is that the integrated assembler
> receives only unexpanded pseudos as input, which fails.  So, my target
> must generate .s files and assemble as a separate step.

It sounds like you're doing the expansion directly in the InstPrinter.
Most targets using fused pseudo-instructions like this do it either in
a separate pass (e.g. AArch64ExpandPseudoInsts.cpp) or during the
lowering from MachineInstr to MCInst(s).

Skipping this for a stringly typed "yeah, whatever" interface sounds
really hacky to me. Though you might be able to get something working
by following what inline-asm calls do (I've no idea where they're
lowered off the top of my head, but then I've no idea what your code
is doing in the specifics either so it probably cancels out).



More information about the llvm-dev mailing list