This breaks the type-canonicalization link between a generic parameter
type and the archetype to which it maps. Generic type parameter types
are now separate entities (that can eventually be canonicalized) from
archetypes (rather than just being sugar).
Most of the front end still traffics in archetypes. As a step away
from this, allow us to type-check the generic parameter list's types
prior to wiring the generic type parameter declarations to archetypes,
using the new "dependent" member type to describe assocaited
types. The archetype builder understands dependent member types and
uses them to map down to associated types when building archetypes.
Once we have assigned archetypes, we revert the dependent identifier
types within the generic parameter list to an un-type-checked state
and do the type checking again in the presence of archetypes, so that
nothing beyond the generic-parameter-list checking code has to deal
with dependent types. We'll creep support out to other dependent types
elsewhere over time.
Swift SVN r7462
This is a baby step toward eliminating GenericParamList from
PolymorphicFunctionType, fixing up the easy callers. No functionality
change.
Swift SVN r7370
Previously, TypeAliasDecl was used for typealiases, generic
parameters, and assocaited types, which is hideous and the source of
much confusion. Factor the latter two out into their own decl nodes,
with a common abstract base for "type parameters", and push these
nodes throughout the frontend.
No real functionality change, but this is a step toward uniquing
polymorphic types, among other things.
Swift SVN r7345
When injecting the payload case of the union, pack the payload value into its native representation, and add zeroed extra bits if needed. When injecting the non-payload cases, assign them extra inhabitants if we have them, spilling into setting extra bits if needed.
Swift SVN r7323
However, the default literal types /are/ looked up in the current TU, so
that they can be changed. It's questionable whether or not this should
include "Slice" and "Dictionary", though.
If the module "swift" isn't available, we fall back to TU-based lookup,
which is necessary to build the standard library itself.
Full list of values now looked up in "swift":
ArrayBound
ArrayLiteralConvertible
Bool
BuiltinCharacterLiteralConvertible
BuiltinFloatLiteralConvertible
BuiltinIntegerLiteralConvertible
C_ARGC
C_ARGV
CharacterLiteralConvertible
DictionaryLiteralConvertible
Enumerable
Enumerator
false
FloatLiteralConvertible
IntegerLiteralConvertible
LogicValue
MaxBuiltinFloatType
MaxBuiltinIntegerType
Optional (for T?)
print
Slice (for T[] but not as default array literal type)
StringInterpolationConvertible
StringLiteralConvertible
true
Swift SVN r7262
The current implementation of dealloc_stack in IR-gen is a
no-op, but that's very much wrong for types with non-trivial
local allocation requirements, e.g. archetypes. So we need
to be able to do non-trivial code here. However, that means
modeling both the buffer pointer and the allocated address
in SIL.
To make this more type-safe, introduce a SIL-specific
'[local_storage] T' type that represents the required
allocation for locally storing a T. alloc_stack now returns
one of those in additon to a *T, and dealloc_stack expects
the former.
IR-gen still implements dealloc_stack as a no-op, but
that's now easy to fix.
Swift SVN r6937
We need to handle three cases:
- If a protocol conformance has no associated types, or the associated type witnesses all have statically resolvable metadata, we can expose a *direct* witness table symbol.
- If a protocol conformance has associated types with runtime-instantiated metadata, we need to gate the witness table behind a *lazy* initializer function to fill in the metadata fields.
- If a protocol conformance has associated types where the type or one of its conformances are *dependent* on its parent's generic parameters, we need to instantiate multiple witness tables at runtime.
Swift SVN r6805
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
This makes it very clear who is depending on special behavior at the
module level. Doing isa<ClangModule> now requires a header import; anything
more requires actually linking against the ClangImporter library.
If the current source file really can't import ClangModule.h, it can
still fall back to checking against the DeclContext's getContextKind()
(and indeed AST currently does in a few places).
Swift SVN r6695
The idea for now is that this is a SIL-only type used for
representing the storage of a weak or unowned reference.
Having it be its own type is pretty vital for reasonable
behavior in SIL and IR-generation, and it's likely that
this will surface into runtime metadata as well (hence
the mangling).
I've implemented a bunch of things that technically I don't
think are necessary if this stays out of the typechecker,
but it's easier to implement half-a-dozen "recurse into
the child type" methods now that it would be to find them
all later if we change our minds.
Swift SVN r6091
their types.
- DebugTypeInfo holds all type info we need to emit debug information.
- Type info is limited to name, location, and storage size.
- As a side-effect: verbose LLVM IR allocas in debug builds!
Swift SVN r5980
This adds builtin types Builtin.VecNxT, where N is a natural number
and T is a builtin type, which map down to the LLVM type <N x T>.
Update varous builtins to support vector arguments, e.g., binary
operations, comparisons, negation. Add InsertElement and
ExtractElement builtins for vectors.
On top of these builtins, add Vec4f and Vec4b structs to the standard
library, which provide 4xFloat and 4xBool vectors, respectively, with
basic support for arithmetic. These are mostly straw men, to be burned
down at our leisure.
Some issues as yet unresolved:
- Comparisons of Vec4f'ss are producing bogus Vec4b's, which I
haven't tracked down yet.
- We still don't support the shuffle builtin, although it should be
easy
- More testing!
Swift SVN r5820
implemented pointer arithmetic. Enhanced UnsafePointer<T> to do pointer
arithmetic.
Also: update Clang importer to import T* as UsafePointer<T>, fix standard
library fallout.
Swift SVN r5616
Use the SIL-generated ObjC thunk symbols instead of generating them in IRGen. Kill all the now-dead IRGen OwnershipConventions stuff. Teach IRGenSILFunction how to emit a C-calling-convention function, and getFunctionType how to map a C-calling-convention function type. Fix a bug in SILGen where ObjC thunks for methods and properties from extensions weren't getting emitted.
Swift SVN r5180
Add overloads of getFragileTypeInfo and getFunctionType that take a SILType instead of a Swift CanType, and use them where it's easy to do so. Right now they just forward to the CanType versions, but we'll want to do SILType-specific type conversion soon. Clean up some IRGenSILFunction interfaces now that SILFunction carries most of the information IRGen needs intrinsically. No functionality change.
Swift SVN r5141
Add a SWIFT_FALLTHROUGH macro that expands to [[clang::fallthrough]] for Clang and nothing for other compilers. No functionality change.
Swift SVN r5043
Keep track of external definitions as they are created by broadcasting
them through a mutation listener interface. At name binding time, we
just cache them. When a type checker is alive, it immediately performs
any additional operations necessary on those types (e.g., declaring
implicit constructors).
This also eliminates some O(N^2) behavior in the type checker as well,
because we don't have to walk through all of the module imports to
find the external definitions. We just keep a single list in the
ASTContext along with our place in the list.
Fixes <rdar://problem/13769497>.
Swift SVN r5032
Sever the last load-bearing link between SILFunction and SILConstant by naming SILFunctions with their mangled symbol names. Move the core of the mangler up to SIL, and teach SILGen how to use it to mangle a SILConstant.
Swift SVN r4964
Find function bodies and emit their local type decls using the AST instead of relying on SILConstants to point the way back to the function bodies.
Swift SVN r4916
Change the destroying destructor entry point ABI to take 'this' as the appropriate type instead of as %swift.refcounted. Emit the deallocating destructor in IRGen when we see the ClassDecl, not when we see the SILFunction for the destructor. This frees us from having to worry about whether a SILFunction came from a destructor decl. We won't be able to reconstruct that once SILFunctions are pre-mangled.
While we're here, repaint some bikesheds so it's clearer that SIL and SILGen work with the destroying destructor.
Swift SVN r4908