[llvm-commits] Fix opcodes in C bindings

Török Edwin edwintorok at gmail.com
Mon Oct 3 06:38:59 PDT 2011


Hi,

LLVMOpcode is out of sync with getOpcode() right now (was ok in 2.9 AFAICT).

Attached patch introduces a function to map between Instruction::* opcodes and the opcodes declared in llvm-c/Core.h.
It does that by using the macros in Instruction.def, so that it will always be up-to-date as internal opcodes change.
When a new opcode is introduced you'll get a compile error in Core.cpp and will have to add it to llvm-c/Core.h
as well (at the end of the other opcodes). This way the C API opcodes can't get out-of-sync.

The 2nd patch adds an LLVMGetInstructionOpcode to the C API, to allow it to inspect, not just create instructions.

Best regards,
--Edwin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-require-C-bindings-opcode-numbers-to-be-kept-i.patch
Type: text/x-patch
Size: 3486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111003/d904b22b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_getopcode.patch
Type: text/x-patch
Size: 1153 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111003/d904b22b/attachment-0001.bin>


More information about the llvm-commits mailing list