Commit Graph

44 Commits

Author SHA1 Message Date
Erik Eckstein
65c9828cb3 SwiftCompilerSources: move the Context protocols from the Optimizer to the SIL module
This allows to move many SIL APIs and utilities, which require a context, to the SIL module.

The SIL-part of SwiftPassInvocation is extracted into a base class SILContext which now lives in SIL.

Also: simplify the begin/end-pass functions of the SwiftPassInvocation.
2025-07-28 14:19:07 +02:00
Nate Chandler
2e2a81b766 [Test] Underscored dump_function.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:52:21 -07:00
Nate Chandler
365c1a0286 [Test] Provide dead-end blocks to SIL tests.
Via a new method on the dependencies struct.
2024-07-03 15:27:00 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Nate Chandler
edf71f49d6 [Gardening] Test: Dropped spurious imports.
Now that tests of various utilities have been moved next to the
utilities themselves, the TestRunner file doesn't need to import the
corresponding headers.
2024-03-13 13:50:27 -07:00
Andrew Trick
8b24382494 SwiftCompilerSources: cleanup and extend ArgumentConventions
Provide APIs needed by lifetime dependence diagnostics, namely LifetimeDependenceConvention.

Reorganize the APIs so it's easy to find related functionality which
API is responsible for which functionality.

Remove the originalFunctionConvention complexity. It is no longer
needed for lifetime dependence inference, and generally should be
avoided in SIL.

Add some placeholder FIXMEs because this not a good PR in which to
change existing functionality.
2024-02-12 09:57:14 -08:00
Andrew Trick
e271973246 Fix FunctionTest memory corruption in SwiftCompilerSouces.
A FunctionTest created in Swift source has no persistent storage
address. This results in sporadic crashes when running unit tests.

Fix the FunctionTest registry to store the value of the test.

Eventually, we could probably rig something up with @_rawLayout, but
it makes more sense for FunctionTest to be a value type anyway.
2024-01-20 09:44:23 -08: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
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
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
Nate Chandler
198069d03c [Test] Renamed test.
Replaced hyphens with underscores.
2023-09-25 18:49:29 -07: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
Nate Chandler
ec120e41e7 [Test] Ensourced canonicalize-borrow-scope.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
c0783aa70f [Test] Ensourced canonicalize-ossa-lifetime.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
fcec328c54 [Test] Ensourced multidefuse-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
f99637156b [Test] Ensourced multidef-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
303664c940 [Test] Ensourced scoped-address-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
ef02dc2081 [Test] Ensourced ssa-liveness.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
524c676318 [Test] Ensourced print-type-lowering.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
3343ab926d [Test] Ensourced pruned-livenes-boundary...
-with-list-of-last-users-insertion-points.  Moved the test next to the
code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
044625c31f [Test] Ensourced lexical-destroy-folding.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
2e317907fd [Test] Ensourced has-pointer-escape.
Moved the test next to the code it calls.
2023-07-04 11:52:13 -07:00
Nate Chandler
e9ab3b4b53 [Test] Refactored SIL "unit" tests.
Renamed UnitTest to FunctionTest.

FunctionTests are now instantiated once as global objects--with their
names and the code they are to run--at which time they are stored by
name in a global registry.

Moved the types to the SIL library.

Together, these changes enable defining unit tests in the source file
containing the code to be tested.
2023-07-04 11:52:11 -07:00