This way we don't need to deal with the inaccuracy of decimal float literals. While we're here, modify the in-memory representation of IntegerLiteralInst and FloatLiteralInst to save the word array of the APInt instead of round-tripping through plain text.
Swift SVN r6676
"SILConstant" doesn't really describe its role in SIL anymore, which is to provide a reference to a Swift declaration in a SIL instruction, such as a method or nominal type field.
Swift SVN r6559
Modify SILPrinter to print necessary types for parsing.
Format of copy_addr is changed from
copy_addr Src [take]? to Dst [initialization]?
to
copy_addr [take]? Src to [initialization]? Dst : DstType
to put the attribute in front of the actual value.
It also makes parsing easier since '[' can start an array type.
Swift SVN r6268
In the resilience model for default arguments, the presence of a
default argument is API, but its specific value is not. Thus, the
actual default argument values can evolve over time. To implement
this, for each default argument, we emit a function that
takes no arguments and produces the default value for that
argument. The caller will then call that function to form the default
argument.
This commit emits these functions for each default argument, even
though they are not currently being called. This is part of
<rdar://problem/11561185>.
We'll probably want a different calling convention for these functions
that preserves all registers, since they will often end up being very
trivial functions.
Swift SVN r6260
Construct ArchetypeType from generic params; Construct a Scope for the SIL
function body so TypeAliasDecl for the generic params can be added to ScopeInfo.
Remove an extra '$' in SILPrinter when printing the lookup type for an
archetype_method.
Swift SVN r6219
These still need to be serialized, because they are one-to-one with the
type's protocol list, but don't actually require any data. Found on
attempting to emit a module for the standard library.
Most of the churn here is moving Interleave.h to a more general STLExtras.h.
Swift SVN r6167
New format for SILConstant:
'#' sil-dotted-path sil-constant-kind-and-uncurry-level?
sil-dotted-path:
identifier ('.' identifier)*
sil-constant-kind-and-uncurry-level:
'!' sil-constant-kind ('.' sil-constant-uncurry-level)? ('.objc')?
'!' sil-constant-uncurry-level ('.objc')?
'!objc'
sil-constant-kind:
'func' | 'getter' | 'setter' | 'allocator' | 'initializer' | 'oneofelt' \
| 'destroyer' | 'globalaccessor'
Add helper function printFullContext in SILPrinter to generate the fully
qualified dotted path for a given DeclContext; Add parseSILConstant to
SILParser; Testing cases are updated to reflect the new format.
Swift SVN r6055
Improve our representations of casts in the AST and SIL so that 'as!' and 'is' (and eventually 'as?') can share almost all of the same type-checking, SILGen, and IRGen code.
In the AST, we now represent 'as!' and 'is' as UnconditionalCheckedCastExpr and IsaExpr, respectively, with the semantic variations of cast (downcast, super-to-archetype, archetype-to-concrete, etc.) discriminated by an enum field. This keeps the user-visible syntactic and type behavior differences of the two forms cleanly separated for AST consumers.
At the SIL level, we transpose the representation so that the different cast semantics get their own instructions and the conditional/unconditional cast behavior is indicated by an enum, making it easy for IRGen to discriminate the different code paths for the different semantics. We also add an 'IsNonnull' instruction to cover the conditional-cast-result-to-boolean conversion common to all the forms of 'is'.
The upshot of all this is that 'x is T' now works for all the new archetype and existential cast forms supported by 'as!'.
Swift SVN r5737
referenced symbol with the name, followed by a colon, followed by the type
instead of the type first (following local value references). For example,
instead of:
%1 = function_ref $[thin] ((val : Builtin.Int128), Int64.metatype) -> Int64, @_TSi33_convertFromBuiltinIntegerLiteralfMSiFT3valBi128__Si // user: %4
we now get:
%1 = function_ref @_TSi33_convertFromBuiltinIntegerLiteralfMSiFT3valBi128__Si : $[thin] ((val : Builtin.Int128), Int64.metatype) -> Int64 // user: %4
Swift SVN r5735
Treat archetypes with a superclass bound as class-bounded. Change SILGen and IRGen to use the new SuperToArchetypeRef and ArchetypeRefToSuper cast instructions, and drop the old SuperToArchetype and ArchetypeToSuper instructions, which are unneeded because any archetype with a superclass will be class-bounded.
Note that this patch doesn't implement representation optimization for archetypes with superclass bounds--they're still always represented with a worst-case UnknownRefCountedPtrTy.
Swift SVN r5629
Add class-bound versions of archetype conversion and existential creation/projection/conversion instructions. Since class-bound generics aren't address-only these instruction variants don't need to indirect through addresses.
Swift SVN r5554
Add an index_raw_pointer instruction that acts like index_addr but for RawPointers, and use it to lower Builtin.gep into SIL instead of into IR.
Swift SVN r5479
type of the callee at the end is unusual but makes it easier to read the
call. We now get something like this, which makes it obvious what is the
callee value and what are the arguments:
%6 = apply %4(%5) : $[thin] ((), Int64.metatype) -> Int64
We may end up needing types for arguments as well, but lets try to get
away without them.
Swift SVN r5358
operand, producing something like:
%2 = store %0 to %1 : $*Int64
Enhance the sil parser to be able to parse this. We can now
round trip everything required to handle this function:
func foo(a : Int) -> Int {
return a
}
Swift SVN r5354
Generate and cache SILFunctionTypeInfo from Swift types on the fly, and simplify the SILType representation down to a CanType and isAddress bit.
Swift SVN r5298
Remove uncurry level as a property of SILType/SILFunctionTypeInfo. During SIL type lowering, map a (Type, UncurryLevel) pair to a Swift CanType with the uncurried arguments as a Swift tuple. For example, T -> (U, V) -> W at uncurry level 1 becomes ((U, V), T) -> W--in reverse order to match the low-level calling convention. Update SILGen and IRGen all over the place for this representation change.
SILFunctionTypeInfo is still used in the SILType representation, but it's no longer load-bearing. Everything remaining in it can be derived from a Swift type.
This is an ABI break. Be sure to rebuild clean!
Swift SVN r5296
print the element types of struct.
The empty function now prints as:
sil @_T1t5emptyFT_T_ : $[thin] () -> () {
bb0:
%0 = tuple ()
%1 = tuple () // users: %2
%2 = return %1 : $()
}
Swift SVN r5267