[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Reid Spencer reid at x10sys.com
Fri Nov 17 20:37:34 PST 2006



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.205 -> 1.206
---
Log message:

Have ConstantExprs upgrade opcodes the same way as instructions.


---
Diffs of the changes:  (+11 -1)

 Reader.cpp |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletion(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.205 llvm/lib/Bytecode/Reader/Reader.cpp:1.206
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.205	Mon Nov 13 22:47:22 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Fri Nov 17 22:37:19 2006
@@ -1506,9 +1506,19 @@
       Opcode = 10; // Div
     else if (Opcode >=13 && Opcode <= 15) // URem through FRem
       Opcode = 11; // Rem
-    else if (Opcode > 15)  // Everything above FRem
+    else if (Opcode >= 16 && Opcode <= 35)  // And through Shr
       // Adjust for new instruction codes
       Opcode -= 4;
+    else if (Opcode >= 36 && Opcode <= 42) // Everything after Select
+      // In vers 6 bytecode we eliminated the placeholders for the obsolete
+      // VAARG and VANEXT instructions. Consequently those two slots were
+      // filled starting with Select (36) which was 34. So now we only need
+      // to subtract two. This circumvents hitting opcodes 32 and 33
+      Opcode -= 2;
+    else {   // Opcode < 10 or > 42
+      // No upgrade necessary.
+      return 0;
+    }
   }
 
   switch (Opcode) {






More information about the llvm-commits mailing list