/// Return true if operand \p OpIdx is a subregister index.
bool isOperandSubregIdx(unsigned OpIdx) const {
- assert(getOperand(OpIdx).getType() == MachineOperand::MO_Immediate &&
- "Expected MO_Immediate operand type.");
+ assert(getOperand(OpIdx).isImm() && "Expected MO_Immediate operand type.");
if (isExtractSubreg() && OpIdx == 2)
return true;
if (isInsertSubreg() && OpIdx == 3)
return GenericComment;
// If not, check if we have an immediate operand.
- if (Op.getType() != MachineOperand::MO_Immediate)
+ if (!Op.isImm())
return std::string();
// And print its corresponding condition code if the immediate is a
auto Op = MI.getOperand(1);
// If the instruction has a global address as operand, it is not cheap
// since the operand will be constant extended.
- if (Op.getType() == MachineOperand::MO_GlobalAddress)
+ if (Op.isGlobal())
return false;
// If the instruction has an operand of size > 16bits, its will be
// const-extended and hence, it is not cheap.
// See if this is a generic print operand
return AsmPrinter::PrintAsmOperand(MI, OpNum, ExtraCode, O);
case 'X': // hex const int
- if ((MO.getType()) != MachineOperand::MO_Immediate)
+ if (!MO.isImm())
return true;
O << "0x" << Twine::utohexstr(MO.getImm());
return false;
case 'x': // hex const int (low 16 bits)
- if ((MO.getType()) != MachineOperand::MO_Immediate)
+ if (!MO.isImm())
return true;
O << "0x" << Twine::utohexstr(MO.getImm() & 0xffff);
return false;
case 'd': // decimal const int
- if ((MO.getType()) != MachineOperand::MO_Immediate)
+ if (!MO.isImm())
return true;
O << MO.getImm();
return false;
case 'm': // decimal const int minus 1
- if ((MO.getType()) != MachineOperand::MO_Immediate)
+ if (!MO.isImm())
return true;
O << MO.getImm() - 1;
return false;
case 'y': // exact log2
- if ((MO.getType()) != MachineOperand::MO_Immediate)
+ if (!MO.isImm())
return true;
if (!isPowerOf2_64(MO.getImm()))
return true;
return false;
case 'z':
// $0 if zero, regular printing otherwise
- if (MO.getType() == MachineOperand::MO_Immediate && MO.getImm() == 0) {
+ if (MO.isImm() && MO.getImm() == 0) {
O << "$0";
return false;
}
return GenericComment;
// If not, we must have an immediate operand.
- if (Op.getType() != MachineOperand::MO_Immediate)
+ if (!Op.isImm())
return std::string();
std::string Comment;
MachineInstr *&LoADDI) {
if (HiLUI.getOpcode() != RISCV::LUI ||
HiLUI.getOperand(1).getTargetFlags() != RISCVII::MO_HI ||
- HiLUI.getOperand(1).getType() != MachineOperand::MO_GlobalAddress ||
+ !HiLUI.getOperand(1).isGlobal() ||
HiLUI.getOperand(1).getOffset() != 0 ||
!MRI->hasOneUse(HiLUI.getOperand(0).getReg()))
return false;
LoADDI = &*MRI->use_instr_begin(HiLuiDestReg);
if (LoADDI->getOpcode() != RISCV::ADDI ||
LoADDI->getOperand(2).getTargetFlags() != RISCVII::MO_LO ||
- LoADDI->getOperand(2).getType() != MachineOperand::MO_GlobalAddress ||
+ !LoADDI->getOperand(2).isGlobal() ||
LoADDI->getOperand(2).getOffset() != 0 ||
!MRI->hasOneUse(LoADDI->getOperand(0).getReg()))
return false;
void X86AsmPrinter::PrintModifiedOperand(const MachineInstr *MI, unsigned OpNo,
raw_ostream &O, const char *Modifier) {
const MachineOperand &MO = MI->getOperand(OpNo);
- if (!Modifier || MO.getType() != MachineOperand::MO_Register)
+ if (!Modifier || !MO.isReg())
return PrintOperand(MI, OpNo, O);
if (MI->getInlineAsmDialect() == InlineAsm::AD_ATT)
O << '%';