John McCall
1a8e5740cb
Rename load -> loadAsCopy and fix a test case that
...
was accidentally causing a double retain (in a suspicious
case, but still).
Swift SVN r7350
2013-08-20 00:55:08 +00:00
John McCall
2ffcef1670
Make a couple minor interfaces traffic in Address instead
...
of OwnedAddress.
Swift SVN r7349
2013-08-20 00:55:04 +00:00
John McCall
eaa6228124
getFragileTypeInfo -> getTypeInfo
...
I didn't end up going the same way with fragility that I
thought I would at start, and this method name has become a
legacy.
Swift SVN r7340
2013-08-19 23:01:44 +00:00
Joe Groff
271046d583
IRGen: Start implementing switch_union lowering.
...
Implement the dispatch half of switch_union for no-payload and singleton unions, lowering them respectively to an integer switch or a simple branch. We don't yet bind the argument payload in the destination branches or handle multi-payload cases.
Swift SVN r7327
2013-08-19 18:15:56 +00:00
John McCall
7ec0f84e33
Demote most of the Explosion routines on TypeInfo to
...
the new LoadableTypeInfo refinement interface.
This protects against bugs which would introduce unbalanced
allocations of temporary memory.
Swift SVN r7227
2013-08-14 07:19:52 +00:00
Chris Lattner
b25af92552
change the StoreWeak "initialization" bit and accessors to follow the naming
...
convention of the CopyAddrInst methods.
Swift SVN r7161
2013-08-12 17:30:02 +00:00
Chris Lattner
c8f01a0bf3
Introduce a new SIL "assign" instruction to represent assignments in SIL when
...
SILGen doesn't know whether they are initializations or stores.
Swift SVN r7146
2013-08-12 14:24:52 +00:00
Dmitri Hrybenko
de59d8dcd4
Remove unneeded llvm:: qualifier for llvm::StringRef and llvm::SmallVector
...
Swift SVN r7089
2013-08-09 18:41:46 +00:00
Adrian Prantl
5e98accde4
Debug info: Rename createFunction -> emitFunction for consistency.
...
Swift SVN r7054
2013-08-08 21:20:07 +00:00
John McCall
14cb7001b3
Implement basic support for [weak].
...
Swift SVN r7041
2013-08-08 04:04:51 +00:00
John McCall
3f4dcf455a
dealloc_stack is not a no-op.
...
Swift SVN r6975
2013-08-07 03:21:14 +00:00
John McCall
5c8938eb7d
Prettify the stack trace when crashing in IRGenSIL.
...
Swift SVN r6972
2013-08-07 03:21:10 +00:00
John McCall
e9b913fb5b
Remove LocalStorageType, make it a kind of SILType.
...
Swift SVN r6968
2013-08-07 00:22:26 +00:00
John McCall
b0084f7204
Prepare SILType for more than just isAddress.
...
Swift SVN r6946
2013-08-06 20:23:12 +00:00
John McCall
36aa6c2645
alloc_stack needs to return two values like alloc_box.
...
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
2013-08-06 07:31:41 +00:00
John McCall
e3584068e8
Distinguish the allocation cases in IR-gen.
...
This gives us a more convenient type for allocateStack
and eliminates some unnecessary redundancy.
Swift SVN r6935
2013-08-06 07:31:36 +00:00
John McCall
592732c6b4
Split *one* unimplemented dealloc_ref instruction into
...
*two* unimplemented instructions! This is progress.
Swift SVN r6931
2013-08-06 01:23:51 +00:00
Chris Lattner
117f47f527
remove the hasFixedLifetime bit from ValueDecl, now that AST-level
...
capture analysis is gone. This functionality is subsumed by SIL passes,
which turn boxes into stack allocations.
One minor detail of this is that dealloc_ref isn't implemented yet in IRGen
(rdar://14648382) and SILGen produces it for destructors (e.g. see
test/SILGen/lifetime.swift). To unblock progress, I just removed the
llvm_unreachable in IRGen.
Swift SVN r6890
2013-08-05 14:59:08 +00:00
John McCall
b77c430848
Add SIL-gen and some missing runtime support for [unowned].
...
Swift SVN r6881
2013-08-03 08:46:54 +00:00
Joe Groff
5a2128bc77
SIL: Model project_existential using an address.
...
Have project_existential return $*This instead of $Builtin.OpaquePointer, and have protocol_method do the same for methods of opaque protocols. This makes it easier for passes to reason about the semantics of the projected address, since it's restricted by the semantics of SIL addresses.
Swift SVN r6872
2013-08-03 01:48:15 +00:00
John McCall
d7a72b93e1
Add ref_to_unowned and unowned_to_ref bitcast instructions.
...
Swift SVN r6838
2013-08-02 08:31:01 +00:00
John McCall
00a940ac1b
Rename weak_retain to unowned_retain and change it to
...
require the correct [unowned] type as an argument.
Swift SVN r6825
2013-08-02 00:02:09 +00:00
Dmitri Hrybenko
e1c4ae3174
Wrap llvm::SourceMgr in swift::SourceManager so that we can add new members
...
to the source manager.
Swift SVN r6815
2013-08-01 20:39:22 +00:00
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
Joe Groff
26c00fd429
SIL: Add a switch_int instruction.
...
This will help represent cleanup blocks in the grown-up Clang way instead of the childish SILGen way, e.g.:
retain %x
retain %y
...
break_branch:
%1 = int_literal 1 : $Builtin.Int64
br cleanup(%1)
return_branch:
%2 = int_literal 2 : $Builtin.Int64
br cleanup(%2)
cleanup(%dest : $Builtin.Int64):
release %z
release %y
switch %dest, case 1: break_dest, case 2: return_dest
Swift SVN r6753
2013-07-30 21:32:23 +00:00
Joe Groff
24dc1cfad7
SIL: Remove the redundant associated_metatype instruction.
...
Its behavior was exactly the same in IRGen as 'metatype' on the associated type. Managing type metadata should be IRGen's job.
Swift SVN r6677
2013-07-27 04:13:59 +00:00
Adrian Prantl
511ddc46fd
Debug Info: Set the debug location for the function prologue to the decl of the function.
...
rdar://problem/14536357
Swift SVN r6576
2013-07-25 01:03:46 +00:00
Joe Groff
398cbba5be
Rename SILConstant to SILDeclRef.
...
"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
2013-07-24 21:21:31 +00:00
John McCall
e668ff914f
Add parsing and IR-gen for weak_retain and weak_release.
...
Swift SVN r6492
2013-07-23 06:28:51 +00:00
Joe Groff
1984cf41e0
SIL: Rename SILFunction::getMangledName to SILFunction::getName.
...
Swift SVN r6430
2013-07-21 18:39:51 +00:00
Chris Lattner
d528b49fca
make getElementType() methods on SIL allocation instructions return a SILType.
...
This points out that perhaps IRGen's HeapArrayInfo should traffic in SILTypes
instead of CanTypes. I did the minimal update though.
Swift SVN r6405
2013-07-20 01:25:20 +00:00
Chris Lattner
47dd7a4cf4
rename SIL internals for AllocVar and DeallocVar to [De]AllocStack.
...
No syntax change yet.
Swift SVN r6382
2013-07-19 19:38:29 +00:00
Joe Groff
8e56e45f22
SIL: Define a switch_oneof instruction.
...
This instruction encapsulates testing, branching, and destructuring a oneof, as in:
oneof Expr {
case True
case False
case IntLiteral(Int)
case StringLiteral(String)
}
sil @dispatch_expr : $(Expr) -> () {
entry(%expr : $Expr):
switch_oneof %expr, \
case #Expr.True!oneofelt : bb1, \
case #Expr.False!oneofelt : bb2, \
case #Expr.IntLiteral!oneofelt : bb3, \
default bb4
bb1:
...
bb2:
...
bb3(%int : $Int):
...
bb4:
...
}
Swift SVN r6329
2013-07-17 16:55:29 +00:00
Adrian Prantl
ca7c9cb95b
Debug Info: Represent function parameters as argument variables
...
instead of local variables.
Swift SVN r6298
2013-07-16 21:07:35 +00:00
Adrian Prantl
39cef650cd
Create parameter types with their actual size and alignment parameters
...
instead of hardcoded values.
Swift SVN r6297
2013-07-16 21:07:33 +00:00
Joe Groff
7f86bd2648
IRGen: Remove catch-all for unimplemented instructions.
...
Put in stubs for the remaining unimplemented SIL instructions.
Swift SVN r6288
2013-07-16 15:29:14 +00:00
Chris Lattner
12872e5190
remove the allocation kind enum from alloc_var/dealloc_var/alloc_ref. There is
...
only one kind now: stack. alloc_var is just for stack memory now.
Swift SVN r6256
2013-07-15 16:48:56 +00:00
Chris Lattner
5322275156
remove the 'heap' form of alloc_var. It is not used, and the imagined
...
possible use cases are far enough away that we shouldn't worry about them
now.
Swift SVN r6253
2013-07-15 16:33:09 +00:00
Chris Lattner
5c1320042c
remove the "pseudo" class of alloc_var. It is not used.
...
Swift SVN r6252
2013-07-15 16:25:19 +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
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
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
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