]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_ssa/src/traits/misc.rs
Auto merge of #93270 - klensy:sec-up, r=Mark-Simulacrum
[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 used_statics(&self) -> &RefCell<Vec<Self::Value>>;
19     fn compiler_used_statics(&self) -> &RefCell<Vec<Self::Value>>;
20     fn set_frame_pointer_type(&self, llfn: Self::Function);
21     fn apply_target_cpu_attr(&self, llfn: Self::Function);
22     fn create_used_variable(&self);
23     fn create_compiler_used_variable(&self);
24     /// Declares the extern "C" main function for the entry point. Returns None if the symbol already exists.
25     fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
26 }