Option -Zg: Masm-compatible Code Generation

Asmc Macro Assembler

Option -Zg: Masm-compatible Code Generation

Option -Zg makes JWasm try an exact copy of Masm's code generation, which results in the following changes:
  • the default prologue for procedures will use
      add [e]sp, - localsize
    instead of
      sub [e]sp, localsize.
  • the default epilogue for procedures will almost always prefer to generate opcode LEAVE if possible.
  • expressions
      <reg> == 0 and <reg> != 0
    will generate code
      or <reg>,<reg>
    instead of
      cmp <reg>,0.
  • if invoke must extend an argument's size from word to dword, register eax remains unchanged.
  • the segment value of FAR externals will always be assumed unknown, no matter whether the external is defined inside or outside of a segment block. Thus those labels are excluded from "far call optimization".
  • if indirect addressing uses 2 (32- or 64-bit) registers and no scaling factor is used and the second register isn't ESP/RSP, then the registers are swapped: the second becomes base and the first becomes index ( the registers in an expression are counted from left to right ). [ since v2.10, this is standard behavior ].