[PATCH] D143471: [X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 00:49:48 PST 2023


skan added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:222
+    case REX:
+      return static_cast<PrefixKind>(None + (W | R | X | B));
+    case VEX2:
----------------
craig.topper wrote:
> Woudln't this be better as `(W | R | X | B) ? REX :  None`?
Good idea!


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:224
+    case VEX2:
+      return static_cast<PrefixKind>(VEX2 + (W | X | B | (VEX_5M != 1)));
+    }
----------------
craig.topper wrote:
> Similar here.
Will do.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:829
 
-  return HasREX;
+  return Kind;
 }
----------------
craig.topper wrote:
> The ?: can just be combined into the return here. No need for a variable.
Good point!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143471



More information about the llvm-commits mailing list