Commit Graph

812 Commits

Author SHA1 Message Date
Manman Ren
39ff7707ea SIL Serialization: handle branch instructions.
Swift SVN r8428
2013-09-18 23:37:47 +00:00
Manman Ren
6eab362023 SIL Serialization: handle more SILInstructins.
Handle the following SILInstructions:
DeallocBoxInst ArchetypeMetatypeInst ClassMetatypeInst ProtocolMetatypeInst
AllocRefInst DeallocRefInst StoreWeakInst AssignInst

Add an optional 2-bit field for instruction attributes to
SILOneValueOneOperandLayout.


Swift SVN r8418
2013-09-18 21:03:01 +00:00
Manman Ren
6178f3b4d1 SIL Serialization: handle more SILInstructins.
Handle the following SILInstructions:
LoadWeakInst,
Checked Conversion instructions:
  DowncastInst, SuperToArchetypeRefInst,
  DowncastArchetypeAddrInst, DowncastArchetypeRefInst,
  ProjectDowncastExistentialAddrInst, DowncastExistentialRefInst

Add an optional 2-bit field for instruction attributes to SILOneOperandLayout
and SILOneTypeOneOperandLayout.

Update SILPrinter to print [take] for LoadWeakInst.


Swift SVN r8416
2013-09-18 20:28:54 +00:00
Manman Ren
86a0721c48 SIL Serialization: handle more SILInstructins.
ProjectExistentialInst, ProjectExistentialRefInst
StrongRetainAutoreleasedInst, AutoreleaseReturnInst,
StrongRetainUnownedInst, UnownedRetainInst, UnownedReleaseInst


Swift SVN r8415
2013-09-18 19:51:35 +00:00
Manman Ren
7b631ad74c SIL Serialization: handle float_literal and string_literal.
Also add command line argument to disable sil serialization by default,
use enable-sil-serialization to enable it.


Swift SVN r8413
2013-09-18 19:31:22 +00:00
Manman Ren
b78939e748 SIL Serialization: handle partial_apply.
Add command line argument -sil-link-all and -sil-serialize-all for testing
purpose.

Do not create new SILFunction for de-serialized SIL, instead update the
existing declaration with the de-serialized SILFunction.

Add testing case to cover partial_apply.


Swift SVN r8410
2013-09-18 18:51:04 +00:00
Manman Ren
2287c78778 SIL Serialization: handle more conversion instructions.
Swift SVN r8374
2013-09-18 00:32:40 +00:00
Manman Ren
8cd676143a SIL Serialization: handle more SILInstructions
Add serialization/deserialization of the following SILInstructions:
BuiltinFunctionRefInst, IndexRawPointerInst, ModuleInst,
Conversion instructions:
  RefToObjectPointerInst, UpcastInst, CoerceInst, AddressToPointerInst,
  PointerToAddressInst, ObjectPointerToRefInst, RefToRawPointerInst,
  RawPointerToRefInst, RefToUnownedInst, UnownedToRefInst
DestroyAddrInst, LoadInst, StrongReleaseInst, StrongRetainInst,
TupleElementAddrInst, TupleExtractInst

Make getModule in ModuleFile public to be used by SILDeserializer, also
make addModuleRef in Serializer public to be used by SILSerializer.

Update testing case to cover the above SILInstructions.


Swift SVN r8372
2013-09-18 00:25:23 +00:00
Adrian Prantl
e3b30dbbf9 Silence a couple more warnings.
Swift SVN r8347
2013-09-17 20:29:13 +00:00
Manman Ren
e3f542cf73 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
2013-09-17 18:39:20 +00:00
Manman Ren
8d3c48874c SIL Serialization: able to serialize then deserialize a simple SIL function.
Add implementation to deserialize SILBasicBlock and some SILInstructins.
Add handling of local SIL values.
Add serialization of SILType category and SILValue result number.


Swift SVN r8292
2013-09-16 20:44:57 +00:00
Manman Ren
fa0acc9328 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
2013-09-13 17:44:41 +00:00