[PATCH] D143471: [X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 19:24:08 PST 2023
pengfei added inline comments.
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:774-776
+PrefixKind X86MCCodeEmitter::emitPrefixImpl(unsigned &CurOp, const MCInst &MI,
const MCSubtargetInfo &STI,
raw_ostream &OS) const {
----------------
Format.
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:855
- uint64_t Encoding = TSFlags & X86II::EncodingMask;
+ X86OpcodePrefix Prefix(*Ctx.getRegisterInfo());
+ switch (TSFlags & X86II::EncodingMask) {
----------------
Should be better to move below logic into `X86OpcodePrefix `? Then we can simplify the function to:
```
X86OpcodePrefix Prefix(*Ctx.getRegisterInfo(), TSFlags);
Prefix.emit(OS);
return Prefix.getKind();
```
================
Comment at: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:860
+ case X86II::XOP:
+ Prefix.setLowerBound(XOP);
+ break;
----------------
Should be better to use `setEncoding`?
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