rust/compiler/rustc_codegen_llvm/Cargo.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
TOML
Raw Normal View History

2020-08-28 03:58:48 +00:00
[package]
name = "rustc_codegen_llvm"
version = "0.0.0"
2021-09-19 16:49:55 +00:00
edition = "2021"
2020-08-28 03:58:48 +00:00
[lib]
test = false
doctest = false
[dependencies]
bitflags = "1.0"
2021-02-13 11:17:15 +00:00
cstr = "0.2"
2020-08-28 03:58:48 +00:00
libc = "0.2"
libloading = "0.7.1"
2021-10-07 13:08:44 +00:00
measureme = "10.0.0"
2020-08-28 03:58:48 +00:00
tracing = "0.1"
rustc_middle = { path = "../rustc_middle" }
2021-08-10 21:05:25 +00:00
rustc-demangle = "0.1.21"
2020-08-28 03:58:48 +00:00
rustc_attr = { path = "../rustc_attr" }
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
Add metadata generation for vtables when using VFE This adds the typeid and `vcall_visibility` metadata to vtables when the -Cvirtual-function-elimination flag is set. The typeid is generated in the same way as for the `llvm.type.checked.load` intrinsic from the trait_ref. The offset that is added to the typeid is always 0. This is because LLVM assumes that vtables are constructed according to the definition in the Itanium ABI. This includes an "address point" of the vtable. In C++ this is the offset in the vtable where information for RTTI is placed. Since there is no RTTI information in Rust's vtables, this "address point" is always 0. This "address point" in combination with the offset passed to the `llvm.type.checked.load` intrinsic determines the final function that should be loaded from the vtable in the `WholeProgramDevirtualization` pass in LLVM. That's why the `llvm.type.checked.load` intrinsics are generated with the typeid of the trait, rather than with that of the function that is called. This matches what `clang` does for C++. The vcall_visibility metadata depends on three factors: 1. LTO level: Currently this is always fat LTO, because LLVM only supports this optimization with fat LTO. 2. Visibility of the trait: If the trait is publicly visible, VFE can only act on its vtables after linking. 3. Number of CGUs: if there is more than one CGU, also vtables with restricted visibility could be seen outside of the CGU, so VFE can only act on them after linking. To reflect this, there are three visibility levels: Public, LinkageUnit, and TranslationUnit.
2022-04-21 13:02:54 +00:00
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
2020-08-28 03:58:48 +00:00
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_errors = { path = "../rustc_errors" }
rustc_fs_util = { path = "../rustc_fs_util" }
rustc_hir = { path = "../rustc_hir" }
rustc_index = { path = "../rustc_index" }
2020-07-26 17:11:30 +00:00
rustc_llvm = { path = "../rustc_llvm" }
rustc_macros = { path = "../rustc_macros" }
2021-05-29 20:49:59 +00:00
rustc_metadata = { path = "../rustc_metadata" }
2020-11-14 15:48:54 +00:00
rustc_query_system = { path = "../rustc_query_system" }
2020-08-28 03:58:48 +00:00
rustc_session = { path = "../rustc_session" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_target = { path = "../rustc_target" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
2020-08-28 03:58:48 +00:00
rustc_ast = { path = "../rustc_ast" }
rustc_span = { path = "../rustc_span" }