mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Added default creation of root-level block by bitstream serializer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -31,7 +31,7 @@ class Serializer {
|
|||||||
MapTy PtrMap;
|
MapTy PtrMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Serializer(BitstreamWriter& stream, unsigned BlockID = 0);
|
Serializer(BitstreamWriter& stream, unsigned BlockID = 8);
|
||||||
|
|
||||||
~Serializer();
|
~Serializer();
|
||||||
|
|
||||||
|
@@ -47,9 +47,28 @@ void Deserializer::ReadRecord() {
|
|||||||
// FIXME: Check if we haven't run off the edge of the stream.
|
// FIXME: Check if we haven't run off the edge of the stream.
|
||||||
// FIXME: Handle abbreviations.
|
// FIXME: Handle abbreviations.
|
||||||
|
|
||||||
// FIXME: Check for the correct code.
|
unsigned Code;
|
||||||
unsigned Code = Stream.ReadCode();
|
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
Code = Stream.ReadCode();
|
||||||
|
|
||||||
|
if (Code == bitc::ENTER_SUBBLOCK) {
|
||||||
|
// No known subblocks, always skip them.
|
||||||
|
unsigned id = Stream.ReadSubBlockID();
|
||||||
|
Stream.EnterSubBlock(id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Code == bitc::END_BLOCK) {
|
||||||
|
bool x = Stream.ReadBlockEnd();
|
||||||
|
assert (!x && "Error at block end.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
assert (Record.size() == 0);
|
assert (Record.size() == 0);
|
||||||
Stream.ReadRecord(Code,Record);
|
Stream.ReadRecord(Code,Record);
|
||||||
assert (Record.size() > 0);
|
assert (Record.size() > 0);
|
||||||
@@ -141,7 +160,7 @@ uintptr_t Deserializer::ReadInternalRefPtr() {
|
|||||||
|
|
||||||
MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId));
|
MapTy::value_type& E = BPatchMap.FindAndConstruct(BPKey(PtrId));
|
||||||
|
|
||||||
assert (!HasFinalPtr(E) &&
|
assert (HasFinalPtr(E) &&
|
||||||
"Cannot backpatch references. Object must be already deserialized.");
|
"Cannot backpatch references. Object must be already deserialized.");
|
||||||
|
|
||||||
return GetFinalPtr(E);
|
return GetFinalPtr(E);
|
||||||
|
Reference in New Issue
Block a user