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
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`.
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).
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.
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
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
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
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