[llvm-dev] Assembly file compilation flow

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Fri May 11 02:06:10 PDT 2018


On 10 May 2018, at 21:55, via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I think a key point to understand is the MCStreamer interface, which has two implementations: one for object-file generation, and one for .s file generation.  CodeGen/AsmPrinter can attach to either of these implementations.  MCAsmParser will generally attach to the object-file version of MCStreamer.

Note that it is possible (even via the llvm-mc command-line interface) to attach it to the assembly back end, so you can parse assembly and generate assembly.  This can be interesting on architectures such as MIPS that include a lot of pseudos, because it will expand them to individual instructions (MIPS dla, for example, expands to one of 4 different things depending on assembler state and target).

This path is also used in testing, to ensure that assembly instructions are parsed to their canonical representation.

David



More information about the llvm-dev mailing list