Commit Graph

21 Commits

Author SHA1 Message Date
Ryan Mansfield
ba0ce8aea6 Add frontend options to write SIL and LLVM IR as additional compilation output.
This commit adds -sil-output-path and -ir-output-path frontend options that
allow generating SIL and LLVM IR files as supplementary outputs during normal
compilation.

These options can be useful for debugging and analysis tools
workflows that need access to intermediate compilation artifacts
without requiring separate compiler invocations.

Expected behaviour:

Primary File mode:
 - SIL: Generates one .sil file per source file
 - IR: Generates one .ll file per source file

Single-threaded WMO mode:
 - SIL: Generates one .sil file for the entire module
 - IR: Generates one .ll file for the entire module

Multi-threaded WMO mode:
 - SIL: Generates one .sil file for the entire module
 - IR: Generates separate .ll files per source file

File Maps with WMO:
 - Both SIL and IR outputs using first entry's naming, which is
   consistent with the behaviour of other supplementary outputs.

rdar://160297898
2025-10-06 15:45:49 -04:00
Anthony Latsis
0c509f6891 Immediate: Adjust uses of llvm::jitlink::Symbol::{get,set}Name (type signature changed)
Per 2ccf7ed277df28651b94bbee9fccefdf22fb074f (llvm-project).
2025-04-24 19:13:36 +01:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -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
Ben Barham
0f52071c22 Fix up various references to renamed/moved enums
A bunch of enums were moved to enum classes and slightly renamed. Fix up
their references.
2024-04-08 08:58:58 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Slava Pestov
06b1aee360 Evaluator: Cache circular evaluation to avoid redundant diagnostics
Previously, if a request R evaluated itself N times, we would emit N
"circular reference" diagnostics. These add no value, so instead let's
cache the user-provided default value on the first circular evaluation.

This changes things slightly so that instead of returning an
llvm::Expected<Request::OutputType>, various evaluator methods take
a callback which can produce the default value.

The existing evaluateOrDefault() interface is unchanged, and a new
evaluateOrFatal() entry point replaces
llvm::cantFail(ctx.evaluator(...)).

Direct callers of the evaluator's operator() were updated to pass in
the callback. The benefit of the callback over evaluateOrDefault() is
that if the default value is expensive to constuct, like a dummy
generic signature, we will only construct it in the case where a
cycle actually happened, otherwise we just delete the callback.

(cherry picked from commit b8fcf1c709efa6cd28e1217bd0efe876f7c0d2b7)
2024-02-09 16:02:24 -08:00
Ellie Shin
72a7760027 Support package SIL linkage.
Decls with a package access level are currently set to public SIL
linkages. This limits the ability to have more fine-grained control
and optimize around resilience and serialization.
This PR introduces a separate SIL linkage and FormalLinkage for
package decls, pipes them down to IRGen, and updates linkage checks
at call sites to include package linkage.

Resolves rdar://121409846
2024-02-06 01:23:14 -08:00
Zak Kent
2abca625d7 Merge branch 'main' into update-immediate 2023-08-18 16:07:14 -07:00
Zak Kent
6aafeec181 [Immediate] [SILGen] Implement on-demand compilation of globals 2023-08-17 11:03:11 -07:00
Zak Kent
e276c79939 [SIL] [Immediate] Promote linkage of SILFunctions defining requested symbols
Promotes the linkage of `SILFunction`s defining requested symbols,
ensuring they are emitted during IRGen.
2023-08-17 10:11:29 -07:00
Zak Kent
f82fa91de9 [Immediate] Promote linkage of lazily discovered internal symbols 2023-08-17 09:56:40 -07:00
Zak Kent
a6eb4b44c7 [TBD] Refactored SymbolSourceMap to be a typedef 2023-08-17 09:55:49 -07:00
Zak Kent
c0a16d06ed [Immediate] Drop back to RuntimeDyld on Linux 2023-08-14 13:28:23 -07:00
Zak Kent
4616e03f61 [Immediate] Only add renamer plugin on macOS 2023-08-14 13:28:23 -07:00
Zak Kent
514fc1e55f [Immediate] Explicitly move error when returning 2023-08-14 13:28:23 -07:00
Zak Kent
03b539d06e [TBD] [Immediate] Revert implementation of SymbolSourceMap 2023-08-14 13:28:23 -07:00
Zak Kent
5181270a87 [Immediate] Remove unused functions in SwiftJIT 2023-08-14 13:28:22 -07:00
Zak Kent
473a18d2ce [Immediate] Implement EagerSwiftMaterializationUnit 2023-08-14 13:28:22 -07:00
Zak Kent
6abc5c5d39 [Immediate] Re-introduce lazy reexports 2023-08-14 13:28:22 -07:00
Zak Kent
48c36c956d [Immediate] Move SwiftMaterializationUnit to public library 2023-08-14 13:28:22 -07:00