1
Fork 0
rust/compiler/rustc_session/src
bors 2d1e075079 Auto merge of #96285 - flip1995:pk-vfe, r=nagisa
Introduce `-Zvirtual-function-elimination` codegen flag

Fixes #68262

This PR adds a codegen flag `-Zvirtual-function-elimination` to enable the VFE optimization in LLVM. To make this work, additonal  information has to be added to vtables ([`!vcall_visibility` metadata](https://llvm.org/docs/TypeMetadata.html#vcall-visibility-metadata) and a `typeid` of the trait). Furthermore, instead of just `load`ing functions, the [`llvm.type.checked.load` intrinsic](https://llvm.org/docs/LangRef.html#llvm-type-checked-load-intrinsic) has to be used to map functions to vtables.

For technical details of the changes, see the commit messages.

I also tested this flag on https://github.com/tock/tock on different boards to verify that this fixes the issue https://github.com/tock/tock/issues/2594. This flag is able to improve the size of the resulting binary by about 8k-9k bytes by removing the unused debug print functions.

[Rendered documentation update](https://github.com/flip1995/rust/blob/pk-vfe/src/doc/rustc/src/codegen-options/index.md#virtual-function-elimination)
2022-06-14 21:37:11 +00:00
..
cgu_reuse_tracker.rs Prettify rustc_session fmt with capturing args (nfc) 2022-03-24 22:38:13 -07:00
code_stats.rs Vigorously refactor _session::code_stats (nfc) 2022-03-24 22:38:16 -07:00
config.rs Stabilize the bundle native library modifier 2022-06-09 23:12:58 +04:00
cstore.rs Stabilize native library modifier syntax and the whole-archive modifier specifically 2022-03-30 23:53:21 +03:00
filesearch.rs Prettify rustc_session fmt with capturing args (nfc) 2022-03-24 22:38:13 -07:00
lib.rs lint: add diagnostic translation migration lints 2022-06-10 15:50:06 +01:00
options.rs Auto merge of #96285 - flip1995:pk-vfe, r=nagisa 2022-06-14 21:37:11 +00:00
output.rs Use a let-chain in _session::output (nfc) 2022-03-24 22:38:32 -07:00
parse.rs lint: add diagnostic translation migration lints 2022-06-10 15:50:06 +01:00
search_paths.rs incr. comp.: Don't export impl_stable_hash_via_hash!() and warn about using it. 2022-04-19 10:43:20 +02:00
session.rs Auto merge of #96285 - flip1995:pk-vfe, r=nagisa 2022-06-14 21:37:11 +00:00
utils.rs rustc_parse: Move AST -> TokenStream conversion logic to rustc_ast 2022-05-22 12:01:07 +03:00