2014-04-29 03:21:04 +00:00
|
|
|
/* Capstone Disassembly Engine */
|
2019-02-26 07:19:51 +00:00
|
|
|
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2019 */
|
2013-11-27 04:11:31 +00:00
|
|
|
|
|
|
|
#include "MCInstrDesc.h"
|
|
|
|
|
|
|
|
/// isPredicate - Set if this is one of the operands that made up of
|
|
|
|
/// the predicate operand that controls an isPredicable() instruction.
|
2017-10-22 00:45:40 +00:00
|
|
|
bool MCOperandInfo_isPredicate(const MCOperandInfo *m)
|
2013-11-27 04:11:31 +00:00
|
|
|
{
|
|
|
|
return m->Flags & (1 << MCOI_Predicate);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// isOptionalDef - Set if this operand is a optional def.
|
|
|
|
///
|
2017-10-22 00:45:40 +00:00
|
|
|
bool MCOperandInfo_isOptionalDef(const MCOperandInfo *m)
|
2013-11-27 04:11:31 +00:00
|
|
|
{
|
|
|
|
return m->Flags & (1 << MCOI_OptionalDef);
|
|
|
|
}
|
2023-05-30 03:08:18 +00:00
|
|
|
|
|
|
|
/// Checks if operand is tied to another one.
|
2023-05-30 03:09:37 +00:00
|
|
|
bool MCOperandInfo_isTiedToOp(const MCOperandInfo *m)
|
|
|
|
{
|
2023-05-30 03:08:18 +00:00
|
|
|
if (m->Constraints & (1 << MCOI_TIED_TO))
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns the value of the specified operand constraint if
|
|
|
|
/// it is present. Returns -1 if it is not present.
|
2023-05-30 03:09:37 +00:00
|
|
|
int MCOperandInfo_getOperandConstraint(const MCInstrDesc *InstrDesc,
|
|
|
|
unsigned OpNum,
|
|
|
|
MCOI_OperandConstraint Constraint)
|
|
|
|
{
|
2023-05-30 03:08:18 +00:00
|
|
|
const MCOperandInfo OpInfo = InstrDesc->OpInfo[OpNum];
|
|
|
|
if (OpNum < InstrDesc->NumOperands &&
|
2023-05-30 03:09:37 +00:00
|
|
|
(OpInfo.Constraints & (1 << Constraint))) {
|
2023-05-30 03:08:18 +00:00
|
|
|
unsigned ValuePos = 4 + Constraint * 4;
|
|
|
|
return (OpInfo.Constraints >> ValuePos) & 0xf;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|