Move vtable_size and vtable_align impls to cg_ssa
This commit is contained in:
parent
1afea1f86a
commit
399e020b96
2 changed files with 10 additions and 11 deletions
|
@ -10,7 +10,6 @@ use crate::value::Value;
|
||||||
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh};
|
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh};
|
||||||
use rustc_codegen_ssa::common::span_invalid_monomorphization_error;
|
use rustc_codegen_ssa::common::span_invalid_monomorphization_error;
|
||||||
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
|
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
|
||||||
use rustc_codegen_ssa::meth;
|
|
||||||
use rustc_codegen_ssa::mir::operand::OperandRef;
|
use rustc_codegen_ssa::mir::operand::OperandRef;
|
||||||
use rustc_codegen_ssa::mir::place::PlaceRef;
|
use rustc_codegen_ssa::mir::place::PlaceRef;
|
||||||
use rustc_codegen_ssa::traits::*;
|
use rustc_codegen_ssa::traits::*;
|
||||||
|
@ -364,16 +363,6 @@ impl<'ll, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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(self, vtable)
|
|
||||||
}
|
|
||||||
|
|
||||||
_ if name.as_str().starts_with("simd_") => {
|
_ if name.as_str().starts_with("simd_") => {
|
||||||
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {
|
match generic_simd_intrinsic(self, name, callee_ty, args, ret_ty, llret_ty, span) {
|
||||||
Ok(llval) => llval,
|
Ok(llval) => llval,
|
||||||
|
|
|
@ -3,6 +3,7 @@ use super::place::PlaceRef;
|
||||||
use super::FunctionCx;
|
use super::FunctionCx;
|
||||||
use crate::common::{span_invalid_monomorphization_error, IntPredicate};
|
use crate::common::{span_invalid_monomorphization_error, IntPredicate};
|
||||||
use crate::glue;
|
use crate::glue;
|
||||||
|
use crate::meth;
|
||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
use crate::MemFlags;
|
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())
|
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::pref_align_of
|
||||||
| sym::needs_drop
|
| sym::needs_drop
|
||||||
| sym::type_id
|
| sym::type_id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue