addPassesToEmitFile and Intel syntax


I am using TargetMachine::addPassesToEmitFile to write out x86-64 assembly. However, the generated assembly uses the AT&T syntax. Is there a way to switch to the Intel syntax?


llc does support -x86-asm-syntax=intel, and Clang maps that to -masm=intel. I don’t think there is an API for it other than the command line. The output will still use GAS style directives, so it won’t assemble with masm.

It may not have as high fidelity as the AT&T asm printer, since we’ve never relied on it as much. Before MC, feeding AT&T style assembly to GAS was the only way to produce object files, so it had to be reliable in a way that was never required of the Intel syntax.