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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 14:36:07 PDT 2020


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/X86/X86MCInstLower.cpp:99
 // Emit a minimal sequence of nops spanning NumBytes bytes.
-static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit,
-                     const MCSubtargetInfo &STI);
+static void EmitNops(MCStreamer &OS, unsigned NumBytes,
+                     const X86Subtarget *Subtarget);
----------------
Since you are changing the signature, you can rename it to emitNops as well to conform to the coding standards.


================
Comment at: llvm/lib/Target/X86/X86MCInstLower.cpp:1102
+    if (Subtarget->is32Bit() && NumBytes >= 2) {
+      OS.emitInstruction(
+          MCInstBuilder(X86::XCHG16ar).addReg(X86::AX).addReg(X86::AX),
----------------
Can the x86-64 code path below be reused?


================
Comment at: llvm/test/CodeGen/X86/patchable-function-entry.ll:66
+; 32-COUNT-2:  xchgw %ax, %ax
+; 32:          nop
 ; 64:          nopl 8(%rax,%rax)
----------------
32-NEXT


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81301/new/

https://reviews.llvm.org/D81301





More information about the llvm-commits mailing list