I'm changing bytecode format a little bit, i.e. for 2 operands
Instructions, the original is like this:
    01-00:Opcode type
    15-08: Instruction type
    23-16: Operand#1
    31-24: Operand#2
My change is like this:
    01-00:Opcode type
    15-08: Instruction type
    16: myflag1
    17: myflag2
    24-18: Operand#1
    31-25: Operand#2
    I do the corresponding changes in both Writer.cpp and Reader.cpp.But
when I compile, errors take place when "linking comp_genericeh.bc
component..". comp_genericeh.bc is some bytecode in
    I wonder is it because the comp_genericeh.bc is produced by orignal
bytecode format so that the changed bytecode read& write lib cann't
encode and decode it correctly?

Yes, that's right. If you change the bytecode format, you need to rebuild your LLVM tree (which will rebuild the runtime libraries), and then reinstall the libraries. To do this, run

make -C runtime install-bytecode

from your LLVM object directory.


Yup, that's the problem. The best way to handle this is invent a new bytecode version number, and parse the old format when reading a .bc file older than the current version. This is how we handle backwards compatibility when we change the .bc format.