Commit Graph

1572 Commits

Author SHA1 Message Date
Jordan Rose
674a03b085 Replace "oneof" with "union"...everywhere.
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
2013-07-31 21:33:33 +00:00
Adrian Prantl
70a0cffe9d silence warning
Swift SVN r6715
2013-07-29 22:10:00 +00:00
Jordan Rose
d9b7c8ad5a Move ClangModule into the ClangImporter library.
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
2013-07-29 18:56:35 +00:00
Doug Gregor
3d0c2e2612 Record the protocols and superclass for generic parameters.
This allows us to use getProtocols() rather than getInherited()
wherever we're dealing with generic parameters and associated types.


Swift SVN r6683
2013-07-29 14:27:25 +00:00
Joe Groff
7b5653aa9b IRGen: Remove not-constant-null assertion for known function data.
Until SIL becomes wise enough to optimize away unneeded thin_to_thick operations, it doesn't hold this invariant.

Swift SVN r6662
2013-07-27 00:03:27 +00:00
Doug Gregor
d0f60ab755 Introduce some encapsulation into ProtocolConformance.
Swift SVN r6648
2013-07-26 18:12:17 +00:00
Adrian Prantl
3c9bb55b8d Debug Info: Emit the qualified names for many more ObjC-derived types.
This should get rid of most <null>-types in the DWARF output.

Swift SVN r6512
2013-07-23 21:35:21 +00:00
John McCall
69b64a09ce More canonical type preserving.
Swift SVN r6377
2013-07-19 07:08:38 +00:00
Dmitri Hrybenko
722cc29cab Factor out DeclContext::getParentModule(). This cleans up a few places where
similar loops were duplicated.

No functionality changes.


Swift SVN r6353
2013-07-18 20:41:58 +00:00
Doug Gregor
d42e385371 Remove UnstructuredUnresolvedType.
Swift SVN r6241
2013-07-13 05:10:38 +00:00
John McCall
127a0e66a4 Privatize IRGenSILFunction.
Swift SVN r6173
2013-07-11 21:17:50 +00:00
John McCall
18a9290cbe Add ReferenceStorageType.
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
2013-07-09 08:37:40 +00:00
Adrian Prantl
0c34b57c74 Debug Info: Add basic support for global and stack-allocated variables and
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
2013-07-03 23:02:04 +00:00
Adrian Prantl
ae9bd9397b Debug Info: Generate scope information for many more builtin/artificial functions.
Swift SVN r5876
2013-06-28 20:05:41 +00:00
Adrian Prantl
ceb32c281c Debug Info: Attach (some of the) functions without sources to their scopes.
Various cleanups.

Swift SVN r5863
2013-06-28 00:52:07 +00:00
Adrian Prantl
c375617244 Address a couple of Joe's comments.
Swift SVN r5858
2013-06-27 23:25:22 +00:00
Adrian Prantl
de32b201d0 Debug Info: Add support for subprograms.
This means that single-stepping in lldb actually works now!

Swift SVN r5828
2013-06-27 00:46:30 +00:00
Doug Gregor
9a5c96a8c1 Introduce basic support for LLVM vectors as builtins.
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
2013-06-26 21:16:36 +00:00
Doug Gregor
cace751e86 Eliminate DeducibleGenericParamType.
The type was used by the old type coercion code; it is no longer relevant.


Swift SVN r5799
2013-06-25 16:32:44 +00:00
Chris Lattner
1040bfec6a In the REPL, allow access to the Builtin module if explicitly imported,
there is no reason to deny it and it could be theoretically useful.


Swift SVN r5779
2013-06-24 16:07:56 +00:00
Joe Groff
e129ad26d0 Recursively consider ObjC protocol conformances.
Propagate ObjC-ness and emit ObjC thunks and metadata for ObjC protocols indirectly conformed to through protocol refinement.

Swift SVN r5680
2013-06-19 05:35:27 +00:00
Joe Groff
514d659ead IRGen: Emit categories for extensions that conform to ObjC protocols.
Swift SVN r5659
2013-06-18 22:37:55 +00:00
Dmitri Hrybenko
49fa6738b9 Remove CPointer<T>, it was almost equivalent to UnsafePointer<T>, but
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
2013-06-17 17:10:08 +00:00
Joe Groff
a491a3fc93 ClangImporter: Emit metadata for imported protocol types.
Swift SVN r5605
2013-06-16 02:55:47 +00:00
Joe Groff
e3269a3b95 Pick one name for 'getAbstractCC'.
getCC, getFunctionCC, getConvention...consolidate them all under one name.

Swift SVN r5297
2013-05-24 03:08:40 +00:00
Joe Groff
8303addde0 IRGen: Get ObjC thunks from SIL.
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
2013-05-16 19:03:37 +00:00
Joe Groff
197c3e6d02 IRGen: Strip unneeded parameters from IRGenFunction constructor.
Swift SVN r5146
2013-05-10 18:18:14 +00:00
Joe Groff
223d0251bd IRGen: Add getFragileTypeInfo and getFunctionType for SIL types.
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
2013-05-10 16:28:25 +00:00
Jordan Rose
77ce3f31cb Add a DeclContextKind for Swift modules.
Swift SVN r5095
2013-05-08 18:33:34 +00:00
Joe Groff
b818405034 Replace direct use of [[clang::fallthrough]] with a macro.
Add a SWIFT_FALLTHROUGH macro that expands to [[clang::fallthrough]] for Clang and nothing for other compilers. No functionality change.

Swift SVN r5043
2013-05-05 18:54:03 +00:00
Doug Gregor
0f6b7a9d22 Rework our handling of "external" definitions created by the Clang importer.
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
2013-05-03 00:24:34 +00:00
Joe Groff
24d44b051e Have destroying destructors return 'this' back to the deallocator.
This saves the deallocating destructor having to keep 'this' alive across the destructor call.

Swift SVN r5026
2013-05-02 16:36:50 +00:00
Joe Groff
0566088bf2 Move name mangling into SIL.
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
2013-04-28 03:32:41 +00:00
Joe Groff
ac1a7b3d0a IRGen: Walk local decls independent of SILFunctions
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
2013-04-26 00:32:22 +00:00
Joe Groff
8bdccdd418 IRGen: Clear up dtor special cases in SIL-IRGen.
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
2013-04-25 19:50:58 +00:00
Joe Groff
ee9ca634a5 SIL: Add linkage and calling conv to SILFunctions.
Move AbstractCC into SILType and make it an attribute of SILTypes for functions. Add a ConvertCCInst to represent calling convention conversions. Give SILFunctions a linkage attribute. Add logic to SILGen to calculate these attributes for SILConstants based on their attached decls.

IRGen doesn't use these new attributes yet. I'll hook that up when I move mangling over.

Swift SVN r4886
2013-04-24 18:09:44 +00:00
Joe Groff
bcb49ce450 SIL: Key functions directly without SILConstant.
Replace 'constant_ref' with 'function_ref', which references a SILFunction directly, and 'global_addr', which references a global variable VarDecl. Get rid of the SILConstant-to-SILFunction mapping in SILModule and replace it with an ilist of SILFunctions. Allow SILFunctions to be 'external' by not having any blocks in their body. 

For now, SILFunctions still carry around their SILConstant "name", because name mangling and IRGen still rely on access to the original decl in order to recover IRGen information, which unfortunately leaves IRGen's CodeRefs in a gross, awkward intermediate state. Lifting mangling, AbstractCC, and other linkage attributes to SIL should clear up this up.

Swift SVN r4865
2013-04-23 23:29:04 +00:00
Joe Groff
916ae36f7e Don't reemit globals from previous repl entries.
Oops. This should fix <rdar://problem/13694699>.

Swift SVN r4835
2013-04-20 23:50:36 +00:00
Chris Lattner
a124da99eb remove the dead "Locals" map and supporting logic.
Swift SVN r4823
2013-04-19 04:01:59 +00:00
Chris Lattner
35edbcd29e prune some minor dead Stmt stuff.
Swift SVN r4818
2013-04-19 00:09:51 +00:00
Chris Lattner
abee79b26e remove some Expr stuff.
Swift SVN r4810
2013-04-18 22:32:37 +00:00
Chris Lattner
47e508c24d remove LValue, PathComponent, and LValue.h as a whole.
Swift SVN r4792
2013-04-18 04:50:03 +00:00
John McCall
8fe4246833 Hide StorageSize/Alignment behind accessors in preparation for moving
them to a subclass.

Swift SVN r4779
2013-04-17 21:55:41 +00:00
Chris Lattner
dace3e95fd remove local decl emission and local pattern binding emission.
Swift SVN r4769
2013-04-17 05:09:37 +00:00
Chris Lattner
b09994d899 remove the last thing obviously checking for the presence of a sil module.
Swift SVN r4765
2013-04-17 04:10:02 +00:00
Chris Lattner
22321ffe7f next pass deleting now-dead code. Default ctors are keeping a bunch of
stuff alive (tracked by rdar://13670607)


Swift SVN r4763
2013-04-17 04:01:37 +00:00
Chris Lattner
ea4eca3a95 now that SILGen is on all the time, start removing dead code.
Swift SVN r4762
2013-04-17 03:49:38 +00:00
Chris Lattner
7588b99869 add a pre-mangled name to the top level function, some more minor
style changes to fit in 80 columns etc.  No useful behavior change.



Swift SVN r4748
2013-04-16 00:44:57 +00:00
Chris Lattner
5a3a99e78a remove a dead "CurConstant" ivar, simplify some code to make it fit in 80 columns.
Swift SVN r4744
2013-04-15 23:14:04 +00:00
Chris Lattner
2037e034fa extend LinkEntity to be able to refer to a SILFunction.
This is important for the SIL Parser, which has to parse function decls into something
that don't reference a decl.




Swift SVN r4743
2013-04-15 23:02:47 +00:00