There already is an analogous 3 argument version of
SILBuilder::createStructExtract that works like this.
I use this in the soon to be incoming SILSROA.
Swift SVN r11891
Give TypeConverter methods to push and pop a generic context given a set of generic parameter types and requirements from a generic signature. Dependent types lowered in this context can then be lowered using an ArchetypeBuilder seeded with that signature. The TypeLowering objects created for dependent types are put in a special arena which we clear out when we pop the generic context. This sets the stage for allowing us to lower SILFunctionTypes using their interface types.
Swift SVN r11848
To do this with complete accuracy requires mapping the dependent types into a context, but isOpaque is currently only used as a sanity check in assertions, and a tuple being matched to a class-constrained archetype is an unlikely enough occurrence that it's probably OK to accept this inaccuracy instead of trying to push generic contexts all the way down into isOpaque's clients.
Swift SVN r11824
For now, steal the context generic params from the SILFunctionType, and borrow ArchetypeBuilder's implementation of mapTypeInContext for AST decl contexts. This should eventually be an independent property.
Swift SVN r11811
Originally there was a emitLoweredCopyValue method in TypeLowering, but it was
removed by Chris in r11353 since SILGen was no longer using it and it had bugs.
This method is useful for SILLowerAggregateInstrs, so I resurrected it, fixing
the bugs therein.
The bug was that emitLoweredCopyValue was not reforming aggregates correctly
since it was only considering non-trivial values. The new implementation passes
in all child values, but only recursively lowers the non-trivial children. This
does create an extra tuple_extract, struct_extract for trivial arguments, but
those are easily cleaned up by later dce.
Swift SVN r11753
The idea here is that the aggregate memory operation is lowered deep recursively
for all types except enums which recieve a shallow lowering. This prevents code
bloat due to the deep lowering of an enum requiring the creation of a bunch of
new basic blocks, code bloat which we do not want.
Another thing to note is that this method is actually not used anywhere else
currently, but in case this behavior was left in on purpose I decided to extend
it by adding the enum class flag rather than just changing the underlying
behavior (i.e. making deep not lower enum values).
Swift SVN r11748
with qualifiers on it, we have two distinct types:
- LValueType(T) aka @lvalue T, which is used for mutable values on the LHS of an
assignment in the typechecker.
- InOutType(T) aka @inout T, which is used for @inout arguments, and the implicit
@inout self argument of mutable methods on value types. This type is also used
at the SIL level for address types.
While I detangled a number of cases that were checking for LValueType (without checking
qualifiers) and only meant @inout or @lvalue, there is more to be done here. Notably,
getRValueType() still strips @inout, which is totally and unbearably wrong.
Swift SVN r11727
If there's no script-mode file in a module, don't produce a top_level_code SILFunction for it, and don't consider emitting an LLVM global_ctor for it. We should never emit static constructors from user code anymore.
Swift SVN r11644
The current implementation depends on the target basic block to record the number of argumens, but this is a bad idea because it makes it difficult to modify the argument list.
Swift SVN r11597
Tweak the type lowering code to work when the conforming type is generic. Handle the case of an associated type with protocol requirements being witnessed by an archetype of the conforming type, which results in a null ProtocolConformance pointer in the witnessing substitution.
Swift SVN r11275
When a type conforms to a protocol that refines another protocol, emit the witness table for the base protocol, and drop a reference into the witness table for the derived protocol. Keep track of what conformances we've already emitted so we don't emit redundant witness tables when types conform redundantly to base protocols or have multiple references to a base protocol via a refinement diamond.
Swift SVN r11263
Reuse John's abstraction thunking machinery in SILGenPoly to emit the abstraction change from a protocol requirement to a concrete witness. There are potentially two abstraction changes necessary; if a witness is generic, we need to reabstract again from the concrete substituted type of the witness to the generic witness function's original signature. This currently leads to a bunch of extra temporaries in cases where an argument or return gets unabstracted to a loadable value then reabstracted to a generic parameter, but optimizations should be able to clean this up. Protocol witnesses also have additional potential abstraction changes in their 'self' parameter: the 'self' parameter of the protocol requirement is always considered @inout, but class 'self' parameters are not; also, an operator requirement can be satisfied by a free function, in which case 'self' is discarded.
Also, fix a bug in return value thunking where, if the thunk could reuse its @out parameter as the @out parameter of the underlying function, we would not disable the cleanup we install on the result value, leading to the result getting overreleased.
Swift SVN r11245
location of variables at SIL generation time.
This patch introduces a SILDebuggerClient that
knows how to resolve the locations of variables
that are generated by the debugger. These
variables have a flag on them that only LLDB
sets.
Swift SVN r11230
Walk the ProtocolConformances of type and extension decls to produce SILWitnessTables for them. Work out the type of the witness function by applying substitutions from the witness map and lowering it at the abstraction level of the requirement, then emit a symbol for the witness function (but don't emit the body of the witness function just yet).
Swift SVN r11143
- change SILGenFunction to use Cleanup and Implicit return locations for
auto-generated cleanups/returns where sensible.
- Fix a bug in where ConstructorDecl that would return the wrong
source range.
- Move the expected locations of some errors to the end of the function
where they should belong.
Fixes <rdar://problem/15609768> Line tables for classes that don't have
init but just initialize ivars are odd
Swift SVN r11086
Remove the initialize_var instruction now that DI fully diagnoses initialization problems. Change String-to-NSString bridging to explicitly invoke String's default constructor; it was the last remaining user of initialize_var. Remove dead code to emit an implicit default constructor without a body.
Swift SVN r11066
Allow archetype_method to look up a witness from a concrete ProtocolConformance record. This will allow generic specialization to apply to constrained generic functions independent of archetype_method devirtualization. <rdar://problem/14748543>
Swift SVN r10950
They will always return a thin function with the appropriate witness CC. The metadata pointer, if any, will be passed as part of the witness CC lowering.
Swift SVN r10923
We will generate these in SILGen when we see a NormalProtocolConformance, to provide a mapping of method requirements to witnesses for types.
Swift SVN r10900