HomePhabricator

[X86] For 32-bit targets, emit two-byte NOP when possible

Authored by aganea on Jun 17 2020, 10:26 AM.

Description

[X86] For 32-bit targets, emit two-byte NOP when possible

In order to support hot-patching, we need to make sure the first emitted instruction in a function is a two-byte+ op. This is already the case on x86_64, which seems to always emit two-byte+ ops. However on 32-bit targets this wasn't the case.

PATCHABLE_OP now lowers to a XCHG AX, AX, (66 90) like MSVC does. However when targetting pentium3 (/arch:SSE) or i386 (/arch:IA32) targets, we generate MOV EDI,EDI (8B FF) like MSVC does. This is for compatiblity reasons with older tools that rely on this two byte pattern.

Differential Revision: https://reviews.llvm.org/D81301

Details

Committed
aganeaJun 17 2020, 10:44 AM
Differential Revision
D81301: [X86] Emit two-byte NOP when possible
Parents
rGad879b31f054: [X86] Change signature of EmitNops. NFC.
Branches
Unknown
Tags
Unknown