mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Packed types, brought to you by Brad Jones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user