[LLVMdev] Getting load/store byte size
nullnull
null.function at gmail.com
Thu Feb 17 10:06:03 PST 2011
I'm instrumenting memory loads and stores in a LLVM module pass. In this
work, I need to do
(1) Getting memory address of the operand, (Looks I've done correctly)
(2) Getting memory read/write size, (Question)
(3) Location id of the load/store instruction. (Easy, I've done)
For example, say that I'm reading a local variable 'a':
%1 = load i32* %a, align 4
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.
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.
Question:
[1] How can I retrieve the read/write size of load/store instruction?
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).
Question:
[2] What would be the maximum size of load/store operand?
Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110217/4c409f59/attachment.html>
More information about the llvm-dev
mailing list