Commit Graph

12816 Commits

Author SHA1 Message Date
Adrian Prantl
241ccc5f49 s/@/\\/g
Swift SVN r6224
2013-07-12 23:18:44 +00:00
Adrian Prantl
3a0dd1d1ca Debug info: Function types now include the types of the function parameters.
Swift SVN r6223
2013-07-12 23:05:03 +00:00
Adrian Prantl
ef84ad08e4 Add support for the "block" attribute.
Swift SVN r6222
2013-07-12 23:04:57 +00:00
Adrian Prantl
887dc7870a Debug Info: Prepare everything for emitting he calling convention.
Swift SVN r6194
2013-07-12 00:44:18 +00:00
John McCall
40a8694ef0 Fix some mis-uses of CurExplosionLevel.
Swift SVN r6176
2013-07-11 21:17:55 +00:00
John McCall
0040e5c075 Capitalize some field names.
Swift SVN r6175
2013-07-11 21:17:54 +00:00
John McCall
8f65923d64 Rename newLowered* to setLowered*.
Swift SVN r6174
2013-07-11 21:17:52 +00:00
John McCall
127a0e66a4 Privatize IRGenSILFunction.
Swift SVN r6173
2013-07-11 21:17:50 +00:00
Adrian Prantl
ceb3495ef0 DebugInfo: Add support for the [objc] attribute for classes.
Swift SVN r6168
2013-07-11 18:43:23 +00:00
Jordan Rose
e3999dde36 [serialization] Handle absent protocol conformances.
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
2013-07-11 18:38:50 +00:00
Joe Groff
44541c8da5 IRGen: Lower SILBasicBlock address arguments to LLVM PHI nodes.
IRGen wasn't handling SIL addresses as BB arguments. Oops. Fixes <rdar://problem/14410061>.

Swift SVN r6146
2013-07-11 03:46:03 +00:00
Adrian Prantl
a4967ee9cc Debug Info: Represent classes as structure_types with their runtime
language set to "Swift".

Swift SVN r6144
2013-07-11 00:54:13 +00:00
John McCall
0e63c4a0ed Extract a ReferenceTypeInfo subinterface for refcount operations.
Weak stuff will introduce a much broader set of required
operations.

Swift SVN r6143
2013-07-11 00:22:06 +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
184db6484c Don't create a lexical block file for empty filenames.
Swift SVN r6063
2013-07-08 20:38:39 +00:00
Adrian Prantl
945a481c33 Debug Info: Forge a name getters and setters using their parent declaration.
Fixes rdar://problem/14346129.

Swift SVN r6056
2013-07-08 18:27:36 +00:00
Adrian Prantl
dc0c502df4 Add a comment about how to emit the size of basic types.
Swift SVN r6051
2013-07-08 16:44:44 +00:00
Adrian Prantl
303cef8c35 Allow for line tables to switch to a different file in the middle
of a lexical scope. This is not yet a proper inlined scope.

Swift SVN r6034
2013-07-06 00:20:38 +00:00
Adrian Prantl
6f526e3ca5 Make the line table more contiguous by reusing the last location if have
no line information but are still in the same scope.

Swift SVN r6033
2013-07-06 00:20:35 +00:00
Adrian Prantl
2f03310869 Don't prepend the current directory to an absolute path in the compile unit.
Swift SVN r6021
2013-07-05 21:47:33 +00:00
Adrian Prantl
f394af89b6 Reluctantly move the DWARF language identifier for Swift into the low range again (0xf).
Swift SVN r6014
2013-07-05 20:20:12 +00:00
Adrian Prantl
4a73ec14c9 Address a bunch of review comments. Thanks Joe & Chris!
Swift SVN r6012
2013-07-05 17:19:15 +00:00
Peter O'Gorman
889d3bfb43 Build on case-sensitive fs
#include IRGen.h not IrGen.h


Swift SVN r6001
2013-07-05 06:11:45 +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
Doug Gregor
5d175efad1 Don't try to get a StringRef from an empty identifier.
This is a hackaround for <rdar://problem/14346129>.


Swift SVN r5971
2013-07-03 17:22:15 +00:00
John McCall
65342ac19a Change %swift.refcounted to correctly model HeapObject as of r5873.
Swift SVN r5958
2013-07-01 23:29:15 +00:00
John McCall
90263437e4 Fix for case-sensitive filesystems.
Swift SVN r5957
2013-07-01 23:29:13 +00:00
Joe Groff
0fdfc02f5a IRGen: Trap on SIL 'unreachable' instruction.
Until we get a proper dataflow pass to statically catch fall-off-the-end bugs, going into outer space is an awful UX for our library writers. Insert an llvm.trap() call when we emit SIL "unreachable" instructions.

Swift SVN r5953
2013-07-01 22:24:09 +00:00
Dave Abrahams
096ffc6eaf Silence warnings in the release build
Swift SVN r5950
2013-07-01 21:42:16 +00:00
Argyrios Kyrtzidis
e31bfa9859 Fix some -Wnon-virtual-dtor warnings.
Swift SVN r5938
2013-07-01 18:25:23 +00:00
Adrian Prantl
149ebb0ef3 Debug Info: Associate the remaining artificial functions with their debug scopes.
Swift SVN r5885
2013-06-28 22:27:25 +00:00
Dmitri Hrybenko
43137f155c Fix warning: use an unused variable
Swift SVN r5879
2013-06-28 21:12:48 +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
Joe Groff
3e2194a662 IRGen: Quell initialization order warning.
Swift SVN r5835
2013-06-27 05:15:30 +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
Adrian Prantl
2db17656f5 Debug Info: Wire up the CU's main file to point to the the first input file passed on the command line.
Swift SVN r5805
2013-06-25 22:07:33 +00:00
Joe Groff
25c1a262c6 IRGen: Use local type metadata for generic downcasts.
We can only directly use class metadata and swift_dynamicCastClass*  for a downcast to a concrete class. For generic classes we need to instantiate the metadata at runtime. Fixes <rdar://problem/14266071>.

Swift SVN r5804
2013-06-25 21:58:44 +00:00
Dmitri Hrybenko
511bb60e62 Fix compile error with ToT clang
Swift SVN r5803
2013-06-25 20:59:06 +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
Adrian Prantl
5cf577282d Debug Info: Wire up more compile unit metadata and clean up the code a bit.
Swift SVN r5794
2013-06-25 00:19:32 +00:00
Adrian Prantl
a719bbc851 Initialize struct to zero the C++11 way. Thanks, Jordan.
Swift SVN r5787
2013-06-24 20:25:40 +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
Chris Lattner
d7f74cc949 silence a -Wreorder warning.
Swift SVN r5775
2013-06-23 18:08:52 +00:00
Adrian Prantl
68e1df49f5 Fix a couple more glitches that were uncovered by assertions.
Swift SVN r5774
2013-06-23 03:35:28 +00:00
Adrian Prantl
0f7533dc7e Debug Info! Add basic support for line tables, compilation units, files,
and lexical scopes, which can be enabled through the new -g option.
When -g is enabled, line tables and scopes compile all the way
down to DWARF.

Changes to SIL:
- In addition to a SILLocation, every instruction now also has a pointer
  to a SILDebugScope (its containing lexical scope).
- Added LexicalScope, which is to be used for all Scopes we want to show
  up in the debug info.

Swift SVN r5772
2013-06-23 00:09:17 +00:00
Joe Groff
f072c48e45 Refactor cast representation in AST and SIL, and implement 'is'.
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
2013-06-21 05:54:03 +00:00
Joe Groff
42be459de9 IRGen: Protocol types are always Fixed-size.
Swift SVN r5719
2013-06-20 17:32:14 +00:00