diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-07-20 13:40:30 +0000 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-07-20 17:12:08 -0400 |
| commit | 399e020b96b0194e734c698d3ef4eee5c5fa59ea (patch) | |
| tree | 468da240c771aba05a882e38c9415c898000d763 /compiler/rustc_codegen_ssa/src | |
| parent | 1afea1f86a098a61e3044520bbd6725b547397ae (diff) | |
| download | rust-399e020b96b0194e734c698d3ef4eee5c5fa59ea.tar.gz rust-399e020b96b0194e734c698d3ef4eee5c5fa59ea.zip | |
Move vtable_size and vtable_align impls to cg_ssa
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs index 645afae30d8..1fffa3beaaa 100644 --- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs @@ -3,6 +3,7 @@ use super::place::PlaceRef; use super::FunctionCx; use crate::common::{span_invalid_monomorphization_error, IntPredicate}; use crate::glue; +use crate::meth; use crate::traits::*; use crate::MemFlags; @@ -102,6 +103,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.const_usize(bx.layout_of(tp_ty).align.abi.bytes()) } } + sym::vtable_size | sym::vtable_align => { + let vtable = args[0].immediate(); + let idx = match name { + sym::vtable_size => ty::COMMON_VTABLE_ENTRIES_SIZE, + sym::vtable_align => ty::COMMON_VTABLE_ENTRIES_ALIGN, + _ => bug!(), + }; + meth::VirtualIndex::from_index(idx).get_usize(bx, vtable) + } sym::pref_align_of | sym::needs_drop | sym::type_id |
