Make ApplyInst and PartialApplyInst directly take substitutions for generic functions instead of trying to stage out substitutions separately. The legacy reasons for doing this are gone.
Swift SVN r8747
Replace the existing suite of checked cast instructions with:
- unconditional_checked_cast, which performs an unconditional cast that aborts on failure (like the former downcast unconditional); and
- checked_cast_br, which performs a conditional pass and branches on whether the cast succeeds, passing the result to the true branch as an argument.
Both instructions take a CheckedCastKind that discriminates the different casting modes formerly discriminated by instruction type. This eliminates a source of null references in SIL and eliminates null SIL addresses completely.
Swift SVN r8696
We generate a module from .sil, then deserialize the module using
sil-link-all.
Fix serialization and deserialization of CopyAddrInst.
Fix serialization of ProjectExistentialRefInst.
Add registration of ReferenceStorageTypeLayout, which we forgot to register.
We now have testing coverage of 70+ SILInstructions.
Swift SVN r8635
Also fix serialization of ProjectExistentialRefInst. Add asserts
in SIL deserializer to make sure SIL serializer is using the
correct layout.
Swift SVN r8598
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 mirrors the behavior of project_existential and simplifies some special cases in SILGen. It unfortunately makes dynamic_lookup sequences a bit noisier because of the need to explicitly cast the projection from DynamicLookup.Self to Builtin.ObjCPointer, but I think this modeling is more solid and will fit better with my planned redesign of archetype_method/protocol_method.
Swift SVN r8572
Clear up data for basic blocks and local values at beginning of
handling a SILFunction.
Fix a bug in handling of StructElementAddr and add testing cases for
enum, initialize_var and struct_element_addr.
Fix a problem in handling types of a SILArgument.
Turn SIL serialization on by default, add a command line "enable-sil-linking"
to turn on SIL deserialization.
Also for readability, change from Name.ResultVal != ~0U to !Name.isMRV()
in SILParser.
Swift SVN r8508
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
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
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
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
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
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
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