[LLVMdev] string input for the integrated assembler

Steve King steve at metrokings.com
Wed Mar 18 10:06:38 PDT 2015

On Tue, Mar 17, 2015 at 6:14 PM, Tim Northover <t.p.northover at gmail.com> wrote:
>> 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.

I probably used the term 'expansion' incorrectly.  Pseudos go 1:1 into
.s files, then MCTargetAsmParser does its job.  This class nicely
consolidates tblgen's auto-generated operand fitting logic, which for
me is quite a blob of code.  Should use of the integrated assembler
require targets to pick all machine instructions some other way?  If
the answer should be no, then handling pseudos via their AsmString
feels like a tidy answer.

More information about the llvm-dev mailing list