[PATCH] D143471: [X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 7 00:45:39 PST 2023
craig.topper 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:
----------------
Woudln't this be better as `(W | R | X | B) ? REX : None`?
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:224
+ case VEX2:
+ return static_cast<PrefixKind>(VEX2 + (W | X | B | (VEX_5M != 1)));
+ }
----------------
Similar here.
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:271
+ PrefixKind emitPrefixImpl(unsigned &CurOp, const MCInst &MI,
const MCSubtargetInfo &STI, raw_ostream &OS) const;
----------------
clang-format
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:829
- return HasREX;
+ return Kind;
}
----------------
The ?: can just be combined into the return here. No need for a variable.
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