[PATCH] D144776: [X86][MC] Assert unexpected form in emitREXPrefix, NFCI
Kan Shengchen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 26 17:56:12 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG742737553128: [X86][MC] Assert unexpected form in emitREXPrefix, NFCI (authored by skan).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144776/new/
https://reviews.llvm.org/D144776
Files:
llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
Index: llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -1160,20 +1160,21 @@
if (!STI.hasFeature(X86::Is64Bit))
return None;
X86OpcodePrefixHelper Prefix(*Ctx.getRegisterInfo());
- bool UsesHighByteReg = false;
const MCInstrDesc &Desc = MCII.get(MI.getOpcode());
uint64_t TSFlags = Desc.TSFlags;
Prefix.setW(TSFlags & X86II::REX_W);
unsigned NumOps = MI.getNumOperands();
- if (!NumOps) {
- PrefixKind Kind = Prefix.determineOptimalKind();
- Prefix.emit(OS);
- return Kind;
- }
- unsigned CurOp = X86II::getOperandBias(Desc);
+ bool UsesHighByteReg = false;
+#ifndef NDEBUG
+ bool HasRegOp = false;
+#endif
+ unsigned CurOp = NumOps ? X86II::getOperandBias(Desc) : 0;
for (unsigned i = CurOp; i != NumOps; ++i) {
const MCOperand &MO = MI.getOperand(i);
if (MO.isReg()) {
+#ifndef NDEBUG
+ HasRegOp = true;
+#endif
unsigned Reg = MO.getReg();
if (Reg == X86::AH || Reg == X86::BH || Reg == X86::CH || Reg == X86::DH)
UsesHighByteReg = true;
@@ -1194,6 +1195,14 @@
}
}
switch (TSFlags & X86II::FormMask) {
+ default:
+ assert(!HasRegOp && "Unexpected form in emitREXPrefix!");
+ case X86II::RawFrm:
+ case X86II::RawFrmMemOffs:
+ case X86II::RawFrmSrc:
+ case X86II::RawFrmDst:
+ case X86II::RawFrmDstSrc:
+ break;
case X86II::AddRegFrm:
Prefix.setB(MI, CurOp++);
break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144776.500640.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230227/0aec9a2d/attachment.bin>
More information about the llvm-commits
mailing list