about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-07-26 19:21:45 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2021-07-26 19:21:45 +0200
commit641e13e0213ea09a2c9003369aaac1e842910c2a (patch)
treeb11a8343198264f6266fbc63acbd537b5ba776fd
parent472f9f9d6294632bc2fe23e6a8726d526d296bbf (diff)
downloadrust-641e13e0213ea09a2c9003369aaac1e842910c2a.tar.gz
rust-641e13e0213ea09a2c9003369aaac1e842910c2a.zip
Replace pointer_ty() with fx.pointer_type where possible
-rw-r--r--src/abi/returning.rs2
-rw-r--r--src/codegen_i128.rs16
-rw-r--r--src/trap.rs2
-rw-r--r--src/value_and_place.rs4
-rw-r--r--src/vtable.rs8
5 files changed, 16 insertions, 16 deletions
diff --git a/src/abi/returning.rs b/src/abi/returning.rs
index e5e06d1bd63..cb2beed2ca7 100644
--- a/src/abi/returning.rs
+++ b/src/abi/returning.rs
@@ -73,7 +73,7 @@ pub(super) fn codegen_return_param<'tcx>(
         }
         PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
             let ret_param = block_params_iter.next().unwrap();
-            assert_eq!(fx.bcx.func.dfg.value_type(ret_param), pointer_ty(fx.tcx));
+            assert_eq!(fx.bcx.func.dfg.value_type(ret_param), fx.pointer_type);
             (
                 CPlace::for_ptr(Pointer::new(ret_param), fx.fn_abi.as_ref().unwrap().ret.layout),
                 smallvec![ret_param],
diff --git a/src/codegen_i128.rs b/src/codegen_i128.rs
index 22d7f1da0b5..4e50f4d6817 100644
--- a/src/codegen_i128.rs
+++ b/src/codegen_i128.rs
@@ -40,9 +40,9 @@ pub(crate) fn maybe_codegen<'tcx>(
                 fx.lib_call(
                     "__multi3",
                     vec![
-                        AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
-                        AbiParam::new(pointer_ty(fx.tcx)),
-                        AbiParam::new(pointer_ty(fx.tcx)),
+                        AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
+                        AbiParam::new(fx.pointer_type),
+                        AbiParam::new(fx.pointer_type),
                     ],
                     vec![],
                     &args,
@@ -63,16 +63,16 @@ pub(crate) fn maybe_codegen<'tcx>(
                 assert!(rhs_extra.is_none());
                 (
                     vec![
-                        AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
-                        AbiParam::new(pointer_ty(fx.tcx)),
-                        AbiParam::new(pointer_ty(fx.tcx)),
+                        AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
+                        AbiParam::new(fx.pointer_type),
+                        AbiParam::new(fx.pointer_type),
                     ],
                     [out_place.to_ptr().get_addr(fx), lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)],
                 )
             } else {
                 (
                     vec![
-                        AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
+                        AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
                         AbiParam::new(types::I128),
                         AbiParam::new(types::I128),
                     ],
@@ -109,7 +109,7 @@ pub(crate) fn maybe_codegen<'tcx>(
                 let args = [lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)];
                 let ret = fx.lib_call(
                     name,
-                    vec![AbiParam::new(pointer_ty(fx.tcx)), AbiParam::new(pointer_ty(fx.tcx))],
+                    vec![AbiParam::new(fx.pointer_type), AbiParam::new(fx.pointer_type)],
                     vec![AbiParam::new(types::I64X2)],
                     &args,
                 )[0];
diff --git a/src/trap.rs b/src/trap.rs
index 21d3e68dbc7..fe8d20fa39f 100644
--- a/src/trap.rs
+++ b/src/trap.rs
@@ -10,7 +10,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
             Linkage::Import,
             &Signature {
                 call_conv: CallConv::triple_default(fx.triple()),
-                params: vec![AbiParam::new(pointer_ty(fx.tcx))],
+                params: vec![AbiParam::new(fx.pointer_type)],
                 returns: vec![AbiParam::new(types::I32)],
             },
         )
diff --git a/src/value_and_place.rs b/src/value_and_place.rs
index b1e00360d56..d1b66ab02e1 100644
--- a/src/value_and_place.rs
+++ b/src/value_and_place.rs
@@ -34,10 +34,10 @@ fn codegen_field<'tcx>(
                 let (_, unsized_align) =
                     crate::unsize::size_and_align_of_dst(fx, field_layout, extra);
 
-                let one = fx.bcx.ins().iconst(pointer_ty(fx.tcx), 1);
+                let one = fx.bcx.ins().iconst(fx.pointer_type, 1);
                 let align_sub_1 = fx.bcx.ins().isub(unsized_align, one);
                 let and_lhs = fx.bcx.ins().iadd_imm(align_sub_1, unaligned_offset as i64);
-                let zero = fx.bcx.ins().iconst(pointer_ty(fx.tcx), 0);
+                let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
                 let and_rhs = fx.bcx.ins().isub(zero, unsized_align);
                 let offset = fx.bcx.ins().band(and_lhs, and_rhs);
 
diff --git a/src/vtable.rs b/src/vtable.rs
index 4a5f9f133a2..0004c9787be 100644
--- a/src/vtable.rs
+++ b/src/vtable.rs
@@ -14,7 +14,7 @@ fn vtable_memflags() -> MemFlags {
 pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
-        pointer_ty(fx.tcx),
+        fx.pointer_type,
         vtable_memflags(),
         vtable,
         (ty::COMMON_VTABLE_ENTRIES_DROPINPLACE * usize_size) as i32,
@@ -24,7 +24,7 @@ pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) ->
 pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
-        pointer_ty(fx.tcx),
+        fx.pointer_type,
         vtable_memflags(),
         vtable,
         (ty::COMMON_VTABLE_ENTRIES_SIZE * usize_size) as i32,
@@ -34,7 +34,7 @@ pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Val
 pub(crate) fn min_align_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
     fx.bcx.ins().load(
-        pointer_ty(fx.tcx),
+        fx.pointer_type,
         vtable_memflags(),
         vtable,
         (ty::COMMON_VTABLE_ENTRIES_ALIGN * usize_size) as i32,
@@ -55,7 +55,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
 
     let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes();
     let func_ref = fx.bcx.ins().load(
-        pointer_ty(fx.tcx),
+        fx.pointer_type,
         vtable_memflags(),
         vtable,
         (idx * usize_size as usize) as i32,