These types are needed by enough of the stack now that it makes sense to centralize their lookup and caching onto the AST context like other core types.
Swift SVN r19029
not a struct wrapping an Optional.
Among other things, this means you can now pattern-match on
an IUO. It also makes it more convenient to build and destroy
them.
SILGen's type lowering should probably canonicalize one kind
of optional to the other so that we don't get silly abstraction
costs from conversion.
Swift SVN r18991
info for them and generally clean up the inline scope handling a bit.
Fix the debug scope handling for all clients of SILCloner, especially
the SIL-level spezializers and inliners.
This also adds a ton of additional assertions that will ensure that
future optimization passes won't mess with the debug info in a way that
could confuse the LLVM backend.
Swift SVN r18984
A first element field of a nominal type is either the first element of a
struct or the first payload of an enum. We currently allow the stdlib to
rappel into struct heirarchies using reinterpretCast. This patch teaches
the optimizer how to rewrite such unchecked_addr_cast into
unchecked_enum_data_addr and struct_element_addr instructions. Then
Mem2Reg and Load Store Forwarding will remove the allocation generated
by such uses of reinterpret cast.
<rdar://problem/16703656>
Swift SVN r18977
Rather than calling getSubstitutions() in various places on the apply
that we are cloning the body of, pass the substitution list in
directly when creating the cloner.
This is not interesting for the generic specializer, but is important in
mandatory inlining when we go to inline an apply of a partial apply,
where we need to use the full list of substitutions for both.
Swift SVN r18951
hierarchy. I still need to figure out a reliable way to write testcases
for this. For now it's ensured via an assertion in SILCloner::postprocess.
Swift SVN r18917
instructions. Make them subclasses of RefCountingInst.
This is a useful superclass that enables one to quickly perform queries
on whether or not a specific instruction is an instruction that
manipulates reference counts.
Swift SVN r18891
Mandatory-inlined (aka transparent functions) are still treated as if they
had the location and scope of the call site. <rdar://problem/14845844>
Support inline scopes once we have an optimizing SIL-based inliner
Patch by Adrian Prantl.
Swift SVN r18835
Add objc_metatype_to_object and objc_existential_metatype_to_object to convert metatypes to AnyObject, and objc_protocol to get a reference to an @objc protocol descriptor as a Protocol class instance.
Swift SVN r18824
put the result in a different place.
WIP: no IRGen support yet.
This will eventually be the required form when casting
to an address-only type; the existing instructions will
have only scalar outputs.
Swift SVN r18780
The deserializer holds a reference to the deserialized SILFunction, which
prevents Dead Function Elimination from erasing them.
We have a tradeoff on how often we should clean up the unused deserialized
SILFunctions. If we clean up at every optimization iteration, we may
end up deserializing the same SILFunction multiple times. For now, we clean
up only after we are done with the optimization iteration.
rdar://17046033
Swift SVN r18697
In a loop like this:
var j = 2
for var i = 0; i < 100; ++i {
j += 3
}
it will completely eliminate j.
It does not yet support rewriting conditional branches as unconditional
branches in the cases where only empty blocks are control dependent on
an edge. Once this support is added, it will also completely eliminate
the loop itself.
Swift SVN r18615
I added some helpers to ApplyInst that should hopefully linguistically eliminate
the issue by allowing users of the API to not need to remember that the self
substitution is first, but the self argument is last.
We should really just remove the dichotomy. But that is for after WWDC.
I also disabled devirtualization of inherited protocol conformances for
protocol_methods. This will be less likely to be used than specialized
protocol conformances protocol_method devirtualization (which is
currently).
<rdar://problem/16951124>
Swift SVN r18282
We should never touch the AST from SIL if we don't need to. The specific
added methods are:
1. SILType::isBuiltinNativeObjectType().
2. SILType::isBuiltinRawPointerType().
3. SILType::isBuiltinType().
4. SILType::isBuiltinIntegerType().
5. SILType::isBuiltinFloatType().
6. SILType::isGenericType(). This supersedes the hasUnboundGenerics
function in Local.h. After WWDC, we should remove that method but I
don't want to update random parts of the SILPasses.
7. SILType::aggregateContainsRecord. Enables easy queries to determine
if a SILType T1 contains a separate SILType T2 as a member.
rdar://16651852
Swift SVN r18147
If a source file contains the main class for its module, then implicitly emit a top_level_code that invokes UIApplicationMain with the name of the marked class.
Swift SVN r18088
Generalize the bridging of AnyObject[] to NSArray into bridging T[] to
NSArray, following what we already have for dictionaries. Use some new
Foundation-level entry points for the bridging, which could use an
audit from someone who understands Array better than I do.
Part of <rdar://problem/16535097>.
Swift SVN r17869
This mostly falls out from the metatype cast infrastructure, but we need to generalize some Sema and SILGen code to accept AnyMetatypeType. Concrete-to-existential metatypes will need more runtime checking that isn't implemented, so raise a 'not implemented' error on those for now.
Swift SVN r17798
This should eliminate pointless operations that get added to our inline
cost itinerary.
rdar://15567647
rdar://16762768
rdar://16832529
Swift SVN r17644
convert_function works essentially as a bitcast on functions that
enables you to change address/ref type parameters. This commit enforces
that invariant in the verifier and teaches SILCombine how to simplify it
so we can use it in the devirtualizer.
Swift SVN r17516
We now enforce via an assert that each witness table is unique and that
every protocol conformance that is referenceable from SIL must have a
witness table matched to it.
Also, I taught the linker that it should deserialize witness tables for
InitExistentialRefInst instructions, something that was missed before.
Swift SVN r17283
See rdar://16676020 for details.
r17101 tries to solve r16761933 by checking non-direct recursions in
the call graph. We are in discussion of solving it in a different way.
Todo: figure out why r17101 causes a preformance regression.
Swift SVN r17265
This is important since it enables one to analyze the type of the
conformance that the witness table implements which may be different
than the original type. This follows the precedent where we return the
Substitutions from the protocol conformance tree traversal.
Swift SVN r17220