Commit Graph

446 Commits

Author SHA1 Message Date
Michael Gottesman
6a65c7829e [sil] Add tuple_addr_constructor an instruction that can be used to initial a tuple in memory from individual address and object components.
This commit just introduces the instruction. In a subsequent commit, I am going
to add support to SILGen to emit this. This ensures that when we assign into a
tuple var we initialize it with one instruction instead of doing it in pieces.
The problem with doing it in pieces is that when one is emitting diagnostics it
looks semantically like SILGen actually is emitting code for initializing in
pieces which could be an error.
2023-11-06 15:32:05 -08:00
Slava Pestov
05ccd9734c SIL: Introduce ThrowAddrInst 2023-10-31 16:58:54 -04:00
swift-ci
2ff419323a Merge remote-tracking branch 'origin/main' into rebranch 2023-10-11 09:14:46 -07:00
Andrew Trick
bda4f52038 Fix TestRunner to provide a valid swiftPassInvocation. 2023-10-10 13:40:02 -07:00
Andrew Trick
727ff71476 Rename FunctionTest::getInvocation.
The test invocation is something completely different in this context.
2023-10-10 13:40:02 -07:00
swift-ci
56f70e947a Merge remote-tracking branch 'origin/main' into rebranch 2023-10-10 11:53:54 -07:00
Nate Chandler
9ca6b9ac1f [Test] Print to stdout.
In the C++ sources it is slightly more convenient to dump to stderr than
to print to stdout, but it is rather more unsightly to print to stderr
from the Swift sources.  Switch to stdout.  Also allows the dump
functions to be marked debug only.
2023-10-10 08:19:44 -07:00
swift-ci
8cf5e2bf4d Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 12:36:08 -07:00
nate-chandler
954c0f5f3f Merge pull request #68813 from nate-chandler/swiftcompilersources/test-bridging
[SwiftCompilerSources] Bridged in-IR testing.
2023-09-29 12:28:07 -07:00
swift-ci
309d089075 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-29 10:13:55 -07:00
Allan Shortlidge
1d8fc104c3 AST/SILGen: Requestify function body skipping.
Function bodies are skipped during typechecking when one of the
-experimental-skip-*-function-bodies flags is passed to the frontend. This was
implemented by setting the "body kind" of an `AbstractFunctionDecl` during decl
checking in `TypeCheckDeclPrimary`. This approach had a couple of issues:

- It is incompatible with skipping function bodies during lazy typechecking,
  since the skipping is only evaluated during a phase of eager typechecking.
- It prevents skipped function bodies from being parsed on-demand ("skipped" is
  a state that is distinct from "parsed", when they ought to be orthogonal).
  This needlessly prevented complete module interfaces from being emitted with
  -experimental-skip-all-function-bodies.

Storing the skipped status of a function separately from body kind and
requestifying the determination of whether to skip a function solves these
problems.

Resolves rdar://116020403
2023-09-28 19:18:35 -07:00
Nate Chandler
36805c8a41 [Test] Moved test-spec parsing test to Swift.
To prove out that the bridging works.
2023-09-28 15:15:29 -07:00
Nate Chandler
dab8c146a6 [SwiftCompilerSources] Bridged in-IR testing.
Added the bridging types involved and the basic functionality.
2023-09-28 11:33:50 -07:00
swift-ci
2e6b1cd2f7 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-28 07:13:53 -07:00
swift-ci
7fc36edb98 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-27 09:34:12 -07:00
Kuba Mracek
7c5962b8a7 [embedded] Prefer Module.getOptions().EmbeddedSwift in SIL code 2023-09-27 09:04:02 -07:00
nate-chandler
197a4a3180 Merge pull request #68756 from nate-chandler/nfc/20230925/1/distinguish-non-users
[PrunedLiveness] Add extendToNonUse.
2023-09-26 18:01:55 -07:00
Evan Wilde
dfab77eb8e Include memory effects in SILOptimizer/Link.cpp
Link.cpp started pulling in the macros from RuntimeFunctions.def, which
do not include memory effects on main, but do on rebranch. This resulted
in build failures due to extra parameters to the macro function.
2023-09-26 16:17:50 -07:00
Kuba Mracek
a835c6ba1f [embedded] -O and -Osize embedded runtime 2023-09-25 21:28:37 -07:00
Kuba Mracek
86ad378928 [embedded] Add a simple Swift runtime, written in embedded Swift 2023-09-25 19:51:19 -07:00
Nate Chandler
198069d03c [Test] Renamed test.
Replaced hyphens with underscores.
2023-09-25 18:49:29 -07:00
Slava Pestov
ce3b2a428f SIL: Fix opaque type erasure after clearing [serialized] flags
After serialization, we no longer need to enforce the resilience
boundary between inlinable and non-inlinable functions, so we
make a pass over the SIL to clear [serialized] flags and
substitute any opaque return types.

The logic for AST types was wrong; we can't just lower the type
and get the AST type out. Instead, do the same thing that
TypeSubstCloner does.

Fixes rdar://problem/115355709.
2023-09-20 12:58:56 -04:00
Erik Eckstein
f0b811c45f SIL: add the end_init_let_ref instruction
This instructions marks the point where all let-fields of a class are initialized.
This is important to ensure the correctness of ``ref_element_addr [immutable]`` for let-fields,
because in the initializer of a class, its let-fields are not immutable, yet.
2023-09-19 15:10:30 +02:00
Erik Eckstein
e5eb15dcbe Swift SIL: replace the set_deallocating instruction with begin_dealloc_ref
Codegen is the same, but `begin_dealloc_ref` consumes the operand and produces a new SSA value.
This cleanly splits the liferange to the region before and within the destructor of a class.
2023-09-19 15:10:30 +02:00
Michael Gottesman
37d60a08bb [move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value.
I was originally hoping to reuse mark_must_check for multiple types of checkers.
In practice, this is not what happened... so giving it a name specifically to do
with non copyable types makes more sense and makes the code clearer.

Just a pure rename.
2023-08-30 22:29:30 -07:00
Nate Chandler
7bddaf36a0 [SIL] Added tuple_pack_extract.
The new instruction is needed for opaque values mode to allow values to
be extracted from tuples containing packs which will appear for example
as function arguments.
2023-08-16 11:15:05 -07:00
Nate Chandler
f938287710 [SIL] Added unowned_copy_value. 2023-08-08 15:49:17 -07:00
Nate Chandler
c007bae723 [SIL] Added weak_copy_value.
The new instruction wraps a value in a `@sil_weak` box and produces an
owned value. It is only legal in opaque values mode and is transformed
by `AddressLowering` to `store_weak`.
2023-08-08 15:47:13 -07:00
Nate Chandler
e135c5cac7 [SIL] Added strong_copy_weak_value.
The new instruction unwraps an `@sil_weak` box and produces an owned
value. It is only legal in opaque values mode and is transformed by
`AddressLowering` to `load_weak`.
2023-08-08 15:47:13 -07:00
Erik Eckstein
2384a0c6f4 Optimizer: remove the now unused LSLocation utilities 2023-07-21 07:19:56 +02:00
Nate Chandler
22df319549 [Test] Ensourced fieldsensitive-multidefuse...
-liverange.  Moved the test next to the code it calls.
2023-07-04 11:52:14 -07:00
Nate Chandler
0c17600380 [Test] Ensourced accesspath-base.
Moved the test next to the code it calls.
2023-07-04 11:52:14 -07:00
Nate Chandler
b9b286eff2 [Test] Ensourced simplify-cfg-try-jump-threading.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
f1d61afdfb [Test] Ensourced simplify-cfg-simplify....
-term-with-identical-dest-blocks.  Moved the test next to the code it
calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
736b1afb4d [Test] Ensourced simplify-cfg-simplify-switch....
-enum-unreachable-blocks.  Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
d57b1e5fee [Test] Ensourced simplify-cfg-simplify-switch....
-enum-on-objc-class-optional.  Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
49bc5a66d4 [Test] Ensourced simplify-cfg-simplify-switch....
-enum-block.  Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
bf229c357e [Test] Ensourced simplify-cfg-canonicalize....
-switch-enum.  Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
df02726e7b [Test] Ensourced simplify-cfg-simplify-block-args.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
bc909e5b28 [Test] Ensourced simplify-cfg-simplify-argument.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
50f2a0250f [Test] Ensourced ossa-lifetime-completion.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
906a4b9d86 [Test] Ensourced extended-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
1cd26322aa [Test] Ensourced interior-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
84e42fdb94 [Test] Ensourced linear-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
9417651d00 [Test] Ensourced find-borrow-introducers.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
8f0378c3bc [Test] Ensourced find-enclosing-defs.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
a3db694af2 [Test] Ensourced visit-inner-adjacent-phis.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
bddc946574 [Test] Ensourced is-lexical.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
ad9fee2883 [Test] Ensourced shrink-borrow-scope.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
ee95732406 [Test] Ensourced is-deinit-barrier.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00