This builtin only becomes unreachable when assert_configuration calls have been folded, allowing library-level checks to become unreachable based on the assert level.
Swift SVN r17322
When enum is defined inside a class, looking up a member of the enum can return
multiple results, one of them is the enum itself. Teach SILParser to find
the correct result.
rdar://16764223
Swift SVN r17292
An unsafe cast from a base to a derived class isn't really all that different from one from Builtin.NativeObject to an arbitrary class, so relax this pair of instructions to allow an arbitrary bitcast. This only combines the instructions; it doesn't attempt to simplify any codegen that was emitting round-trip casts before yet.
Swift SVN r16736
This allows the payload for a loadable enum to be unsafely projected without branching, enabling more enum optimizations when switch branches can be culled or when indirect enum code can be promoted.
Swift SVN r16729
This was part of the original weak design that
there was never any particular reason to rush the
implementation for. It's convenient to do this now
so that we can use it to implement Unmanaged<T> for
importing CF types.
Swift SVN r16693
The implied semantics are:
- side-effects can occur any time before the first invocation.
- all calls to the same global_init function have the same side-effects.
- any operation that may observe the initializer's side-effects must be
preceded by a call to the initializer.
This is currently true if the function is an addressor that was lazily
generated from a global variable access. Note that the initialization
function itself does not need this attribute. It is private and only
called within the addressor.
Swift SVN r16683
Give us a way to formally represent autoreleases in SIL separate from autoreleased returns, allowing us to lifetime-extend inner pointer parameters the lazy way and hopefully clean up some asmname hacks in the stdlib implementation too.
Swift SVN r16632
We print the AST type for the member when printing SILDeclRef for
protocol_method and dynamic_method. The AST type can be polymorphic, so parsing
of PolymorphicFunctionType is added to the Parser. Also add parsing "inout"
right before an identifier type. "inout" was parsed only in parseTypeTupleBody.
rdar://15763213
Swift SVN r16460
We want to model block invoke functions as taking the address of their @block_storage directly, so resolve @block_storage as part of type repr resolution, allowing it to appear as a parameter of a SIL function type.
Swift SVN r16370
Add project_block_storage, to project the capture storage from within a block_storage, and init_block_storage_header, to represent filling out the block header.
Swift SVN r16358
Blocks need to be born on the stack, so we need a way to represent that on-stack storage. @block_storage T will represent the layout of a block that contains storage for a capture of type T.
Swift SVN r16355
This enables parsing SILDeclRef with an operator name.
One example is #AnyProtocol."<~>"!1, we will drop the double quotes when
parsing the dotted path.
Swift SVN r16082
This will be a signal to ARC optimization, RVO, and other lifetime-affecting optimizations that they should not shorten the lifetime of a value past a certain point. We need this for C pointer bridging. This adds the instruction, but does not add any knowledge of it to the ARC optimizers.
Swift SVN r15601
We parse the substitution of [Partial]ApplyInst as AST type to fix type
mismatch issues between SILFunctionType and FunctionType.
With this commit, we can parse the sil file generated from
"-emit-silgen optional.swift".
rdar://14443287
Swift SVN r15246
Do not print '.Archetype' property of Substitution in SILPrinter.
Update testing cases accordingly.
We assume the order of substitions matchs the order of AllArchetypes for
the generic param list.
rdar://14443287
Swift SVN r15090
The '.Archetype' property of Substitution is not used and SILPrinter
prints a different name for Substitution and for the generic param list.
The fix is to ignore the '.Archetype' property in SILParser and instead
to match up Substitution with the archetype by ordering alone.
The silgen output from generic_closures.swift can now be parsed with SILParser
with changes:
typealias Int = Int64 to typealias Int = Builtin.Int64
typealias Char = Int32 to typealias Char = Builtin.Int32
Without the changes, SILParser will complain about mismatching Int64
with Builtin.Int64.
The next step is for SILPrinter to not print '.Archetype' property of
Substitution. The majority of work is updating testing cases.
rdar://14443287
Swift SVN r15014
This will help with ensuring that we do not create multiple witness
table "definitions" one of which is null. That situtation yields an
IRGen assertion to be hit since the external declaration (in the guise
of a definition) has a different type from the actual deserialized
definition.
Swift SVN r14999
This will fix the scoping issue for generic paremeters in SILType.
We use a Generics scope when parsing generic paremters of a SILType, after
we are done parsing the type, we delete the Generics scope.
Testing case will be added when SILParser can correctly handle generic code.
rdar://14443287
Swift SVN r14998
The problem is that SILDeclRef::print does not print enough information
for SILParser to find the correct Decl when there are overloading members.
This commit handles the case for class_method. We print type information for
the SILDeclRef together with the SILFunctionType separated by a comma.
SILParser then use the type information to disambiguate the overloaded
methods.
rdar://15763213
Swift SVN r14994
To parse GenericParamList in SILParser, we try to share code with TypeChecker.
We add handleSILGenericParams in Subsystems.h in order for SILParser to call
TypeChecker's handling of GenericParamList (this is motivated by the example of
SILParser calling performTypeLocChecking). handleSILGenericParams calls
checkGenericParamList and finalizeGenericParamList.
A Builder field (ArchetypeBuilder*) is added to GenericParamList so we can add
the same-type requirements to GenericSignature in getAsCanonicalGenericSignature
by checking SameTypeRequirements of the builder.
resolvePotentialArchetypeToType is moved from a static helper function in
TypeCheckGeneric.cpp to a public helper function in ArchetypeBuilder.cpp.
When constructing the same-type requirements in getAsCanonicalGenericSignature,
we will call it to convert from PotentialArchetype to a dependent type.
rdar://16238241
Swift SVN r14922
In the short term, we need to be able to emit shared symbols for SILWitnessTables corresponding to Clang-imported modules, and soon, the generic specializer will need to be able to reference *_external witness tables deserialized from library modules.
Swift SVN r14887
alloc_ref_dynamic allocates an instance of a class type based on the
value in its metatype operand. Start emitting these instructions for
the allocating constructor of a complete object initializer (not yet
tested) and for the allocating constructor synthesized for an imported
Objective-C init method.
Still missing:
- IRGen still does the same thing as alloc_ref right now. That
change will follow.
- There are devirtualization opportunities when we know the value of
the metatype that would turn an alloc_ref_dynamic into an alloc_ref;
I'm not planning to do this optimization.
Swift SVN r14560
It's not forming the metatype for the protocol type (exists t: P. t).metatype, it's forming the existential of a metatype of a conforming type, exists t: P. (t.metatype).
Swift SVN r14520
Having one instruction to get the dynamic metatype of a (non-existential) value makes more sense from a generic specialization standpoint and should stave off inevitable crashers when archetype_metatypes get specialized. protocol_metatype remains separate because metatype existentials are more interesting.
Swift SVN r14499
We were wantonly applying 'upcast' to archetypes in some cases, and really, that's OK, since these instructions do the same thing (and generic specialization could turn archetype_ref_to_super into upcast). Make everyone's life easier by folding archetype_to_super into upcast. Fixes <rdar://problem/16192324>.
Swift SVN r14496
- Respond to Doug's code review feedback
- Stop hacking around with scopes and use "emplace" to work around RAII in the inactive config case
- Limit use of StringRef on the front-end, in favor of std::string
- Use ArrayRef rather than SmallVector within IfConfigDecl
- Reorder new property declarations on BraceStmt to prevent unnecessary alignment issues
- Update ParseBraceItems to better capture top-level declarations, rather than using token lookahead
Swift SVN r14306
These changes add support for build and target configurations in the compiler.
Build and target configurations, combined with the use of #if/#else/#endif allow
for conditional compilation within declaration and statement contexts.
Build configurations can be passed into the compiler via the new '-D' flag, or
set within the LangOptions class. Target configurations are implicit, and
currently only "os" and "arch" are supported.
Swift SVN r14305
lowered field type of a ref_element_addr's parent projection, rather than using
the unlowered siltype generated via creating a SILType from the field's
vardecl.
Swift SVN r14294