<p>I'm instrumenting memory loads and stores in a LLVM module pass. In this work, I need to do<br>(1) Getting memory address of the operand, (Looks I've done correctly)<br>(2) Getting memory read/write size, (Question)<br>
(3) Location id of the load/store instruction. (Easy, I've done)<br> <br>For example, say that I'm reading a local variable 'a':<br> <br>%1 = load i32* %a, align 4<br> <br>I need to know the address of the variable 'a' and the size. Of course, memory loads/stores could be from general GEP or global variables.<br>
 <br>Getting the address was easily doable by using "PtrToIntInst(load_inst->getPointerOperand(), ...)". However, getting load/store size wasn't that straight forward. In this example, it should be four bytes. I tried to get the Type* from the getPointerOperand() and tried to retrieve the size of the type, but failed.<br>
 <br>Question:<br>[1] How can I retrieve the read/write size of load/store instruction?<br> <br> <br>I have another question. If I can get the size, then what would be the maximum size? Obviously, 1 ~ 8 bytes for built-in types, but wondering even the larger size could be obtained. I suspect a vector load instruction could load up to 32 bytes (= 256 bits, in case of x86 AVX).<br>
 <br>Question:<br>[2] What would be the maximum size of load/store operand?<br> <br> <br>Thank you!</p>