diff options
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r-- | llvm/lib/Bytecode/Reader/ConstantReader.cpp | 13 | ||||
-rw-r--r-- | llvm/lib/Bytecode/Writer/ConstantWriter.cpp | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Bytecode/Reader/ConstantReader.cpp b/llvm/lib/Bytecode/Reader/ConstantReader.cpp index baa367d52b8..ae206daa370 100644 --- a/llvm/lib/Bytecode/Reader/ConstantReader.cpp +++ b/llvm/lib/Bytecode/Reader/ConstantReader.cpp @@ -250,7 +250,7 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf, } 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 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf, 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 '" diff --git a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp b/llvm/lib/Bytecode/Writer/ConstantWriter.cpp index 24ceaecf2e2..dde47d52b11 100644 --- a/llvm/lib/Bytecode/Writer/ConstantWriter.cpp +++ b/llvm/lib/Bytecode/Writer/ConstantWriter.cpp @@ -141,6 +141,11 @@ bool BytecodeWriter::outputConstant(const ConstPoolVal *CPV) { break; } + case Type::PointerTyID: { + output_vbr((unsigned)0, Out); + break; + } + case Type::FloatTyID: { // Floating point types... float Tmp = (float)((const ConstPoolFP*)CPV)->getValue(); output_data(&Tmp, &Tmp+1, Out); |