Commit Graph

23 Commits

Author SHA1 Message Date
Evan Wilde
044002934b Remove Typed-Pointer cutouts
This removes some of the typed pointer cutouts in IRGen.
LLVM has removed the typed pointers, so `LLVMContext.setOpaquePointers`
doesn't make sense. Clang doesn't have opaque pointers either.

Also removing defunct assertions in IRGen were checking pointer-type
information. With llvm moving to opaque pointer types, these functions
are no longer returning useful information and are deprecated.

Specifically
 - `isOpaqueOrPointeeTypeMatches` always returns true
 - `supportsTypedPointers()` always returns false
 - `getNonOpaquePointerElementType()->isFunctionTy()` will never get hit
2023-07-25 12:28:28 -07:00
Nate Chandler
af4e7da286 [IRGen] Add hashable conformance to [Stack]Addr.
Provide template instantiations of llvm::DenseMapInfo at
swift::irgen::Address and swift::irgen::StackAddress.
2023-06-05 08:11:27 -07:00
Arnold Schwaighofer
7e96f3e323 IRGen: Remove dump() calls in Address.h 2022-10-04 13:49:00 -07:00
Arnold Schwaighofer
d810b0f7e4 IRGen: Pass the elementType of pointers through to operations
In preparation for moving to llvm's opaque pointer representation
replace getPointerElementType and CreateCall/CreateLoad/Store uses that
dependent on the address operand's pointer element type.

This means an `Address` carries the element type and we use
`FunctionPointer` in more places or read the function type off the
`llvm::Function`.
2022-10-03 15:27:12 -07:00
Arnold Schwaighofer
2271d4df55 Use taskAlloc for dynamic allocas
Async coroutines don't support dynamic allocas.
2020-11-13 10:41:42 -08:00
John McCall
3c54c0edfc IRGen and basic optimizer support for coroutines. 2018-01-09 11:35:09 -05:00
John McCall
1f3f33e67d Clean up the internal APIs around dynamic allocas to structurally
discourage accidental use of them.  Relatedly, fix several bugs
where we were accidentally using dynamic allocas.
2017-12-19 00:29:43 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Arnold Schwaighofer
cd1037b799 IRGen: Allocate generic/resilient values on the stack instead of on the heap
Allocate buffers for local generic/resilient values on the stack. alloc_stack
instructions in the entry block are translated using a dynamic alloca
instruction with variables size. All other alloc_stack instructions in addition
use llvm's stacksave/restore instrinsics to reset the stack (they could be
executed multiple times and with varying sizes).
2016-12-20 07:24:02 -08:00
Bob Wilson
ae3db7c88e Update for llvm r281167: changes to ilist_iterator template arguments.
(cherry picked from commit 97e415ce2a)
2016-12-01 10:47:07 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Saleem Abdulrasool
90de8458af IRGen: move the iterator dereference out of ctor
Rather than have the iterator form of the Address constructor, remove it and
inline the dereference at the sites.  This removes two constructors which used
`ilist_iterator` which is now much more complex.
2016-10-06 09:46:04 -07:00
Erik Eckstein
9ad406d5d6 Remove the local_storage type attribute and SIL value category.
They are not used anymore as alloc_stack now returns a single value.
2016-01-06 17:35:27 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Michael Gottesman
9fb54bf4bf Fix for upstream ilist changes. 2015-11-11 16:07:41 -08:00
Joe Groff
a2672e9313 SIL: Turn conditional checked casts into a branch instruction.
Replace the existing suite of checked cast instructions with:

- unconditional_checked_cast, which performs an unconditional cast that aborts on failure (like the former downcast unconditional); and
- checked_cast_br, which performs a conditional pass and branches on whether the cast succeeds, passing the result to the true branch as an argument.

Both instructions take a CheckedCastKind that discriminates the different casting modes formerly discriminated by instruction type. This eliminates a source of null references in SIL and eliminates null SIL addresses completely.

Swift SVN r8696
2013-09-26 18:24:44 +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
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
9106aa6254 Rewrite the function-call infrastructure. This gets us
a lot closer to successfully emitting the polymorphic-min-over-ranges
example;  the main blocker right now seems to be that the witness
for a static member function is not, in fact, a static member
function at al, but a freestanding function.  That's legitimate,
but it probably needs some shepherding through the witness
system.

Swift SVN r2532
2012-08-03 08:10:47 +00:00
John McCall
53646ccfc8 Better support for mangling, emitting, and using local
functions.

Swift SVN r2152
2012-06-05 04:51:21 +00:00
John McCall
df7ebcd9e8 Introduce the concept of an 'owned address', i.e. an address with
an owner attached.  Use this to implement [byref(heap)].  Force
locals to the heap if they've been referenced in a way that requires
this.

Swift SVN r1265
2012-03-26 03:26:21 +00:00
John McCall
e020724c3d Distinguish between assignment and initialization, and fix
some problems with the data pointer of function types.

Swift SVN r1220
2012-03-16 19:02:25 +00:00
John McCall
9b7fb0c227 New l-value representation.
Swift SVN r956
2011-12-22 05:28:33 +00:00