SIL Serialization: handle more SILInstructions

Use a worklist in SIL linking to traverse the newly serialized SILFunction.
Add serialization/deserialization of the following SILInstructions:
AllocArray, Apply, FunctionRef, IntegerLiteral, Metatype, StructExtract,
Struct and Tuple.

Make getDecl and getIdentifier in ModuleFile public to be used by
SILDeserializer, also make addDeclRef and addIdentifierRef in Serializer
public to be used by SILSerializer.

Update testing case to cover the above SILInstructions.

TODO: lookupSILFunction should replace the existing empty SILFunction instead
of creating a new SILFunction.


Swift SVN r8339
This commit is contained in:
Manman Ren
2013-09-17 18:39:20 +00:00
parent 07e83ea49c
commit e3f542cf73
7 changed files with 335 additions and 40 deletions

View File

@@ -258,22 +258,6 @@ private:
/// Returns the decl context with the given ID, deserializing it if needed.
DeclContext *getDeclContext(serialization::DeclID DID);
/// Returns the decl with the given ID, deserializing it if needed.
///
/// \param DID The ID for the decl within this module.
/// \param ForcedContext Optional override for the decl context of certain
/// kinds of decls, used to avoid re-entrant
/// deserialization.
/// \param DidRecord Optional callback, called at some point after the decl
/// has been recorded in the decl table (but not necessarily
/// completed).
Decl *getDecl(serialization::DeclID DID,
Optional<DeclContext *> ForcedContext = {},
std::function<void(Decl*)> DidRecord = nullptr);
/// Returns the identifier with the given ID, deserializing it if needed.
Identifier getIdentifier(serialization::IdentifierID IID);
/// Returns the appropriate module for the given name.
///
/// If the name matches the name of the current module, a shadowed module
@@ -389,6 +373,22 @@ public:
/// Returns the type with the given ID, deserializing it if needed.
Type getType(serialization::TypeID TID);
/// Returns the identifier with the given ID, deserializing it if needed.
Identifier getIdentifier(serialization::IdentifierID IID);
/// Returns the decl with the given ID, deserializing it if needed.
///
/// \param DID The ID for the decl within this module.
/// \param ForcedContext Optional override for the decl context of certain
/// kinds of decls, used to avoid re-entrant
/// deserialization.
/// \param DidRecord Optional callback, called at some point after the decl
/// has been recorded in the decl table (but not necessarily
/// completed).
Decl *getDecl(serialization::DeclID DID,
Optional<DeclContext *> ForcedContext = {},
std::function<void(Decl*)> DidRecord = nullptr);
};
class SerializedModule : public LoadedModule {