rustc_codegen_ssa/traits/
misc.rs

1use std::cell::RefCell;
2
3use rustc_data_structures::fx::FxHashMap;
4use rustc_middle::mir::mono::CodegenUnit;
5use rustc_middle::ty::{self, Instance, Ty};
6use rustc_session::Session;
7
8use super::BackendTypes;
9
10pub trait MiscCodegenMethods<'tcx>: BackendTypes {
11    fn vtables(
12        &self,
13    ) -> &RefCell<FxHashMap<(Ty<'tcx>, Option<ty::ExistentialTraitRef<'tcx>>), Self::Value>>;
14    fn apply_vcall_visibility_metadata(
15        &self,
16        _ty: Ty<'tcx>,
17        _poly_trait_ref: Option<ty::ExistentialTraitRef<'tcx>>,
18        _vtable: Self::Value,
19    ) {
20    }
21    fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function;
22    fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value;
23    fn eh_personality(&self) -> Self::Value;
24    fn sess(&self) -> &Session;
25    fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx>;
26    fn set_frame_pointer_type(&self, llfn: Self::Function);
27    fn apply_target_cpu_attr(&self, llfn: Self::Function);
28    /// Declares the extern "C" main function for the entry point. Returns None if the symbol
29    /// already exists.
30    fn declare_c_main(&self, fn_type: Self::Type) -> Option<Self::Function>;
31}