]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/interfaces/misc.rs
Moved Backend interface into rustc_codegen_utils
[rust.git] / src / librustc_codegen_llvm / interfaces / misc.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use super::Backend;
12 use libc::c_uint;
13 use monomorphize::partitioning::CodegenUnit;
14 use rustc::mir::mono::Stats;
15 use rustc::session::Session;
16 use rustc::ty::{self, Instance, Ty};
17 use rustc::util::nodemap::FxHashMap;
18 use std::cell::RefCell;
19 use std::sync::Arc;
20
21 pub trait MiscMethods<'tcx>: Backend<'tcx> {
22     fn vtables(
23         &self,
24     ) -> &RefCell<FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), Self::Value>>;
25     fn check_overflow(&self) -> bool;
26     fn instances(&self) -> &RefCell<FxHashMap<Instance<'tcx>, Self::Value>>;
27     fn get_fn(&self, instance: Instance<'tcx>) -> Self::Value;
28     fn get_param(&self, llfn: Self::Value, index: c_uint) -> Self::Value;
29     fn eh_personality(&self) -> Self::Value;
30     fn eh_unwind_resume(&self) -> Self::Value;
31     fn sess(&self) -> &Session;
32     fn stats(&self) -> &RefCell<Stats>;
33     fn consume_stats(self) -> RefCell<Stats>;
34     fn codegen_unit(&self) -> &Arc<CodegenUnit<'tcx>>;
35     fn statics_to_rauw(&self) -> &RefCell<Vec<(Self::Value, Self::Value)>>;
36     fn used_statics(&self) -> &RefCell<Vec<Self::Value>>;
37     fn set_frame_pointer_elimination(&self, llfn: Self::Value);
38     fn apply_target_cpu_attr(&self, llfn: Self::Value);
39     fn create_used_variable(&self);
40 }