[llvm-dev] How to reliably get memory operand size

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] How to reliably get memory operand size

Chris Lattner via llvm-dev
Hi All,

I'm working on a MIR pass that tries to duplicate memory operation instructions. For example, if there is a move instruction "movq (%rax), %rbx", I will insert another MIR instruction before it. For other instructions, like add, sub, I also insert a mov instruction.

Now my question is, is there any way to obtain the size of the memory operation? in the given example, the size should be 8, while for "movslq (%rax), %tbx)", the size should be 4. 

I have tried memoperand size, but apparently the memoperand is optional and is not necessarily always there. So other than parsing the opcode, do we have any reliably way to get the memory operation size?

Thanks in advance. 

Regards,
Hong Hu

_______________________________________________
LLVM Developers mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev