Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[embedded] Add a flag to specify whether the module is leaf or library #72688

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kubamracek
Copy link
Contributor

Add two new flags, restricted to only be available under Embedded Swift:

  • -optimize-embedded-module-as=leaf -- this will allow more optimizations, specifically dead-code elimination and possibly removal of things that would normally be an ABI break (e.g. vtable entries) but if the module cannot have any clients, then it's not an ABI break
  • -optimize-embedded-module-as=library
  • plus the default state of "unknown"

This is just adding the flag, further work with enable the actual optimizations.

@@ -585,6 +585,8 @@ ERROR(objc_with_embedded,none,
"Objective-C interoperability cannot be enabled with embedded Swift.", ())
ERROR(no_allocations_without_embedded,none,
"-no-allocations is only applicable with embedded Swift.", ())
ERROR(optimize_embedded_module_without_embedded,none,
"-optimize-embedded-module-as is only applicable with embedded Swift.", ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be restricted to just embedded? couldn't we perhaps also use this leaf vs lib optimization in non-embedded cases too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it would give benefits in regular swift, too. Assuming build systems, like swifpm, support this option

@kubamracek kubamracek added the embedded Embedded Swift label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
embedded Embedded Swift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants