[llvm-dev] How can I get the opcode length of an IR instruction in LLVM?

Mohsen Ahmadvand via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 27 07:24:19 PST 2017


I need to get the offset and the exact length of opcode corresponding to 
a particular LLVM IR instruction in x86 architecture. I believe for this 
I must hack in backends.

I assume there is a way when the opcodes are being generated in x86 
backend to dump their offsets and sizes. However, considering 
optimizations and translation of one IR instruction to multiple 
operations, I'm not sure whether the relation between a single IR 
instruction and its corresponding opcode is maintainable or not.

My questions are:

  * Is this in general possible?
  * How to hack the backend to dump the required informations? Is there
    a generic way to do so, or do I need to hack all backends?

Thanks a lot.

Mohsen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170227/6b25fb6c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5156 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170227/6b25fb6c/attachment.bin>


More information about the llvm-dev mailing list