diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2022-07-20 13:36:58 +0000 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-07-20 17:12:07 -0400 |
| commit | 1afea1f86a098a61e3044520bbd6725b547397ae (patch) | |
| tree | e8734d0ffaba75a9454db8b1c57f93624b7664cc | |
| parent | b4c377e75054c69055f2572f465f9cad2b323204 (diff) | |
| download | rust-1afea1f86a098a61e3044520bbd6725b547397ae.tar.gz rust-1afea1f86a098a61e3044520bbd6725b547397ae.zip | |
Implement vtable_size and vtable_align intrinsics for cg_clif
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index 4b2207f3758..d5a79e254a8 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -431,6 +431,16 @@ fn codegen_regular_intrinsic_call<'tcx>( ret.write_cvalue(fx, CValue::by_val(align, usize_layout)); }; + vtable_size, (v vtable) { + let size = crate::vtable::size_of_obj(fx, vtable); + ret.write_cvalue(fx, CValue::by_val(size, usize_layout)); + }; + + vtable_align, (v vtable) { + let align = crate::vtable::min_align_of_obj(fx, vtable); + ret.write_cvalue(fx, CValue::by_val(align, usize_layout)); + }; + unchecked_add | unchecked_sub | unchecked_mul | unchecked_div | exact_div | unchecked_rem | unchecked_shl | unchecked_shr, (c x, c y) { // FIXME trap on overflow |
