]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/interfaces/mod.rs
Beginning of moving all backend-agnostic code to rustc_codegen_ssa
[rust.git] / src / librustc_codegen_llvm / interfaces / mod.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 mod abi;
12 mod asm;
13 mod builder;
14 mod consts;
15 mod debuginfo;
16 mod declare;
17 mod intrinsic;
18 mod misc;
19 mod statics;
20 mod type_;
21
22 pub use self::abi::{AbiBuilderMethods, AbiMethods};
23 pub use self::asm::{AsmBuilderMethods, AsmMethods};
24 pub use self::builder::BuilderMethods;
25 pub use self::consts::ConstMethods;
26 pub use self::debuginfo::{DebugInfoBuilderMethods, DebugInfoMethods};
27 pub use self::declare::{DeclareMethods, PreDefineMethods};
28 pub use self::intrinsic::{IntrinsicCallMethods, IntrinsicDeclarationMethods};
29 pub use self::misc::MiscMethods;
30 pub use self::statics::StaticMethods;
31 pub use self::type_::{
32     ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods,
33 };
34 pub use rustc_codegen_ssa::interfaces::{Backend, BackendMethods, BackendTypes, CodegenObject};
35
36 pub trait CodegenMethods<'tcx>:
37     Backend<'tcx>
38     + TypeMethods<'tcx>
39     + MiscMethods<'tcx>
40     + ConstMethods<'tcx>
41     + StaticMethods<'tcx>
42     + DebugInfoMethods<'tcx>
43     + AbiMethods<'tcx>
44     + IntrinsicDeclarationMethods<'tcx>
45     + DeclareMethods<'tcx>
46     + AsmMethods<'tcx>
47     + PreDefineMethods<'tcx>
48 {
49 }
50
51 impl<'tcx, T> CodegenMethods<'tcx> for T where
52     Self: Backend<'tcx>
53         + TypeMethods<'tcx>
54         + MiscMethods<'tcx>
55         + ConstMethods<'tcx>
56         + StaticMethods<'tcx>
57         + DebugInfoMethods<'tcx>
58         + AbiMethods<'tcx>
59         + IntrinsicDeclarationMethods<'tcx>
60         + DeclareMethods<'tcx>
61         + AsmMethods<'tcx>
62         + PreDefineMethods<'tcx>
63 {}
64
65 pub trait HasCodegen<'tcx>: Backend<'tcx> {
66     type CodegenCx: CodegenMethods<'tcx>
67         + BackendTypes<
68             Value = Self::Value,
69             BasicBlock = Self::BasicBlock,
70             Type = Self::Type,
71             Context = Self::Context,
72             Funclet = Self::Funclet,
73             DIScope = Self::DIScope,
74         >;
75 }