Replace pointer_ty() with fx.pointer_type where possible
This commit is contained in:
@@ -73,7 +73,7 @@ pub(super) fn codegen_return_param<'tcx>(
|
|||||||
}
|
}
|
||||||
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
|
PassMode::Indirect { attrs: _, extra_attrs: None, on_stack: _ } => {
|
||||||
let ret_param = block_params_iter.next().unwrap();
|
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),
|
CPlace::for_ptr(Pointer::new(ret_param), fx.fn_abi.as_ref().unwrap().ret.layout),
|
||||||
smallvec![ret_param],
|
smallvec![ret_param],
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ pub(crate) fn maybe_codegen<'tcx>(
|
|||||||
fx.lib_call(
|
fx.lib_call(
|
||||||
"__multi3",
|
"__multi3",
|
||||||
vec![
|
vec![
|
||||||
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
|
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
|
||||||
AbiParam::new(pointer_ty(fx.tcx)),
|
AbiParam::new(fx.pointer_type),
|
||||||
AbiParam::new(pointer_ty(fx.tcx)),
|
AbiParam::new(fx.pointer_type),
|
||||||
],
|
],
|
||||||
vec![],
|
vec![],
|
||||||
&args,
|
&args,
|
||||||
@@ -63,16 +63,16 @@ pub(crate) fn maybe_codegen<'tcx>(
|
|||||||
assert!(rhs_extra.is_none());
|
assert!(rhs_extra.is_none());
|
||||||
(
|
(
|
||||||
vec![
|
vec![
|
||||||
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
|
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
|
||||||
AbiParam::new(pointer_ty(fx.tcx)),
|
AbiParam::new(fx.pointer_type),
|
||||||
AbiParam::new(pointer_ty(fx.tcx)),
|
AbiParam::new(fx.pointer_type),
|
||||||
],
|
],
|
||||||
[out_place.to_ptr().get_addr(fx), lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)],
|
[out_place.to_ptr().get_addr(fx), lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)],
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(
|
(
|
||||||
vec![
|
vec![
|
||||||
AbiParam::special(pointer_ty(fx.tcx), ArgumentPurpose::StructReturn),
|
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
|
||||||
AbiParam::new(types::I128),
|
AbiParam::new(types::I128),
|
||||||
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 args = [lhs_ptr.get_addr(fx), rhs_ptr.get_addr(fx)];
|
||||||
let ret = fx.lib_call(
|
let ret = fx.lib_call(
|
||||||
name,
|
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)],
|
vec![AbiParam::new(types::I64X2)],
|
||||||
&args,
|
&args,
|
||||||
)[0];
|
)[0];
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
|
|||||||
Linkage::Import,
|
Linkage::Import,
|
||||||
&Signature {
|
&Signature {
|
||||||
call_conv: CallConv::triple_default(fx.triple()),
|
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)],
|
returns: vec![AbiParam::new(types::I32)],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ fn codegen_field<'tcx>(
|
|||||||
let (_, unsized_align) =
|
let (_, unsized_align) =
|
||||||
crate::unsize::size_and_align_of_dst(fx, field_layout, extra);
|
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 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 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 and_rhs = fx.bcx.ins().isub(zero, unsized_align);
|
||||||
let offset = fx.bcx.ins().band(and_lhs, and_rhs);
|
let offset = fx.bcx.ins().band(and_lhs, and_rhs);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ fn vtable_memflags() -> MemFlags {
|
|||||||
pub(crate) fn drop_fn_of_obj(fx: &mut FunctionCx<'_, '_, '_>, vtable: Value) -> Value {
|
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;
|
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
|
||||||
fx.bcx.ins().load(
|
fx.bcx.ins().load(
|
||||||
pointer_ty(fx.tcx),
|
fx.pointer_type,
|
||||||
vtable_memflags(),
|
vtable_memflags(),
|
||||||
vtable,
|
vtable,
|
||||||
(ty::COMMON_VTABLE_ENTRIES_DROPINPLACE * usize_size) as i32,
|
(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 {
|
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;
|
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
|
||||||
fx.bcx.ins().load(
|
fx.bcx.ins().load(
|
||||||
pointer_ty(fx.tcx),
|
fx.pointer_type,
|
||||||
vtable_memflags(),
|
vtable_memflags(),
|
||||||
vtable,
|
vtable,
|
||||||
(ty::COMMON_VTABLE_ENTRIES_SIZE * usize_size) as i32,
|
(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 {
|
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;
|
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes() as usize;
|
||||||
fx.bcx.ins().load(
|
fx.bcx.ins().load(
|
||||||
pointer_ty(fx.tcx),
|
fx.pointer_type,
|
||||||
vtable_memflags(),
|
vtable_memflags(),
|
||||||
vtable,
|
vtable,
|
||||||
(ty::COMMON_VTABLE_ENTRIES_ALIGN * usize_size) as i32,
|
(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 usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes();
|
||||||
let func_ref = fx.bcx.ins().load(
|
let func_ref = fx.bcx.ins().load(
|
||||||
pointer_ty(fx.tcx),
|
fx.pointer_type,
|
||||||
vtable_memflags(),
|
vtable_memflags(),
|
||||||
vtable,
|
vtable,
|
||||||
(idx * usize_size as usize) as i32,
|
(idx * usize_size as usize) as i32,
|
||||||
|
|||||||
Reference in New Issue
Block a user