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

@@ -172,9 +172,6 @@ private:
/// Writes a generic parameter list.
bool writeGenericParams(const GenericParamList *genericParams);
/// Writes a list of generic substitutions.
void writeSubstitutions(ArrayRef<Substitution> substitutions);
/// Encode the underlying conformance of a generic or specialized
/// conformance.
///
@@ -195,12 +192,14 @@ private:
/// Writes a protocol conformance.
void writeConformance(const ProtocolDecl *protocol,
const ProtocolConformance *conformance,
const Decl *associatedDecl);
const Decl *associatedDecl,
const std::array<unsigned, 256> &abbrCodes);
/// Writes a list of protocol conformances.
void writeConformances(ArrayRef<ProtocolDecl *> protocols,
ArrayRef<ProtocolConformance *> conformances,
const Decl *associatedDecl = nullptr);
const Decl *associatedDecl,
const std::array<unsigned, 256> &abbrCodes);
/// Writes an array of members for a decl context.
///
@@ -291,6 +290,11 @@ public:
/// \returns The ID for the identifier for the module's name, or 0 for the
/// builtin module.
IdentifierID addModuleRef(const Module *M);
/// Writes a list of generic substitutions. abbrCode is needed to support
/// usage out of decl block.
void writeSubstitutions(ArrayRef<Substitution> substitutions,
const std::array<unsigned, 256> &abbrCodes);
};
} // end namespace serialization
} // end namespace swift