assemblyx86v8intel-syntax

Does V8 engine know how to print generated machine code using Intel syntax?


I'm using D8 shell and the flag --print-opt-code to print the code TurboFan generates.

However, the code is printed using AT&T syntax. I'm not familiar with it, but with Intel syntax. I searched in d8 --help and didn't find an option for this. Does V8 have an option to print the assembly using Intel syntax? If not, is there a workaround, such as a program that I can run together with D8 to convert the AT&T to Intel syntax?


Solution

  • (V8 developer here.)

    V8 supports only one syntax for printing disassembly. It's very close to Intel syntax: destination before source (e.g. movl eax, 2), indirect memory addresses like [eax+ebx*2+1].

    Looking at https://en.wikipedia.org/wiki/X86_assembly_language#Syntax for reference, I suppose you could say that the one convention V8 takes from AT&T syntax is that operation width is encoded as a suffix of the instruction name, e.g. movl is a 4-byte move, movq is an 8-byte move, testb is a 1-byte test.