compiler: Parse p- specs in datalayout string, allow definition of custom default data address space
This commit is contained in:
committed by
Edoardo Marangoni
parent
733b47ea4b
commit
93f1201c06
@@ -786,7 +786,7 @@ pub(crate) fn codegen_drop<'tcx>(
|
||||
|
||||
pub(crate) fn lib_call_arg_param(tcx: TyCtxt<'_>, ty: Type, is_signed: bool) -> AbiParam {
|
||||
let param = AbiParam::new(ty);
|
||||
if ty.is_int() && u64::from(ty.bits()) < tcx.data_layout.pointer_size.bits() {
|
||||
if ty.is_int() && u64::from(ty.bits()) < tcx.data_layout.pointer_size().bits() {
|
||||
match (&*tcx.sess.target.arch, &*tcx.sess.target.vendor) {
|
||||
("x86_64", _) | ("aarch64", "apple") => match (ty, is_signed) {
|
||||
(types::I8 | types::I16, true) => param.sext(),
|
||||
|
||||
@@ -127,7 +127,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
|
||||
PassMode::Indirect { attrs, meta_attrs: None, on_stack } => {
|
||||
if on_stack {
|
||||
// Abi requires aligning struct size to pointer size
|
||||
let size = self.layout.size.align_to(tcx.data_layout.pointer_align.abi);
|
||||
let size = self.layout.size.align_to(tcx.data_layout.pointer_align().abi);
|
||||
let size = u32::try_from(size.bytes()).unwrap();
|
||||
smallvec![apply_attrs_to_abi_param(
|
||||
AbiParam::special(pointer_ty(tcx), ArgumentPurpose::StructArgument(size),),
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::debuginfo::FunctionDebugContext;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub(crate) fn pointer_ty(tcx: TyCtxt<'_>) -> types::Type {
|
||||
match tcx.data_layout.pointer_size.bits() {
|
||||
match tcx.data_layout.pointer_size().bits() {
|
||||
16 => types::I16,
|
||||
32 => types::I32,
|
||||
64 => types::I64,
|
||||
|
||||
@@ -443,7 +443,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
||||
let addend = {
|
||||
let endianness = tcx.data_layout.endian;
|
||||
let offset = offset.bytes() as usize;
|
||||
let ptr_size = tcx.data_layout.pointer_size;
|
||||
let ptr_size = tcx.data_layout.pointer_size();
|
||||
let bytes = &alloc.inspect_with_uninit_and_ptr_outside_interpreter(
|
||||
offset..offset + ptr_size.bytes() as usize,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user