From 66dce1114d1014258c8cc586e176f2ea53ab4ed1 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sun, 24 Nov 2019 16:25:20 -0500 Subject: Store ptr_width as u32 on Config This removes the dependency on IntTy, UintTy from Session. --- src/librustc_codegen_llvm/builder.rs | 4 ++-- src/librustc_codegen_llvm/intrinsic.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/librustc_codegen_llvm') diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 312c41b88b0..6f72466c559 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -325,8 +325,8 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { use rustc::ty::{Int, Uint}; let new_kind = match ty.kind { - Int(Isize) => Int(self.tcx.sess.target.isize_ty), - Uint(Usize) => Uint(self.tcx.sess.target.usize_ty), + Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.ptr_width)), + Uint(t @ Usize) => Uint(t.normalize(self.tcx.sess.target.ptr_width)), ref t @ Uint(_) | ref t @ Int(_) => t.clone(), _ => panic!("tried to get overflow intrinsic for op applied to non-int type") }; diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 12ec4e10748..aa55f3a19e2 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1926,7 +1926,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, bool)> { match ty.kind { ty::Int(t) => Some((match t { - ast::IntTy::Isize => cx.tcx.sess.target.isize_ty.bit_width().unwrap() as u64, + ast::IntTy::Isize => cx.tcx.sess.target.ptr_width as u64, ast::IntTy::I8 => 8, ast::IntTy::I16 => 16, ast::IntTy::I32 => 32, @@ -1934,7 +1934,7 @@ fn int_type_width_signed(ty: Ty<'_>, cx: &CodegenCx<'_, '_>) -> Option<(u64, boo ast::IntTy::I128 => 128, }, true)), ty::Uint(t) => Some((match t { - ast::UintTy::Usize => cx.tcx.sess.target.usize_ty.bit_width().unwrap() as u64, + ast::UintTy::Usize => cx.tcx.sess.target.ptr_width as u64, ast::UintTy::U8 => 8, ast::UintTy::U16 => 16, ast::UintTy::U32 => 32, -- cgit 1.4.1-3-g733a5