This is inconsistent with ElementAddr and Extract, but allows all the hairy logic of accessing class fields in IRGen to stand without a bunch of pointless refactoring.
Swift SVN r3778
ExistentialMethod -> ProtocolMethod for better specificity.
[De]AllocExistential -> [De]InitExistential because it doesn't necessarily allocate anything.
Swift SVN r3710
Generate explicit destructors by emitting their bodies then emitting release sequences for the class's members. Eventually we'll need to also emit implicit destructors for classes without explicit destructors and to chain a call to the base class destructor, which will require adding a new linkable entity flag onto SILConstant for destructors, similar to getter/setters.
Swift SVN r3655
Add an instruction to represent super-to-archetype downcasts. Since archetypes are address-only, it needs to take a reference to the destination archetype as a parameter.
Swift SVN r3643
Needed to represent deinitializing a partially-initialized existential in which the value witness table has been populated by alloc_existential but the value has not been initialized yet.
Swift SVN r3565
Move SILType to its own header, and make it its own container type consisting of a Type with an "isAddress" bit for representing address types. Move the "isAddressOnly" information from SILGen's TypeInfo onto SILType as a second bit, because address-only-ness is extremely useful for verification outside of SILGen. Instead of mangling function types during type lowering, rely on the fact that SILType is no longer a Type to force us to mangle argument and return types when we see them. (We may eventually need SILFunctionType and SILTupleType things to represent lowered SIL function and tuple types containing addresses, but for now we can lower function and tuple components as needed.)
Swift SVN r3551
Change over SIL Values and Instructions to work in terms of SILTypes, and update SILGen to lower types where needed. Add LValueType logic to SILType lowering to get rid of those annoying lvalue qualifiers so we can ignore RequalifyExprs. Tighten up the XFAILs in the SIL tests and disable the checks that currently crash.
Swift SVN r3538
Determining constant types requires help from SILGen because of address-only types, and the type of a constant after SILGen should always be readily available from the ConstantRefInst. Initialize SIL Function objects with their lowered type as well so that it's available to IRGen and SIL passes.
Swift SVN r3526
ProjectExistential derives the value pointer from an existential, and AllocExistential initializes an existential's witness tables and allocates its value. Tweak SILGen's handling of ExistentialMemberRefExprs to emit a project_existential between querying the method and applying it.
Swift SVN r3508
Pass down the AST type from the ArchetypeMemberRefExpr, which has the right locally-bound archetypes, rather than derive the method type from the decl.
Swift SVN r3504
Add instructions to represent type coercion and downcast conversion operations. Factor out a common ConversionInst base class for Convert and these instructions, and rename ConvertInst to ImplicitConvertInst to distinguish it from these new explicit conversion instructions.
Swift SVN r3490
Have SpecializeInst own its Substitution array so that a SpecializeInst can be instantiated independently of a backing SpecializeExpr in the AST.
Swift SVN r3483
Subscripts are just another kind of property. Refactor some logic from ApplyExpr codegen to visit index arguments consistently with apply arguments. Also move the logic for determining SIL constant types onto SILModule because it's too hairy to calculate on the fly.
Swift SVN r3452
If the operand of a TupleElementExpr is an lvalue, derive the address of the element from the operand rather than try to extract a value from it as the code was doing before.
Swift SVN r3392
We need something more general than ValueDecl to be able to talk about anonymous functions, curried entry points, etc. as SIL constants. SILConstant is a (ValueDecl | CapturingExpr) union with an additional index for discriminating multiple instances or entry points derived from the same AST entity. Update ConstantInst and SILModule's function table to be keyed by SILConstant rather than ValueDecl.
Swift SVN r3372
Local constants (such as local FuncDecls) are never modifiable so can be captured by value. Give the local constant value to the closure when visiting a local FuncDecl, and in the function body, register the corresponding closure context argument as a local constant for that context.
Swift SVN r3369
Associate the closure object for a local FuncDecl with the FuncDecl rather than with the DeclRefExpr. Move the closure creation code into SILGenFunction::visitFuncDecl, and add a LocalConstants map to SILGenFunction to store closures generated from local decls. Add a constructor to ConstantRefInst to allow it to be associated directly with ValueDecls in addition to DeclRefExprs.
Swift SVN r3368
Create a SILModule type, and lift ownership of TU-global things like the bump allocator and type list uniquing from Function to SILModule. Move the ad-hoc SIL dumping logic out of main() into SILModule and into a new SILGenModule class.
Swift SVN r3324
Remove the AllocTmp instruction and represent MaterializeExpr allocations using 'alloc_var stack'/'dealloc_var stack' instructions. Rename Dealloc to DeallocVar, and add an AllocKind attribute to AllocVar and DeallocVar. Update MaterializeExpr SILGen to generate an AllocVar with a DeallocVar cleanup instead of AllocTmp. Tweak SILPrinter's presentation of AllocVar and DeallocVar to be in line with what SIL.rst claims.
Swift SVN r3311
Now that it's being used on both tuples and structs, the current name doesn't make much sense. SIL.rst specifies a unified set of extract/insert/gep instructions that operate on either tuples or nominal fragile structs.
Swift SVN r3303
Build some infrastructure for handling retain/release/copy/destroy of values. Use this to retain values when storing them into boxes and to clean up reference type arguments on function exit. Right now this just stupidly assumes "value type is trivial, reference type is retained/released", but it eventually needs to handle address-only types using the indirect copy_addr/destroy_addr instructions and to handle loadable value types with reference members by retaining the proper members. Passing arguments to function calls, reassignment, and cleanup of full expression temporaries all still need implementation.
Swift SVN r3267
Update codegen for local variables and arguments to use the new alloc_box instruction to allocate retainable storage for the variables and to release the boxes when the variables go out of scope. Update tests to check for alloc_box and release sequences instead of alloc_var.
Swift SVN r3242
return values. Now the base class of the value hierarchy is "ValueBase"
instead of "Value", and "Value" is now a PointerIntPair indicating the
ValueBase (e.g. an instruction) being referenced along with what result
value is being referenced.
By default, any place you used "Value*" before, you should now use "Value".
Swift SVN r3207
Add RetainInst, ReleaseInst, DeallocInst for managing object lifetimes, and CopyInst and DestroyInst for indirectly managing resilient types and other non-materializable types.
Swift SVN r3159