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
Represent it as an implicit_convert instruction since it has no runtime representation effect. Factor out the common implicit conversion code among the other ImplicitConversionExpr subtypes.
Swift SVN r3510
Proper handling of existentials requires address-only types. For now, we can implement proper initialization of an existential in memory then "load" it as a hack so we can move on with other nodes.
Swift SVN r3509
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
Handle ExistentialMemberRef for methods by emitting ExistentialMethodInst, similar to ArchetypeMemberRef. Properties still need to be implemented.
Swift SVN r3507
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
Use ArchetypeMethodInst to implement ArchetypeMemberRefExprs that reference methods. Properties are not yet handled. Fix up ArchetypeInst implementation a bit to substitute the "This" type in the method type and to accept archetype-metatypes in addition to archetype addresses.
Swift SVN r3503
LValue components can't derive their member types from the type decl because a generic type decl has unbound type vars. Get the type for the MemberRef lvalue component from the expr. Add a RequalifyComponent type because we don't fake the right LValueType qualifiers anymore.
Swift SVN r3500
When deriving the specialized subscript accessor type from a generic subscript, we can't get the index type from the decl, because its type variables will be unbound. Get the type from the index expression node instead.
Swift SVN r3499
According to John, the AST representation of type variable values, which currently appear as GenericMemberRefExprs on the generic metatype, might be wrong. For now, I'll handle these by emitting metatype instructions on the type variable type, which should work because the method already has a local type variable representing the same variable.
Swift SVN r3497
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
Add visitors for GenericMemberRefExpr so that accessors to generic physical members with monomorphic types work. Access to members with generic types still requires proper archetype support. Access to logical properties currently breaks because of a bug in the generation of property method types.
Swift SVN r3480
If a ScalarToTupleExpr is building a multiple-element tuple with default arguments, it's not valid for an apply expression to peek through it to directly generate its argument. Check that a ScalarToTupleExpr result actually has a single element before applying the special case.
Swift SVN r3470
Properties don't need to do the load/retain/store/release dance of physical elements; the setter handles all of that. Rename emitStoreToLValue to emitAssignToLValue, and push the physical reassignment logic into emitAssignToLValue. Dump the old emitAssign since emitAssignToLValue now does everything it used to do. Add a FullExpr scope to the left-hand side of AssignStmts so their temporaries have better-fitting lifetimes.
Swift SVN r3461
In the SILGenLValue visitor, stop when we see a subexpression that has a reference type and use the result of that expression to root the lvalue expression. This allows rvalue reference type expressions like `foo().bar = bas` to work.
Swift SVN r3460
Split CleanupMaterialize into CleanupMaterializeAlloc and CleanupMaterializeValue. Have emitMaterialize, emitGetProperty, and other methods that create materialize buffers return a new Materialize type, which has a consume() method to disable the CleanupMaterializeValue cleanup, load the value, and return it as a ManagedValue for the caller to consume.
Swift SVN r3458
emitReleaseRValue is smart enough to do nothing with trivial types, but a useless load instruction was still being generated for cleaning up materializes. Don't do that.
Swift SVN r3455
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
Generalize a bunch of code that assumed address-of-value-type for the "this" side of properties to accept reftypes as well. Use RefElementAddrInst to extract physical elements of reference types. Fix an off-by-one in the writeback logic in emitStoreToLValue so that writeback chains properly terminate at the deepest value type component below a reference type component.
Swift SVN r3445
Visit ApplyExpr arguments with SILGenLValue. If the resulting path is purely physical, pass it through to the function. If the path has logical components, materialize the logical property and write it back after applying the function.
Swift SVN r3441
SILGenFunction::emitConstantRef was returning a retained reference to local closures, but SILGenLValue saves off the reference and retains it as needed, leading to an extra retain that was never cleaned up. Add a SILGenFunction::emitUnmanagedConstantRef that returns a local or global constant value without retaining a local constant.
Swift SVN r3439
Steal the 'LValue' type from irgen, which describes a logical lvalue as a path through physical and logical accessor expressions, such as member ref, tuple element, and subscript operations. Implement a SILGenLValue visitor that builds logical lvalues for lvalue contexts. Implement assignment using SILGenLValue to visit the left-hand side of assignment statements. Still to be implemented: subscript expressions and byref function arguments.
Swift SVN r3437