Commit Graph

1693 Commits

Author SHA1 Message Date
Adrian Prantl
1bcbaedcd0 Debug info: get rid of intrinsickind.
Swift SVN r11101
2013-12-10 23:53:18 +00:00
Joe Groff
02a0e996c4 SIL: Kill initialize_var instruction.
Remove the initialize_var instruction now that DI fully diagnoses initialization problems. Change String-to-NSString bridging to explicitly invoke String's default constructor; it was the last remaining user of initialize_var. Remove dead code to emit an implicit default constructor without a body.

Swift SVN r11066
2013-12-10 03:36:59 +00:00
Chris Lattner
a0499d90d5 remove the SIL builtin_zero instruction.
Swift SVN r11052
2013-12-09 23:41:35 +00:00
Adrian Prantl
4fcf12deda Add a comment.
Swift SVN r11045
2013-12-09 23:09:39 +00:00
Adrian Prantl
97ce2b1845 Debug info: Emit dbg.values for self arguments without explicit storage
(such as in destructors).
Fixes <rdar://problem/15609657> No debug info for self in some cases.

Swift SVN r10975
2013-12-07 03:08:22 +00:00
Joe Groff
6dcb5b0047 IRGen: Correctly lower index_addr for types where size != stride.
If the LLVM size of a type doesn't match its stride, or a type's size is dynamic, we can't naively lower index_addr to a GEP of the LLVM pointer. We have to bitcast to i8* and GEP the strided distance in bytes. Fixes <rdar://problem/15609900>.

Swift SVN r10972
2013-12-07 02:45:28 +00:00
Adrian Prantl
ec2beb402a Debug info: Let cleanup instructions that appear in the middle of a basic
block share the location of the previous instruction.
Fixes <rdar://problem/15597915> Stepping through code occasionally leaps to surprising source lines

Swift SVN r10964
2013-12-07 01:22:33 +00:00
Joe Groff
27d96bbdc9 SIL: Generalize archetype_method to accept concrete types.
Allow archetype_method to look up a witness from a concrete ProtocolConformance record. This will allow generic specialization to apply to constrained generic functions independent of archetype_method devirtualization. <rdar://problem/14748543>

Swift SVN r10950
2013-12-07 00:00:51 +00:00
Joe Groff
9d2f5719dc IRGen: Factor logic to look up witness tables out of forEachProtocolWitnessTable loop.
This lets us share implementation with emitArchetypeMethodValue and easily generalize emitArchetypeMethodValue to work with concrete types.

Swift SVN r10941
2013-12-06 21:56:33 +00:00
Joe Groff
0ff977d407 Add a 'WitnessMethod' enumerator to AbstractCC.
We'll use this to represent the slightly-different polymorphic calling convention used for passing Self into protocol witnesses.

Swift SVN r10898
2013-12-06 01:32:35 +00:00
Adrian Prantl
a740587c5c add missing comment.
Swift SVN r10894
2013-12-06 00:45:10 +00:00
Adrian Prantl
2055386e0c Debug Info: Move the argument ordering logic into IRGenSILFunction and
get rid of the hack that used to be in IRGenDebugInfo.
This commit also adds a bunch of interesting testcases for function args.
Fixes <rdar://problem/15464454> Arguments sometimes go missing.

Swift SVN r10873
2013-12-05 18:51:07 +00:00
Doug Gregor
627f0ae447 Allow "x as T" to perform implicit conversions from x to T.
Fixes <rdar://problem/15283100>.


Swift SVN r10783
2013-12-04 17:31:44 +00:00
Adrian Prantl
f2e8e4b08f Debug info: Emit L-Values as indirect would be redundant, because they are
already reference types.

Swift SVN r10740
2013-12-03 00:25:55 +00:00
Chris Lattner
ad05efc481 Redesign the BuiltinFunctionRefInst to contain an Identifier instead of
a FuncDecl.  This makes it much more straight-forward for SIL passes to
introduce a new one - without doing name lookup in the builtin module!



Swift SVN r10694
2013-11-30 01:49:36 +00:00
Chris Lattner
a5cf0fa60a Hoist the FuncDecl out of builtin function IRGen, working in terms
of the simpler Identifier instead.


Swift SVN r10693
2013-11-30 01:04:38 +00:00
Chris Lattner
9410440bbd don't pass a FuncDecl into functions that ignore it. Don't recompute the
BuiltinInfo for an intrinsic when we already have it on hand.


Swift SVN r10690
2013-11-30 00:48:45 +00:00
Chris Lattner
173f1301dc move 'const' to the right spot.
Swift SVN r10689
2013-11-30 00:26:54 +00:00
Adrian Prantl
d40c6e15a8 Debug info: Assign the location of the terminator to cleanups.
Yay! Less hacky.
<rdar://problem/15510646> Current line seems incorrect after single stepping from breakpoint

Swift SVN r10664
2013-11-22 19:39:14 +00:00
Adrian Prantl
214fc4c467 Debug info: Don't emit duplicate debug info for existential types and fix
indirection flag on lvalue parameters.

Swift SVN r10656
2013-11-22 02:15:18 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Joe Groff
f6b1745650 SIL: Remove 'ModuleInst'.
Module values could never be used for anything, and we have SILUndef now, so when SILGen sees a ModuleExpr, we can just emit 'undef'.

Swift SVN r10548
2013-11-18 21:36:08 +00:00
Joe Groff
d188fd5c0a IRGen: Handle class-existential-to-opaque-archetype cast.
Handle an indirect cast from a class existential, so we can cast class existentials to opaque archetype types. Fixes <rdar://problem/15313840>.

Swift SVN r10545
2013-11-18 19:26:51 +00:00
Joe Groff
15dc4967aa IRGen: Lower SILGlobalVariables.
Add support for emitting IR for SILGlobalVariables and SILGlobalAddrInst.

Swift SVN r10543
2013-11-18 17:40:45 +00:00
Joe Groff
4c0ebedc6a SIL: Add SILGlobalAddrInst.
Like GlobalAddrInst, but for SILGlobalVariables. These would become the same instruction when SILGlobalVariable can replace AST-level global references.

Swift SVN r10510
2013-11-16 00:50:18 +00:00
Joe Groff
19457c12ea Give Builtin.Word an abstract size.
Instead of hardcoding Builtin.Word to be an alias for Builtin.Int64, make it its own type of abstract pointer width.

- Change BuiltinIntegerType's width representation to accommodate abstract widths.

- In the AST and in SIL, store values of the types as the greatest supported size for the abstract width (64 bits for a pointer).

- Add some type safety to the ([sz]ext|trunc)(OrBitCast)? builtins that they're used appropriately given the upper and lower bounds of the abstract sizes they're working with.

- Now that Builtin.Word is a distinct type, give it its own mangling.

- In IRGen, lower pointer-sized BuiltinIntegerType appropriately for the target, and truncate lowered SIL values if necessary.

Fixes <rdar://problem/15367913>.

Swift SVN r10467
2013-11-14 19:56:26 +00:00
Chris Lattner
425819ac07 Change the SIL string_literal instruction to produce three results
(the same way alloc_box returns two) instead of returning a tuple.

This eliminates a ton of tuple_extract instructions, which just
bloat the generated SIL.  This resolves rdar://15378135.



Swift SVN r10416
2013-11-13 06:43:09 +00:00
John McCall
93dfaa6bf4 Make everything getting a TypeInfo declare whether it's
working with a SIL-lowered or SIL-unlowered type.

Swift SVN r10067
2013-11-09 01:41:16 +00:00
Chris Lattner
82567f9ffb SILValue is just a wrapper around its ValueAndResultNumber. Derive
the number of low bits available in it from the #bits in ValueAndResultNumber,
instead of computing it independently.


Swift SVN r9922
2013-11-04 17:54:42 +00:00
Chris Lattner
0f3c949000 inline emitStringLiteral into its only caller.
Swift SVN r9920
2013-11-04 17:43:49 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +00:00
Adrian Prantl
459db73092 Debug info: Move the logic for emitting type metadata arguments to
GenProto, and emit both the mangled name and the type variable used by the
programmer for archetypes.
Fixes <rdar://problem/15346134> The $swift.type metadata arguments do not show up anymore

Swift SVN r9844
2013-10-31 04:50:33 +00:00
Joe Groff
98f0e6e395 IRGen: Lower SIL 'undef' to IR 'undef'(s).
For every 'undef' we see of some SILType, build an appropriate LoweredValue for it out of LLVM undef values.

Swift SVN r9795
2013-10-30 17:00:21 +00:00
Adrian Prantl
ebeeebf116 Debug info: Reset the debug location after emitting the initial phi-node
locations for a more coherent line table. Relax testcase.

Swift SVN r9745
2013-10-28 23:14:45 +00:00
Adrian Prantl
5bbe0afb9f Debug info: Properly handle the function prologue in the line table.
Introduces a new flag in SILLocation: InPrologue to mark instructions
that setup the stack and allocate storage for local variables/arguments.

Fixes rdar://problem/15290023: Breakpoint set on prologue - crash ensues.

Swift SVN r9686
2013-10-26 00:12:20 +00:00
Dmitri Hrybenko
80d753d0ab Portability: use std::make_tuple instead of relying on a libc++ extension (an
implicit constructor in std::tuple)


Swift SVN r9615
2013-10-23 06:17:28 +00:00
Joe Groff
b8ec74f1c7 IRGen: Lower CondFailInst.
Swift SVN r9593
2013-10-22 16:08:25 +00:00
Joe Groff
00dcdf394f SIL: Introduce CondFailInst.
This instruction will conditionally trigger a runtime failure if its operand is true.

Swift SVN r9588
2013-10-22 15:53:04 +00:00
Chris Lattner
91c7cea310 Remove the SILModule& argument from a few methods in SILInstruction.h.
Instructions know which module they came from, so there is no need to
pass it in.



Swift SVN r9584
2013-10-22 11:06:50 +00:00
Joe Groff
61360ba7a4 SIL: Remove ConvertCCInst.
Swift SVN r9577
2013-10-22 03:16:27 +00:00
Adrian Prantl
37a0827386 Debug info: fix a bug with indirect values by using enums for type-safety.
rdar://problem/15248201

Swift SVN r9463
2013-10-17 21:16:42 +00:00
Adrian Prantl
65dc82d530 Debug info: emit Archetypes and their conforming protocols.
Fixes rdar://problem/15209779 and rdar://problem/15211793.

Swift SVN r9422
2013-10-16 22:14:37 +00:00
Adrian Prantl
2a8d4bb16c Do not emit debug info for external references.
Swift SVN r9421
2013-10-16 22:14:33 +00:00
Joe Groff
d273b799e3 IRGen: Emit downcasts to ObjC protocol types.
Use objc_getProtocol to derive a reference to the Protocol* for each required conformance, then pass the array off to a to-be-written dynamicCastObjCProtocol(Un)?Conditional entry point that will do all of the conformsToProtocol checks.

Swift SVN r9397
2013-10-16 01:28:59 +00:00
Joe Groff
5b1bd6ed79 AST: Add checked cast kinds for concrete-to-archetype and concrete-to-unrelated-existential casts.
No typechecker or IRGen support just yet.

Swift SVN r9392
2013-10-16 00:10:11 +00:00
Adrian Prantl
7f688c806b Debug info: attach more appropriate locations to the phi nodes
at the beginning of each basic block.
rdar://15189057

Swift SVN r9327
2013-10-14 21:23:38 +00:00
Adrian Prantl
adc913b73c Debug info: The end of the prologue should point to the opening brace.
Some refactoring the separate the needs of the line table versus decls.
rdar://problem/15204469

Swift SVN r9224
2013-10-11 22:15:10 +00:00
Adrian Prantl
9ad9548388 Debug info: Update the inout testcase and emit debug information for
unboxed [inout] arguments.

Swift SVN r9187
2013-10-11 01:00:46 +00:00
Adrian Prantl
5325fd35e5 Debug info: Don't make byref types indirect.
Swift SVN r9160
2013-10-10 18:47:04 +00:00
John McCall
b880e60100 Remove SILFunctionTypeInfo in favor of SILFunctionType.
We still don't actually use this as a type, however.

Swift SVN r9091
2013-10-09 20:55:55 +00:00