]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_ssa/src/traits/misc.rs
Auto merge of #104330 - CastilloDel:ast_lowering, r=cjgillot
[rust.git] / compiler / rustc_codegen_ssa / src / traits / misc.rs
1 use super::BackendTypes;
2 use rustc_data_structures::fx::FxHashMap;
3 use rustc_middle::mir::mono::CodegenUnit;
4 use rustc_middle::ty::{self, Instance, Ty};
5 use rustc_session::Session;
6 use std::cell::RefCell;
7
8 pub trait MiscMethods<'tcx>: BackendTypes {
9     fn vtables(
10         &self,
11     ) -> &RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>), Self::Value>>;
12     fn check_overflow(&self) -> bool;
13     fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function;
14     fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value;
15     fn eh_personality(&self) -> Self::Value;
16     fn sess(&self) -> &Session;
17     fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx>;
18     fn set_frame_pointer_type(&self, llfn: Self::Function);
19     fn apply_target_cpu_attr(&self, llfn: Self::Function);
20     /// Declares the extern "C" main function for the entry point. Returns None if the symbol already exists.
21     fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
22 }