SIL Serialiation: add implementation to deserialize SIL and a wrapper class

SerializedSILLoader to hold a list of SIL deserializers.

Also add an intial implementation of a linking pass that is run right after
SILGen to link the declaration of SILFunction to the actual definition in
the serialized module.

We add two blocks to the serialized module: a sil index block that
maps identifier to a function ID and also holds a list of function offsets,
and a sil block for the actual SILFunctions. We can probably use subblock
instead of two top-level blocks.

The serialization/de-serialization of the function hash table and the function
offsets are implemented. But we are missing handling of types (see FIXME in
the code).

ModuleFile::Serialized is made public to be used by SIL deserializer, as well
as ModuleFile::getType.

The SIL deserializer holds a pointer to the ModuleFile, it gets the sil cursor
and the sil index cursor from the ModuleFile. The other option is for SIL
deserializer to find the start of the two sil blocks within itself, thus having
less coupling with ModuleFile.

No testing case yet because we are missing handling of types.


Swift SVN r8206
This commit is contained in:
Manman Ren
2013-09-13 17:44:41 +00:00
parent c2c367b12a
commit fa0acc9328
14 changed files with 534 additions and 51 deletions

View File

@@ -408,8 +408,23 @@ ModuleFile::ModuleFile(llvm::OwningPtr<llvm::MemoryBuffer> &&input)
break;
}
// FIXME: for now, skip the SIL block.
case SIL_INDEX_BLOCK_ID: {
// Save the cursor.
SILIndexCursor = cursor;
SILIndexCursor.EnterSubBlock(SIL_INDEX_BLOCK_ID);
// With the main cursor, skip over the block and continue.
if (cursor.SkipBlock())
return error();
break;
}
case SIL_BLOCK_ID: {
// Save the cursor.
SILCursor = cursor;
SILCursor.EnterSubBlock(SIL_BLOCK_ID);
// With the main cursor, skip over the block and continue.
if (cursor.SkipBlock())
return error();
break;