Lazily-generated currying thunks will require the same IR-level linkonce_odr linkage as clang thunks currently do, so generalize the name of the existing SIL-level linkage specifier 'clang_thunk'.
Swift SVN r8122
ObjC methods are already tagged with a special calling convention and have special IRGen handling to keep the _cmd argument abstracted away from SIL. We can use the CC to also abstract away the detail that Swift methods pass 'self' last but ObjC methods pass 'self' first. This eliminates a weird special case from SIL's perspective, and also means that 'partial_apply' can work on objc methods correctly without becoming significantly more complex.
Swift SVN r8091
The dynamic_method_br instruction branches depending on whether a
particular object can accept a given message, as determined at
runtime. If the object can accept the message, it branches to the
first basic block, providing the uncurried method as the BB
argument. If the object cannot accept the message, it branches to the
second basic block. Either way, the result is packaged up into an
optional type and passed along to the continuation block, which
provides the optional result.
Note that this instruction is restricted to lookup of Objective-C
methods.
Documentation and IR generation (via -respondsToSelector) to
follow. Review greatly appreciated!
Swift SVN r8065
The dynamic_method instruction handles method lookup on an existential
of type DynamicLookup based on the selector of an [objc] method of a
class or protocol. It is only introduced in the narrow case where we
are forcing a use of the method with '!', e.g.,
class X {
func [objc] f() { println("Dynamic lookup") }
}
var x : DynamicLookup = X()
x.f!()
Swift SVN r8037
Auto generated location should not be a separate location kind since
we might have different kinds of auto generated locations (ex: cleanup,
return). Even though the kind info might not be necessary for diagnostics or
debug info, it allows us to better use type system, for example, only pass
CleanupLocation where expected.
Swift SVN r7816
We mark the branch instructions leading into single epilog code with ReturnLocation/ImplicitReturnLocation. If SIL Gen simplifies the code and merges the code representing the return into the epilog block, the terminator of the epilog block (the ReturnInst) will have the return location info on it. Otherwise, the ReturnInst has the RegularLocation, which represents the enclosing FunctionExpr or Constructor/Destructor Decls.
(I've discussed dropping the optimization from SILGen, and keeping the epilog code canonical, with Adrian; but he said that there might not be any wins in doing so, so keeping it for now.)
Added AutoGeneratedLocation to represent segments of code generated by SILGen. This will be used for thunks and other auto-generated segments.
Swift SVN r7634
This is was a very mechanical patch where I basically first renamed SILNodes.def
and then just kept fixing things until everything compiled, so even though it is
large patch I feel ok(ish) with committing it.
If anyone has any concerns/etc, please email me and I will revert in 1 second.
Swift SVN r7604
Because union layout may interleave tag bits with payload data, we need to be able to efficiently inject and remove tag bits from an address-only union in-place. To do this, we'll model address-only union initialization by projecting out the data address (union_data_addr) and storing to it, then overlaying the tag bits (inject_union_addr). To dispatch and project out the data, we'll use a destructive_switch_union_addr instruction that clears any tag bits in-place necessary to give a valid data address.
Swift SVN r7589
The instruction represents constructing a loadable union given a case and the data for that case, which will let us emit union constructor functions in SIL instead of IRGen (rdar://problem/14773182).
Swift SVN r7558
This commit changes the Swift demangler to produce a tree-like list of tokens instead of a string.
This is mostly useful for LLDB since we can use the inherent structure in a Swift mangled name to make more informed decisions about matters such as type information extraction from modules
The ability to convert the tokenized output into a plain string for viewing purposes is of course preserved
Swift SVN r7297
Modify SILPrinter to print the generic function type for specialize.
TODO: the testing case needs uniquing of PolymorphicFunctionType. Right now,
we will get a type mismatch between two copies of the same
PolymorphicFunctionType.
Swift SVN r7097
TODO: Conformances are currently not included in SIL.rst for init_existential
or init_existential_ref, but they exist in InitExistentialInst and
InitExistentialRefInst.
Swift SVN r7076
Added a -v(verbose) option to swift that will trigger verbose printing in SIL
Printer. SIL Printer will print the location info only in the verbose mode.
Here is the example of the format - only the line and colon are displayed for
brevity:
%24 = apply %13(%22) : $[cc(method), thin] ((), [byref] Bool) -> Builtin.Int1 // user: %26 line:46:10
(This will be used to test the validity of SILLocation info.)
Swift SVN r6991
In SILParser, factor out lookupTopDecl and lookupMember.
lookupTopDecl finds the top-level ValueDecl or Module given a name and
lookupMember finds the ValueDecl given a type and a member name.
Update comments for parseSILDeclRef to match SIL.rst.
We now handle the case where the first component of a dotted path is a
module.
In SILPrinter, print the full path for builtin_function_ref, also
"!" is optional when printing SILDeclRef.
Swift SVN r6926
Have project_existential return $*This instead of $Builtin.OpaquePointer, and have protocol_method do the same for methods of opaque protocols. This makes it easier for passes to reason about the semantics of the projected address, since it's restricted by the semantics of SIL addresses.
Swift SVN r6872
Added types when printing these args in the SIL printer.
As a side effect, I've removed the assertions that check
that we have the correct number of arguments in the Branch instruction
creation routines. The reason is that we do not have a complete block when
parsing and creating the branch instruction and it is possible to add
arguments to a basic block after creation. The assertion will be checked
by the SIL verifier.
Swift SVN r6818
Modules can be in either 'Raw' or 'Canonical' form, with different invariants on each. We don't actually distinguish those invariants yet, but this patch adds the field to SILModule and adds a "sil_stage" declaration to SIL printer/parser syntax.
Swift SVN r6793
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!
Swift SVN r6783
Add a getBits() method to FloatLiteralInst so we don't need to round trip APInt -> APFloat -> APInt to print the bits in the printer. Use allocateLiteralInstWithBitSize instead of -WithTextSize to avoid wasting space.
Swift SVN r6680