#include "MCInstrDesc.h"
bool MCOperandInfo_isPredicate(const MCOperandInfo *m)
{
return m->Flags & (1 << MCOI_Predicate);
}
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m)
{
return m->Flags & (1 << MCOI_OptionalDef);
}
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m)
{
if (m->Constraints & (1 << MCOI_TIED_TO))
return true;
return false;
}
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *InstrDesc,
unsigned OpNum,
MCOI_OperandConstraint Constraint)
{
const MCOperandInfo OpInfo = InstrDesc->OpInfo[OpNum];
if (OpNum < InstrDesc->NumOperands &&
(OpInfo.Constraints & (1 << Constraint))) {
unsigned ValuePos = 4 + Constraint * 4;
return (OpInfo.Constraints >> ValuePos) & 0xf;
}
return -1;
}