[LLVMdev] Adding a Yasm ASM printer

Matthew Huck matthew.huck at gmail.com
Mon Apr 2 13:46:03 PDT 2012


Hi,
  I'm in the process of adding a X86 ASM Printer for outputting the asm in
a style that Yasm can take without any post processing. Yasm's format is
very close to that of intel.  I was wondering if my approach is correct:

I've made a custom MCAsmStreamer to remove some of the COFF symbol
directives that yasm doesn't understand.

I've made a X86YasmInstPrinter, and added it to the x86.td, as a new
variant, and due to it having a new Variant number, I'm having to edit all
the X86*.td files and add the extra variant's descriptions in the { | }
blocks.

I've also added a new ASMInfo class with the required changes for yasm.


Now what is worrying me is the number of .td files I'm having to touch, and
most of the changes are adding a variant with exactly the same code as the
intel variant, there are just a few cases that a slightly different.

I'm about 1/4 way through the .td files, and already the asm is starting to
look close to something yasm could handle, so I must be at least on the
right track, but that size of the changes to the .td files is alarming.

Any pointers, or suggestions welcome :-)

Cheers

Matthew.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120403/f9e3549f/attachment.html>


More information about the llvm-dev mailing list