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

Reid Spencer reid at x10sys.com
Tue Feb 27 18:26:05 PST 2007



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.241 -> 1.242
---
Log message:

Implement reading of arbitrary precision integers.


---
Diffs of the changes:  (+9 -4)

 Reader.cpp |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.241 llvm/lib/Bytecode/Reader/Reader.cpp:1.242
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.241	Wed Feb 14 21:39:18 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Tue Feb 27 20:25:48 2007
@@ -1264,8 +1264,14 @@
         error("Invalid constant integer read.");
       Result = ConstantInt::get(IT, Val);
       if (Handler) Handler->handleConstantValue(Result);
-    } else 
-      assert(0 && "Integer types > 64 bits not supported");
+    } else {
+      uint32_t numWords = read_vbr_uint();
+      uint64_t *data = new uint64_t[numWords];
+      for (uint32_t i = 0; i < numWords; ++i)
+        data[i] = read_vbr_uint64();
+      Result = ConstantInt::get(IT, APInt(IT->getBitWidth(), numWords, data));
+      if (Handler) Handler->handleConstantValue(Result);
+    }
     break;
   }
   case Type::FloatTyID: {
@@ -1356,8 +1362,7 @@
   // to a null value in a way that isn't predicted when a .bc file is initially
   // produced.
   assert((!isa<Constant>(Result) || !cast<Constant>(Result)->isNullValue()) ||
-         !hasImplicitNull(TypeID) &&
-         "Cannot read null values from bytecode!");
+         !hasImplicitNull(TypeID) && "Cannot read null values from bytecode!");
   return Result;
 }
 






More information about the llvm-commits mailing list