[X86] Add interface X86II::isPseudo

Avoid duplicate code in X86MCCodeEmitter, NFCI.
This commit is contained in:
Shengchen Kan 2020-04-16 12:37:24 +08:00
parent e13a8a1fc5
commit 71303b753c
2 changed files with 7 additions and 2 deletions

View File

@ -942,6 +942,11 @@ namespace X86II {
return (TSFlags & X86II::FormMask) == PrefixByte;
}
/// \returns true if the instruction with given opcode is a pseudo.
inline bool isPseudo(uint64_t TSFlags) {
return (TSFlags & X86II::FormMask) == Pseudo;
}
/// \returns the "base" X86 opcode for the specified machine
/// instruction.
inline uint8_t getBaseOpcodeFor(uint64_t TSFlags) {

View File

@ -1362,7 +1362,7 @@ void X86MCCodeEmitter::emitPrefix(const MCInst &MI, raw_ostream &OS,
uint64_t TSFlags = Desc.TSFlags;
// Pseudo instructions don't get encoded.
if ((TSFlags & X86II::FormMask) == X86II::Pseudo)
if (X86II::isPseudo(TSFlags))
return;
unsigned CurOp = X86II::getOperandBias(Desc);
@ -1382,7 +1382,7 @@ void X86MCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
uint64_t TSFlags = Desc.TSFlags;
// Pseudo instructions don't get encoded.
if ((TSFlags & X86II::FormMask) == X86II::Pseudo)
if (X86II::isPseudo(TSFlags))
return;
unsigned NumOps = Desc.getNumOperands();