Implement constant pointers, and null specifically in the parser, bytecode writer, and
bytecode reader.

llvm-svn: 668
diff --git a/llvm/lib/Bytecode/Reader/ConstantReader.cpp b/llvm/lib/Bytecode/Reader/ConstantReader.cpp
index baa367d..ae206da 100644
--- a/llvm/lib/Bytecode/Reader/ConstantReader.cpp
+++ b/llvm/lib/Bytecode/Reader/ConstantReader.cpp
@@ -250,7 +250,7 @@
   }
 
   case Type::StructTyID: {
-    const StructType *ST = (const StructType*)Ty;
+    const StructType *ST = Ty->castStructType();
     const StructType::ElementTypes &ET = ST->getElementTypes();
 
     vector<ConstPoolVal *> Elements;
@@ -267,6 +267,17 @@
     break;
   }    
 
+  case Type::PointerTyID: {
+    const PointerType *PT = Ty->castPointerType();
+    unsigned SubClass;
+    if (read_vbr(Buf, EndBuf, SubClass)) return failure(true);
+    if (SubClass != 0) return failure(true);
+
+
+    V = ConstPoolPointer::getNullPointer(PT);
+    break;
+  }
+
   default:
     cerr << __FILE__ << ":" << __LINE__ 
 	 << ": Don't know how to deserialize constant value of type '"