SIL Serialization: perform SIL linking right after SILGen.

Add a SILLinkage mode "Deserialized" to make sure IRGen will emit
hidden symbols for deserialized SILFunction.

Inside SIL linker, set Linkage to external if we only have a declaration for
a callee function.

Both sil block and decl block in a module can emit an array of substitutions.
To share the serialization between SILSerializer and Serializer, we modify
the interface to pass in the abbreviation codes to write functions and to
pass in a cursor to read functions.

We now correctly handle the serialization of Substitutions in SpecializeInst.

For a deserialized SILFunction, we now temporarily set its SILLocation and 
DebugScope to an empty FileLocation. Once mandatory inliner sets the SILLocation
to the location of ApplyInst, a null SILLocation and a null DebugScope
may work for a deserialized SILFunction.

Update testing cases to reflect that we are now inlining transparent functions
from modules, or to disable SILDeserializer for now (I am not sure how to update
those testing cases).


Swift SVN r8582
This commit is contained in:
Manman Ren
2013-09-24 00:44:54 +00:00
parent 65f5a901e2
commit be3a4101ed
12 changed files with 156 additions and 94 deletions

View File

@@ -222,7 +222,8 @@ private:
ProtocolConformance *
readUnderlyingConformance(ProtocolDecl *proto,
serialization::DeclID typeID,
serialization::IdentifierID moduleID);
serialization::IdentifierID moduleID,
llvm::BitstreamCursor &Cursor);
/// Recursively reads a protocol conformance from \c DeclTypeCursor.
///
@@ -232,12 +233,7 @@ private:
/// If the record at the cursor is not a protocol conformance, returns
/// Nothing. Note that a null pointer is a valid conformance value.
Optional<std::pair<ProtocolDecl *, ProtocolConformance *>>
maybeReadConformance(Type conformingType);
/// Reads a substitution record from \c DeclTypeCursor.
///
/// If the record at the cursor is not a substitution, returns Nothing.
Optional<Substitution> maybeReadSubstitution();
maybeReadConformance(Type conformingType, llvm::BitstreamCursor &Cursor);
/// Reads a generic param list from \c DeclTypeCursor.
///
@@ -389,6 +385,11 @@ public:
/// If the name matches the name of the current module, a shadowed module
/// is loaded instead. An empty name represents the Builtin module.
Module *getModule(Identifier name);
/// Reads a substitution record from \c DeclTypeCursor.
///
/// If the record at the cursor is not a substitution, returns Nothing.
Optional<Substitution> maybeReadSubstitution(llvm::BitstreamCursor &Cursor);
};
class SerializedModule : public LoadedModule {