- // Alternative nop instructions for CPUs which don't support long nops.
- static const uint8_t AltNops[7][10] = {
- // nop
- {0x90},
- // xchg %ax,%ax
- {0x66, 0x90},
- // lea 0x0(%esi),%esi
- {0x8d, 0x76, 0x00},
- // lea 0x0(%esi),%esi
- {0x8d, 0x74, 0x26, 0x00},
- // nop + lea 0x0(%esi),%esi
- {0x90, 0x8d, 0x74, 0x26, 0x00},
- // lea 0x0(%esi),%esi
- {0x8d, 0xb6, 0x00, 0x00, 0x00, 0x00 },
- // lea 0x0(%esi),%esi
- {0x8d, 0xb4, 0x26, 0x00, 0x00, 0x00, 0x00},
- };
-
- // Select the right NOP table.
- // FIXME: Can we get if CPU supports long nops from the subtarget somehow?
- const uint8_t (*Nops)[10] = HasNopl ? TrueNops : AltNops;
- assert(HasNopl || MaxNopLength <= 7);
+ // This CPU doesn't support long nops. If needed add more.
+ // FIXME: Can we get this from the subtarget somehow?
+ // FIXME: We could generated something better than plain 0x90.
+ if (!HasNopl) {
+ for (uint64_t i = 0; i < Count; ++i)
+ OW->write8(0x90);
+ return true;
+ }