Skip to content

Commit 641e13e

Browse files
committed
Replace pointer_ty() with fx.pointer_type where possible
1 parent 472f9f9 commit 641e13e

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/abi/returning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub(super) fn codegen_return_param<'tcx>(
7373
}
7474
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
7575
let ret_param = block_params_iter.next().unwrap();
76-
assert_eq!(fx.bcx.func.dfg.value_type(ret_param), pointer_ty(fx.tcx));
76+
assert_eq!(fx.bcx.func.dfg.value_type(ret_param), fx.pointer_type);
7777
(
7878
CPlace::for_ptr(Pointer::new(ret_param), fx.fn_abi.as_ref().unwrap().ret.layout),
7979
smallvec![ret_param],

src/codegen_i128.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ pub(crate) fn maybe_codegen<'tcx>(
4040
fx.lib_call(
4141
"__multi3",
4242
vec![
43-
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
44-
AbiParam::new(pointer_ty(fx.tcx)),
45-
AbiParam::new(pointer_ty(fx.tcx)),
43+
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
44+
AbiParam::new(fx.pointer_type),
45+
AbiParam::new(fx.pointer_type),
4646
],
4747
vec![],
4848
&args,
@@ -63,16 +63,16 @@ pub(crate) fn maybe_codegen<'tcx>(
6363
assert!(rhs_extra.is_none());
6464
(
6565
vec![
66-
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
67-
AbiParam::new(pointer_ty(fx.tcx)),
68-
AbiParam::new(pointer_ty(fx.tcx)),
66+
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
67+
AbiParam::new(fx.pointer_type),
68+
AbiParam::new(fx.pointer_type),
6969
],
7070
[out_place.to_ptr().get_addr(fx), lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)],
7171
)
7272
} else {
7373
(
7474
vec![
75-
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
75+
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
7676
AbiParam::new(types::I128),
7777
AbiParam::new(types::I128),
7878
],
@@ -109,7 +109,7 @@ pub(crate) fn maybe_codegen<'tcx>(
109109
let args = [lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)];
110110
let ret = fx.lib_call(
111111
name,
112-
vec![AbiParam::new(pointer_ty(fx.tcx)), AbiParam::new(pointer_ty(fx.tcx))],
112+
vec![AbiParam::new(fx.pointer_type), AbiParam::new(fx.pointer_type)],
113113
vec![AbiParam::new(types::I64X2)],
114114
&args,
115115
)[0];

src/trap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
1010
Linkage::Import,
1111
&Signature {
1212
call_conv: CallConv::triple_default(fx.triple()),
13-
params: vec![AbiParam::new(pointer_ty(fx.tcx))],
13+
params: vec![AbiParam::new(fx.pointer_type)],
1414
returns: vec![AbiParam::new(types::I32)],
1515
},
1616
)

src/value_and_place.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ fn codegen_field<'tcx>(
3434
let (_, unsized_align) =
3535
crate::unsize::size_and_align_of_dst(fx, field_layout, extra);
3636

37-
let one = fx.bcx.ins().iconst(pointer_ty(fx.tcx), 1);
37+
let one = fx.bcx.ins().iconst(fx.pointer_type, 1);
3838
let align_sub_1 = fx.bcx.ins().isub(unsized_align, one);
3939
let and_lhs = fx.bcx.ins().iadd_imm(align_sub_1, unaligned_offset as i64);
40-
let zero = fx.bcx.ins().iconst(pointer_ty(fx.tcx), 0);
40+
let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
4141
let and_rhs = fx.bcx.ins().isub(zero, unsized_align);
4242
let offset = fx.bcx.ins().band(and_lhs, and_rhs);
4343

src/vtable.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn vtable_memflags() -> MemFlags {
1414
pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
1515
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
1616
fx.bcx.ins().load(
17-
pointer_ty(fx.tcx),
17+
fx.pointer_type,
1818
vtable_memflags(),
1919
vtable,
2020
(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) ->
2424
pub(crate) fn size_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
2525
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
2626
fx.bcx.ins().load(
27-
pointer_ty(fx.tcx),
27+
fx.pointer_type,
2828
vtable_memflags(),
2929
vtable,
3030
(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
3434
pub(crate) fn min_align_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
3535
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
3636
fx.bcx.ins().load(
37-
pointer_ty(fx.tcx),
37+
fx.pointer_type,
3838
vtable_memflags(),
3939
vtable,
4040
(ty::COMMON_VTABLE_ENTRIES_ALIGN * usize_size) as i32,
@@ -55,7 +55,7 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
5555

5656
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes();
5757
let func_ref = fx.bcx.ins().load(
58-
pointer_ty(fx.tcx),
58+
fx.pointer_type,
5959
vtable_memflags(),
6060
vtable,
6161
(idx * usize_size as usize) as i32,

0 commit comments

Comments
 (0)