diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-08-20 06:00:58 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-08-20 06:00:58 +0000 |
commit | 0220904e7ad2936d0bd4fd659c9ee7508f38dacc (patch) | |
tree | 6549bfc9d4de9d031c5395fc71fa86e4198ebd45 /llvm/lib/Bytecode/Reader/Reader.cpp | |
parent | 2b4b4a577ad5ce9a8fe862a43e2009455d99304a (diff) | |
download | bcm5719-llvm-0220904e7ad2936d0bd4fd659c9ee7508f38dacc.tar.gz bcm5719-llvm-0220904e7ad2936d0bd4fd659c9ee7508f38dacc.zip |
Packed types, brought to you by Brad Jones
llvm-svn: 15938
Diffstat (limited to 'llvm/lib/Bytecode/Reader/Reader.cpp')
-rw-r--r-- | llvm/lib/Bytecode/Reader/Reader.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp index 85a890dbc43..a9dbe9d5455 100644 --- a/llvm/lib/Bytecode/Reader/Reader.cpp +++ b/llvm/lib/Bytecode/Reader/Reader.cpp @@ -1170,6 +1170,12 @@ const Type *BytecodeReader::ParseType() { Result = ArrayType::get(ElementType, NumElements); break; } + case Type::PackedTyID: { + const Type *ElementType = readSanitizedType(); + unsigned NumElements = read_vbr_uint(); + Result = PackedType::get(ElementType, NumElements); + break; + } case Type::StructTyID: { std::vector<const Type*> Elements; unsigned Typ = 0; @@ -1396,6 +1402,20 @@ Constant *BytecodeReader::ParseConstantValue(unsigned TypeID) { return Result; } + case Type::PackedTyID: { + const PackedType *PT = cast<PackedType>(Ty); + unsigned NumElements = PT->getNumElements(); + unsigned TypeSlot = getTypeSlot(PT->getElementType()); + std::vector<Constant*> Elements; + Elements.reserve(NumElements); + while (NumElements--) // Read all of the elements of the constant. + Elements.push_back(getConstantValue(TypeSlot, + read_vbr_uint())); + Constant* Result = ConstantPacked::get(PT, Elements); + if (Handler) Handler->handleConstantPacked(PT, Elements, TypeSlot, Result); + return Result; + } + case Type::PointerTyID: { // ConstantPointerRef value... const PointerType *PT = cast<PointerType>(Ty); unsigned Slot = read_vbr_uint(); |