[LLVMdev] Assembler used in LLVM

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jul 27 16:58:15 PDT 2011


On Wed, Jul 27, 2011 at 04:45:51PM -0700, Raghu Prabhakar wrote:
> I am looking to develop an assembler for an experimental ISA,
> to produce elf binaries. Does LLVM use the GNU assembler internally?

X86 (both 32bit and 64bit) have a working MC-based assembler. It is
enabled by default. GAS is used on all other platforms by default.
ARM at least has a mostly working MC-based assembler, but it has to be
requested with -integrated-as.

> Or does it have a modular extension/in-memory representation for an
> assembly-level IR? I am aware of the existence of the lower level
> SelectionDAG and MachineInstr components. Do we have a similar, but
> lower level IR abstraction suitable for assembly?

Basically, you provide the target patterns just like you do for the code
generator. Additionally, you have to provide some parser glue. Depending
on how much you want to be compatible with existing assemblers for your
platform, this can be more or less work.

lib/Target/X86/AsmParser and lib/Target/ARM/AsmParser are the relevant
chunks.

Joerg



More information about the llvm-dev mailing list