diff options
| author | LeSeulArtichaut <leseulartichaut@gmail.com> | 2020-12-12 15:32:30 +0100 |
|---|---|---|
| committer | LeSeulArtichaut <leseulartichaut@gmail.com> | 2021-01-18 21:09:30 +0100 |
| commit | 50e1ae15e9f3035b06bae00e1b1dc7a358546d3e (patch) | |
| tree | e5cee77dc418dba544f105f5732636aa63f558f4 /compiler/rustc_codegen_llvm/src | |
| parent | 933bb18956f8e8a57e130ce0c9d342becc0ad0ae (diff) | |
| download | rust-50e1ae15e9f3035b06bae00e1b1dc7a358546d3e.tar.gz rust-50e1ae15e9f3035b06bae00e1b1dc7a358546d3e.zip | |
Use ty::{IntTy,UintTy,FloatTy} in rustc
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/builder.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 35 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/type_.rs | 37 |
3 files changed, 36 insertions, 39 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index f122fa14e70..d2f4d3edc22 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -304,9 +304,8 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { lhs: Self::Value, rhs: Self::Value, ) -> (Self::Value, Self::Value) { - use rustc_ast::IntTy::*; - use rustc_ast::UintTy::*; use rustc_middle::ty::{Int, Uint}; + use rustc_middle::ty::{IntTy::*, UintTy::*}; let new_kind = match ty.kind() { Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)), diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index b9ae7963250..3a4e1492af3 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -18,7 +18,6 @@ use crate::llvm::debuginfo::{ }; use crate::value::Value; -use rustc_ast as ast; use rustc_codegen_ssa::traits::*; use rustc_data_structures::const_cstr; use rustc_data_structures::fingerprint::Fingerprint; @@ -830,37 +829,37 @@ trait MsvcBasicName { fn msvc_basic_name(self) -> &'static str; } -impl MsvcBasicName for ast::IntTy { +impl MsvcBasicName for ty::IntTy { fn msvc_basic_name(self) -> &'static str { match self { - ast::IntTy::Isize => "ptrdiff_t", - ast::IntTy::I8 => "__int8", - ast::IntTy::I16 => "__int16", - ast::IntTy::I32 => "__int32", - ast::IntTy::I64 => "__int64", - ast::IntTy::I128 => "__int128", + ty::IntTy::Isize => "ptrdiff_t", + ty::IntTy::I8 => "__int8", + ty::IntTy::I16 => "__int16", + ty::IntTy::I32 => "__int32", + ty::IntTy::I64 => "__int64", + ty::IntTy::I128 => "__int128", } } } -impl MsvcBasicName for ast::UintTy { +impl MsvcBasicName for ty::UintTy { fn msvc_basic_name(self) -> &'static str { match self { - ast::UintTy::Usize => "size_t", - ast::UintTy::U8 => "unsigned __int8", - ast::UintTy::U16 => "unsigned __int16", - ast::UintTy::U32 => "unsigned __int32", - ast::UintTy::U64 => "unsigned __int64", - ast::UintTy::U128 => "unsigned __int128", + ty::UintTy::Usize => "size_t", + ty::UintTy::U8 => "unsigned __int8", + ty::UintTy::U16 => "unsigned __int16", + ty::UintTy::U32 => "unsigned __int32", + ty::UintTy::U64 => "unsigned __int64", + ty::UintTy::U128 => "unsigned __int128", } } } -impl MsvcBasicName for ast::FloatTy { +impl MsvcBasicName for ty::FloatTy { fn msvc_basic_name(self) -> &'static str { match self { - ast::FloatTy::F32 => "float", - ast::FloatTy::F64 => "double", + ty::FloatTy::F32 => "float", + ty::FloatTy::F64 => "double", } } } diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index a43724fd495..8fd0caae479 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -7,13 +7,12 @@ use crate::llvm; use crate::llvm::{Bool, False, True}; use crate::type_of::LayoutLlvmExt; use crate::value::Value; -use rustc_ast as ast; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::*; use rustc_data_structures::small_c_str::SmallCStr; use rustc_middle::bug; use rustc_middle::ty::layout::TyAndLayout; -use rustc_middle::ty::Ty; +use rustc_middle::ty::{self, Ty}; use rustc_target::abi::call::{CastTarget, FnAbi, Reg}; use rustc_target::abi::{AddressSpace, Align, Integer, Size}; @@ -80,32 +79,32 @@ impl CodegenCx<'ll, 'tcx> { self.type_i8() } - crate fn type_int_from_ty(&self, t: ast::IntTy) -> &'ll Type { + crate fn type_int_from_ty(&self, t: ty::IntTy) -> &'ll Type { match t { - ast::IntTy::Isize => self.type_isize(), - ast::IntTy::I8 => self.type_i8(), - ast::IntTy::I16 => self.type_i16(), - ast::IntTy::I32 => self.type_i32(), - ast::IntTy::I64 => self.type_i64(), - ast::IntTy::I128 => self.type_i128(), + ty::IntTy::Isize => self.type_isize(), + ty::IntTy::I8 => self.type_i8(), + ty::IntTy::I16 => self.type_i16(), + ty::IntTy::I32 => self.type_i32(), + ty::IntTy::I64 => self.type_i64(), + ty::IntTy::I128 => self.type_i128(), } } - crate fn type_uint_from_ty(&self, t: ast::UintTy) -> &'ll Type { + crate fn type_uint_from_ty(&self, t: ty::UintTy) -> &'ll Type { match t { - ast::UintTy::Usize => self.type_isize(), - ast::UintTy::U8 => self.type_i8(), - ast::UintTy::U16 => self.type_i16(), - ast::UintTy::U32 => self.type_i32(), - ast::UintTy::U64 => self.type_i64(), - ast::UintTy::U128 => self.type_i128(), + ty::UintTy::Usize => self.type_isize(), + ty::UintTy::U8 => self.type_i8(), + ty::UintTy::U16 => self.type_i16(), + ty::UintTy::U32 => self.type_i32(), + ty::UintTy::U64 => self.type_i64(), + ty::UintTy::U128 => self.type_i128(), } } - crate fn type_float_from_ty(&self, t: ast::FloatTy) -> &'ll Type { + crate fn type_float_from_ty(&self, t: ty::FloatTy) -> &'ll Type { match t { - ast::FloatTy::F32 => self.type_f32(), - ast::FloatTy::F64 => self.type_f64(), + ty::FloatTy::F32 => self.type_f32(), + ty::FloatTy::F64 => self.type_f64(), } } |
