| 1 | /* Capstone Disassembly Engine */cxx . . $ `<file>/MCInstrDesc.c`/ |
| 2 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */ |
| 3 | |
| 4 | #include "MCInstrDesc.h"cxx . . $ `<file>/MCInstrDesc.h`/ |
| 5 | |
| 6 | /// isPredicate - Set if this is one of the operands that made up of |
| 7 | /// the predicate operand that controls an isPredicable() instruction. |
| 8 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperandInfo_isPredicatecxx . . $ MCOperandInfo_isPredicate(fd07c0332416d4df).(const MCOperandInfocxx . . $ MCOperandInfo# *m) |
| 9 | { |
| 10 | return m->Flagscxx . . $ MCOperandInfo#Flags. & (1 << MCOI_Predicatecxx . . $ MCOI_Predicate.); |
| 11 | } |
| 12 | |
| 13 | /// isOptionalDef - Set if this operand is a optional def. |
| 14 | /// |
| 15 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperandInfo_isOptionalDefcxx . . $ MCOperandInfo_isOptionalDef(fd07c0332416d4df).(const MCOperandInfocxx . . $ MCOperandInfo# *m) |
| 16 | { |
| 17 | return m->Flagscxx . . $ MCOperandInfo#Flags. & (1 << MCOI_OptionalDefcxx . . $ MCOI_OptionalDef.); |
| 18 | } |
| 19 | |
| 20 | /// Checks if operand is tied to another one. |
| 21 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! MCOperandInfo_isTiedToOpcxx . . $ MCOperandInfo_isTiedToOp(fd07c0332416d4df).(const MCOperandInfocxx . . $ MCOperandInfo# *m) |
| 22 | { |
| 23 | if (m->Constraintscxx . . $ MCOperandInfo#Constraints. & (1 << MCOI_TIED_TOcxx . . $ MCOI_TIED_TO.)) |
| 24 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 25 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 26 | } |
| 27 | |
| 28 | /// Returns the value of the specified operand constraint if |
| 29 | /// it is present. Returns -1 if it is not present. |
| 30 | int MCOperandInfo_getOperandConstraintcxx . . $ MCOperandInfo_getOperandConstraint(cc1c42ad4c38c5e3).(const MCInstrDesccxx . . $ MCInstrDesc# *InstrDesc, |
| 31 | unsigned OpNum, |
| 32 | MCOI_OperandConstraintcxx . . $ MCOI_OperandConstraint# Constraint) |
| 33 | { |
| 34 | const MCOperandInfocxx . . $ MCOperandInfo# OpInfo = InstrDesc->OpInfocxx . . $ MCInstrDesc#OpInfo.[OpNum]; |
| 35 | if (OpNum < InstrDesc->NumOperandscxx . . $ MCInstrDesc#NumOperands. && |
| 36 | (OpInfo.Constraintscxx . . $ MCOperandInfo#Constraints. & (1 << Constraint))) { |
| 37 | unsigned ValuePos = 4 + Constraint * 4; |
| 38 | return (OpInfo.Constraintscxx . . $ MCOperandInfo#Constraints. >> ValuePos) & 0xf; |
| 39 | } |
| 40 | return -1; |
| 41 | } |