[LLVMdev] bytecode

Chris Lattner sabre at nondot.org
Fri Sep 9 09:28:14 PDT 2005


On Fri, 9 Sep 2005 shding at mtu.edu wrote:
> Hi,
>   I'm changing bytecode format a little bit, i.e. for 2 operands
> Instructions, the original is like this:
>    01-00:Opcode type
>    07-02:Opcode
>    15-08: Instruction type
>    23-16: Operand#1
>    31-24: Operand#2
> My change is like this:
>    01-00:Opcode type
>    07-02:Opcode
>    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
> /runtime/GCCLibrary.
>    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?

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.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list