<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Matthew,<div><br></div><div>Whether this is the right approach depends on the details of the problem. If it's mainly directives that are the issue, then a new variant is huge overkill. If, on the other hand, most/many of the instructions themselves need different syntax, then it's exactly the right approach. From your description, in particular, "Yasm's format is very close to that of intel," I suspect you may be able to get away with some custom handling in the current streamers and maybe a few tweaks to problematic instructions. For example, the current streamers conditionally use CFI directives based on whether the target environment supports them. You may be able to do something similar.</div><div><br></div><div>A new streamer (or customized behavior on the current one) and a new variant are somewhat orthogonal. I suggest solving the issues for each independently to avoid having too many moving parts at once.</div><div><br></div><div>-Jim</div><div><br></div><div><br></div><div><br></div><div><div><div>On Apr 2, 2012, at 1:46 PM, Matthew Huck <<a href="mailto:matthew.huck@gmail.com">matthew.huck@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div> 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:</div>
<div><br></div><div>I've made a custom MCAsmStreamer to remove some of the COFF symbol directives that yasm doesn't understand.</div><div><br></div><div>I've made a X86YasmInstPrinter, and added it to the <a href="http://x86.td/" target="_blank">x86.td</a>, 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.</div>
<div><br></div><div>I've also added a new ASMInfo class with the required changes for yasm.</div><div><br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>Any pointers, or suggestions welcome :-)</div><div><br></div><div>Cheers</div><div><br></div><div>Matthew.</div><div><br></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div></body></html>