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