Skip to content

Commit 303a795

Browse files
committed
compiler: Parse p- specs in datalayout string, allow definition of custom default data address space
1 parent 7cce6af commit 303a795

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
162162
}
163163

164164
fn const_usize(&self, i: u64) -> RValue<'gcc> {
165-
let bit_size = self.data_layout().pointer_size.bits();
165+
let bit_size = self.data_layout().pointer_size().bits();
166166
if bit_size < 64 {
167167
// make sure it doesn't overflow
168168
assert!(i < (1 << bit_size));

src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub(crate) fn const_alloc_to_gcc_uncached<'gcc>(
294294
let alloc = alloc.inner();
295295
let mut llvals = Vec::with_capacity(alloc.provenance().ptrs().len() + 1);
296296
let dl = cx.data_layout();
297-
let pointer_size = dl.pointer_size.bytes() as usize;
297+
let pointer_size = dl.pointer_size().bytes() as usize;
298298

299299
let mut next_offset = 0;
300300
for &(offset, prov) in alloc.provenance().ptrs().iter() {
@@ -331,7 +331,7 @@ pub(crate) fn const_alloc_to_gcc_uncached<'gcc>(
331331
),
332332
abi::Scalar::Initialized {
333333
value: Primitive::Pointer(address_space),
334-
valid_range: WrappingRange::full(dl.pointer_size),
334+
valid_range: WrappingRange::full(dl.pointer_size()),
335335
},
336336
cx.type_i8p_ext(address_space),
337337
));

src/intrinsic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
541541
// For rusty ABIs, small aggregates are actually passed
542542
// as `RegKind::Integer` (see `FnAbi::adjust_for_abi`),
543543
// so we re-use that same threshold here.
544-
layout.size() <= self.data_layout().pointer_size * 2
544+
layout.size() <= self.data_layout().pointer_size() * 2
545545
}
546546
};
547547

src/intrinsic/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
11841184
let lhs = args[0].immediate();
11851185
let rhs = args[1].immediate();
11861186
let is_add = name == sym::simd_saturating_add;
1187-
let ptr_bits = bx.tcx().data_layout.pointer_size.bits() as _;
1187+
let ptr_bits = bx.tcx().data_layout.pointer_size().bits() as _;
11881188
let (signed, elem_width, elem_ty) = match *in_elem.kind() {
11891189
ty::Int(i) => (true, i.bit_width().unwrap_or(ptr_bits) / 8, bx.cx.type_int_from_ty(i)),
11901190
ty::Uint(i) => {

0 commit comments

Comments
 (0)