Commit Graph

665 Commits

Author SHA1 Message Date
Erik Eckstein
748264c45f Add a unprotectedStackAlloc builtin
It's like `Builtin.stackAlloc`, but doesn't set the `[stack_protection]` flag on its containing function.
2023-02-15 08:09:38 +01:00
swift-ci
8ec1f5847b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-20 10:30:05 -08:00
John McCall
0e3a9adc32 Add Builtin.PackIndex 2023-01-19 23:57:13 -05:00
swift-ci
5df3e6ca80 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-11 01:56:51 -08:00
Konrad `ktoso` Malawski
f8b85015c1 prepare flags
wip on options

implement discardResults as a flag passed to grout init
2023-01-05 16:19:05 +09:00
swift-ci
372abeea69 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-06 14:14:21 -08:00
Ben Rimmington
0b29450a3d [SE-0368] StaticBigInt (#40722) 2022-12-06 21:59:42 +00:00
Erik Eckstein
e292d17672 llvm::array_lengthof -> std::size 2022-11-04 20:44:19 +01:00
Robert Widmann
7944635f2e Merge pull request #61898 from CodaFi/i-write-syns-not-tragedies 2022-11-04 08:20:47 -07:00
Nate Chandler
520dfc26cd [OpaqueValues] Added variants of addressOfBorrow.
The variants are produced by SILGen when opaque values are enabled.
They are necessary because otherwise SILGen would produce
address_to_pointer of values.

They will be lowered by AddressLowering.
2022-11-02 14:41:35 -07:00
Robert Widmann
2d07f382c5 Delete _InternalSwiftSyntaxParser And Its Build Infrastructure
This is the start of the removal of the C++ implementation of libSyntax
in favor of the new Swift Parser and Swift Syntax libraries. Now that
the Swift Parser has switched the SwiftSyntaxParser library over to
being a thin wrapper around the Swift Parser, there is no longer any
reason we need to retain any libSyntax infrastructure in the swift
compiler.

As a first step, delete the infrastructure that builds
lib_InternalSwiftSyntaxParser and convert any scripts that mention
it to instead mention the static mirror libraries. The --swiftsyntax
build-script flag has been retained and will now just execute the
SwiftSyntax and Swift Parser builds with the just-built tools.
2022-11-02 10:35:29 -07:00
Hamish Knight
b645e63ce5 [AST] NFC: Refactor GenericTypeParamDecl construction
Add distinct overloads for the parser,
deserialization and code synthesis.
2022-10-14 15:40:12 +01:00
Holly Borla
c4b946195e [AST] Replace the "type sequence" terminology with "parameter pack". 2022-10-10 16:28:13 -07:00
Slava Pestov
c1b8690401 AST: Introduce special Builtin.TheTupleType singleton 2022-09-10 00:26:42 -04:00
Erik Eckstein
97b2354be6 SIL: add needsStackProtection flags for address_to_pointer and index_addr instructions.
Also add new "unprotected" variants of the `addressof` builtins:
* `Builtin.unprotectedAddressOf`
* `Builtin.unprotectedAddressOfBorrow`
2022-09-08 08:42:22 +02:00
Hamish Knight
b12015c343 [SIL] Introduce the increment_profiler_counter instruction
This is a dedicated instruction for incrementing a
profiler counter, which lowers to the
`llvm.instrprof.increment` intrinsic. This
replaces the builtin instruction that was
previously used, and ensures that its arguments
are statically known. This ensures that SIL
optimization passes do not invalidate the
instruction, fixing some code coverage cases in
`-O`.

rdar://39146527
2022-09-07 17:55:13 +01:00
Michael Gottesman
4dc6e6ecc4 [move-keyword] Remove old implementation.
By using the keyword instead of the function, we actually get a much simpler
implementation since we avoid all of the machinery of SILGenApply. Given that we
are going down that path, I am removing the old builtin implementation since it
is dead code.

The reason why I am removing this now is that in a subsequent commit, I want to
move all of the ownership checking passes to run /before/ mandatory inlining. I
originally placed the passes after mandatory inlining since the function version
of the move keyword was transparent and needing to be inlined before we could
process it. Since we use the keyword now, that is no longer an issue.
2022-09-04 01:19:01 -07:00
Michael Gottesman
d63ac994b7 Delete dead code around UnsafeGuaranteed that I removed recently. 2022-08-21 22:46:09 -07:00
Michael Gottesman
3e52007562 [builtin] Remove "unsafeGuaranteed" and related code since Unmanaged now has an Ownership SSA based implementation that works completely in SILGen.
This isn't used in the stdlib anymore as well.
2022-08-21 01:22:36 -07:00
swift-ci
7382a9c41e Merge remote-tracking branch 'origin/main' into rebranch 2022-07-11 07:53:46 -07:00
Nate Chandler
34c08b8344 [TaskToThread] Add Task.runInline.
The new intrinsic, exposed via static functions on Task<T, Never> and
Task<T, Error> (rethrowing), begins an asynchronous context within a
synchronous caller's context.  This is only available for use under the
task-to-thread concurrency model, and even then only under SPI.
2022-07-08 08:44:18 -07:00
swift-ci
a12ece4179 Merge remote-tracking branch 'origin/main' into rebranch 2022-06-24 20:54:07 -07:00
Holly Borla
429488f6c9 [Sema] Use ExistentialType for Any and AnyObject. 2022-06-17 18:29:15 -07:00
Ben Barham
42848f8019 [next] Add default handling for new IITDescriptor::AnyPtrToElt
Added in llvm/llvm-project 49c2206b3bdce4a37a4602527b2d3da673514333.
Unhandled for now.
2022-05-05 16:25:10 -07:00
swift_jenkins
d45880ef74 Merge remote-tracking branch 'origin/main' into next 2022-02-12 11:21:05 -08:00
Kuba (Brecka) Mracek
5d1ddbf33c Fix the signature of Builtin.Once() to take callback with an argument, to match swift_once() (#41353) 2022-02-12 11:18:11 -08:00
swift_jenkins
ef4921f907 Merge remote-tracking branch 'origin/main' into next 2022-01-27 09:20:54 -08:00
Doug Gregor
0416ec708b Augment GenericTypeParamDecl with bits indicating they came from opaque types 2022-01-26 14:47:11 -08:00
swift_jenkins
38fe5d045c Merge remote-tracking branch 'origin/main' into next 2021-12-01 17:41:30 -08:00
swift-ci
aac5a9d817 Merge remote-tracking branch 'origin/main' into rebranch 2021-12-01 17:35:19 -08:00
Andrew Trick
056ebe3514 Add Builtin.assumeAlignment(RawPointer, Int64) 2021-11-30 11:53:58 -08:00
swift-ci
ea91d8d7f0 Merge remote-tracking branch 'origin/main' into rebranch 2021-11-29 00:32:49 -08:00
swift_jenkins
b83d44ca15 Merge remote-tracking branch 'origin/main' into next 2021-11-29 00:20:22 -08:00
Devin Coughlin
3abd7b0e1f Add a targetOSVersionAtLeast builtin.
This allows the compiler to parse the Swift swiftinterface file of a recent SDK.
2021-11-22 11:59:56 +01:00
Ben Barham
87d26e9567 [next] Ignore the new PPCQuad intrinsic
Added in llvm-project 741aeda97d6327edd9905b21a5308fcee21bbefd.
2021-11-18 21:58:56 +10:00
swift_jenkins
2acdb94977 Merge remote-tracking branch 'origin/main' into next 2021-11-15 09:41:26 -08:00
swift-ci
d2273a91be Merge remote-tracking branch 'origin/main' into rebranch 2021-11-15 09:35:20 -08:00
Andrew Trick
90c0c8b60f Add rebind_memory SIL instruction.
Required for UnsafeRawPointer.withMemoryReboud(to:).

%out_token = rebind_memory %0 : $Builtin.RawPointer to %in_token

%0 must be of $Builtin.RawPointer type

%in_token represents a cached set of bound types from a prior memory state.

%out_token is an opaque $Builtin.Word representing the previously bound
types for this memory region.

This instruction's semantics are identical to ``bind_memory``, except
that the types to which memory will be bound, and the extent of the
memory region is unknown at compile time. Instead, the bound-types are
represented by a token that was produced by a prior memory binding
operation. ``%in_token`` must be the result of bind_memory or
2021-11-14 22:44:46 -08:00
Andrew Trick
17fef2fb1e Give bind_memory a token result.
Required for UnsafeRawPointer.withMemoryRebound(to:)

%token = bind_memory %0 : $Builtin.RawPointer, %1 : $Builtin.Word to $T

%0 must be of $Builtin.RawPointer type

%1 must be of $Builtin.Word type

%token is an opaque $Builtin.Word representing the previously bound types
for this memory region.
2021-11-14 22:04:46 -08:00
swift_jenkins
4218737a20 Merge remote-tracking branch 'origin/main' into next 2021-11-08 18:40:34 -08:00
swift-ci
93206abe09 Merge remote-tracking branch 'origin/main' into rebranch 2021-11-08 18:35:50 -08:00
Robert Widmann
22405cefea Plumb the "Is Type Sequence" Bit Through the Surface AST 2021-11-08 13:48:30 -08:00
swift-ci
5f45c4a328 Merge remote-tracking branch 'origin/main' into rebranch 2021-10-30 06:34:39 -07:00
swift_jenkins
9c3da2d3e6 Merge remote-tracking branch 'origin/main' into next 2021-10-30 06:31:56 -07:00
Slava Pestov
f38f25a3de AST: Factor out AbstractGenericSignatureRequest into a new buildGenericSignature() function
This is slightly cleaner.
2021-10-30 00:35:59 -04:00
swift_jenkins
917f7b18df Merge remote-tracking branch 'origin/main' into next 2021-10-29 20:01:55 -07:00
swift-ci
dee2b5fea7 Merge remote-tracking branch 'origin/main' into rebranch 2021-10-29 19:34:23 -07:00
Michael Gottesman
f9122a79b7 [moveOnly] Implement a new _copy function that performs an explicit copy value.
The key thing is that the move checker will not consider the explicit copy value
to be a copy_value that can be rewritten, ensuring that any uses of the result
of the explicit copy_value (consuming or other wise) are not checked.

Similar to the _move operator I recently introduced, this is a transparent
function so we can perform one level of specialization and thus at least be
generic over all concrete types.
2021-10-29 15:37:46 -07:00
swift_jenkins
6bb887d8fd Merge remote-tracking branch 'origin/main' into next 2021-10-28 04:24:16 -07:00
swift-ci
7081f4dd9c Merge remote-tracking branch 'origin/main' into rebranch 2021-10-28 02:34:19 -07:00