Usage of CS_OP_MEM_REG and CS_OP_MEM_IMM
Work environment
| Questions | Answers |
|---|---|
| Capstone module affected | Mips |
| Source of Capstone | git clone |
| Version/git commit | https://github.com/capstone-engine/capstone/commit/8ac2843b9bc91e29c0287d27f9c49cff2ad44776 (HEAD, tag: 6.0.0-Alpha3) |
I am seeking clarification on the operand types CS_OP_MEM_REG and CS_OP_MEM_IMM.
https://github.com/capstone-engine/capstone/blob/6461ed0843a677f0b689488132ce73d2083ca11e/include/capstone/cs_operand.h#L28-L30
In what cases are these exposed to the user of Capstone? Testing different instructions that dereference memory appears to just expose the type 0x80 for memory operands.
I'm trying to find examples of instructions that have operands with the CS_OP_MEM_REG and CS_OP_MEM_IMM types - any examples would be greatly appreciated.
They are still left overs from the first Auto-Sync refactors I think.
LLVM only knows registers and immediates. If they belong to a memory operand we add the CS_OP_MEM flag (see for example AArch65GenCSMappingInsnOp.inc). Before Auto-Sync the MEM flag couldn't be ORed into the REG or IMM flag. Which was a problem, because it complicated generation of the table files.
With the change from CS_OP_MEM == 3 to CS_OP_MEM == 0x80 I also added those two types. I think back then I wasn't sure if the registers/imms part of an memory operand should always have this flag set.
But decided against it, because it is too annoying. And now they are still there.
It is probably better to remove them or document them properly.