[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:56:37 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:1257
+/// \returns the used prefix (REX or None).
+PrefixKind X86MCCodeEmitter::emitOpcodePrefix(int MemOperand, const MCInst &MI,
                                         const MCSubtargetInfo &STI,
----------------
I don't know that it makes sense to make returning the bool for `HasREX` worse by spreading it to more functions. None of the other prefixes are needed and I'm not sure there's sufficient evidence they ever will be. And if they were needed would what type of prefix be enough information?

A `bool &HasREX` passed to emitOpcodePrefix and emitREXPrefix feels cleaner to me. I never liked the returned bool for this.


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