[PATCH] D81301: [X86] Emit two-byte NOP when possible

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 13:30:20 PDT 2020


aganea created this revision.
aganea added reviewers: MaskRay, reames, rnk, sanjoy.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

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

Whenever using the "patchable-function" attribute, a PATCHABLE_OP now lowers to a `xchg ax, ax`, like MSVC does.

The goal of this patch, along with D43002 <https://reviews.llvm.org/D43002>  and D81296 <https://reviews.llvm.org/D81296>, is to support the clang-cl flag /HOTPATCH: https://docs.microsoft.com/sv-se/cpp/build/reference/hotpatch-create-hotpatchable-image?view=vs-2019


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81301

Files:
  llvm/lib/Target/X86/X86MCInstLower.cpp
  llvm/test/CodeGen/X86/patchable-function-entry.ll
  llvm/test/CodeGen/X86/patchable-prologue.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81301.268924.patch
Type: text/x-patch
Size: 10176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/81ee66f3/attachment.bin>


More information about the llvm-commits mailing list