]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_llvm/interfaces/type_.rs
Added definition of type trait
[rust.git] / src / librustc_codegen_llvm / interfaces / type_.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::Backend;
12
13 pub trait TypeMethods : Backend {
14     fn void(&self) -> Self::Type;
15     fn metadata(&self) -> Self::Type;
16     fn i1(&self) -> Self::Type;
17     fn i8(&self) -> Self::Type;
18     fn i16(&self) -> Self::Type;
19     fn i32(&self) -> Self::Type;
20     fn i64(&self) -> Self::Type;
21     fn i128(&self) -> Self::Type;
22     fn ix(&self, num_bites: u64) -> Self::Type;
23     fn f32(&self) -> Self::Type;
24     fn f64(&self) -> Self::Type;
25     fn bool(&self) -> Self::Type;
26     fn char(&self) -> Self::Type;
27     fn i8p(&self) -> Self::Type;
28
29     fn func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type;
30     fn variadic_func(&self, args: &[Self::Type]) -> Self::Type;
31     fn struct_(&self, els: &[Self::Type], packed: bool) -> Self::Type;
32     fn named_struct(&self, name: &str) -> Self::Type;
33     fn array(&self, ty: Self::Type, len: u64) -> Self::Type;
34     fn vector(&self, ty: Self::Type, len: u64) -> Self::Type;
35     fn kind(&self, ty: Self::Type) -> Self::TypeKind;
36     fn set_struct_body(&self, els: &[Self::Type], packed: bool);
37     fn ptr_to(&self, ty: Self::Type) -> Self::Type;
38     fn element_type(&self, ty: Self::Type) -> Self::Type;
39     fn vector_length(&self, ty: Self::Type) -> usize;
40     fn func_params(&self, ty: Self::Type) -> Vec<Self::Type>;
41     fn float_width(&self, ty: Self::Type) -> usize;
42     fn int_width(&self, ty: Self::Type) -> usize;
43 }