rustc_codegen_ssa/traits/
misc.rs

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