[LLVMdev] string input for the integrated assembler

Steve King steve at metrokings.com
Tue Mar 17 17:47:31 PDT 2015


Short version: If the integrated assembler accepted assembly strings
as input, more targets could take advantage of integrated assembly.

The longer version:

For a given assembly statement, my out-of-tree target has complex
instruction selection logic -- more so than the in-tree targets.  This
target uses variable length instructions and a laborious hierarchy of
tblgen AsmOperands to do the job.  Assembly and disassembly with
llvm-mc and llvm-objdump work fine.

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.

If a target could pass an assembly string to the integrated assembler,
the pseudo problem goes away. The string passed to the integrated
assembler could come wrapped in a pseudo MCInst or whatever.  Support
for asm string parsing already exists in every target, so this doesn't
seem like much of a stretch.

Thanks for any comments on this idea.

Regards,
-steve



More information about the llvm-dev mailing list