Skip to content

Commit 7d086c7

Browse files
always use gep inbounds i8 (ptradd) for field offsets
1 parent a06a87b commit 7d086c7

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/type_of.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ pub trait LayoutGccExt<'tcx> {
151151
fn immediate_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc>;
152152
fn scalar_gcc_type_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, scalar: &abi::Scalar, offset: Size) -> Type<'gcc>;
153153
fn scalar_pair_element_gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, index: usize) -> Type<'gcc>;
154-
fn gcc_field_index(&self, index: usize) -> u64;
155154
fn pointee_info_at<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>, offset: Size) -> Option<PointeeInfo>;
156155
}
157156

@@ -304,24 +303,6 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
304303
self.scalar_gcc_type_at(cx, scalar, offset)
305304
}
306305

307-
fn gcc_field_index(&self, index: usize) -> u64 {
308-
match self.abi {
309-
Abi::Scalar(_) | Abi::ScalarPair(..) => {
310-
bug!("TyAndLayout::gcc_field_index({:?}): not applicable", self)
311-
}
312-
_ => {}
313-
}
314-
match self.fields {
315-
FieldsShape::Primitive | FieldsShape::Union(_) => {
316-
bug!("TyAndLayout::gcc_field_index({:?}): not applicable", self)
317-
}
318-
319-
FieldsShape::Array { .. } => index as u64,
320-
321-
FieldsShape::Arbitrary { .. } => 1 + (self.fields.memory_index(index) as u64) * 2,
322-
}
323-
}
324-
325306
fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size) -> Option<PointeeInfo> {
326307
if let Some(&pointee) = cx.pointee_infos.borrow().get(&(self.ty, offset)) {
327308
return pointee;
@@ -351,10 +332,6 @@ impl<'gcc, 'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
351332
layout.is_gcc_scalar_pair()
352333
}
353334

354-
fn backend_field_index(&self, layout: TyAndLayout<'tcx>, index: usize) -> u64 {
355-
layout.gcc_field_index(index)
356-
}
357-
358335
fn scalar_pair_element_backend_type(&self, layout: TyAndLayout<'tcx>, index: usize, _immediate: bool) -> Type<'gcc> {
359336
layout.scalar_pair_element_gcc_type(self, index)
360337
}

0 commit comments

Comments
 (0)