abi: s/ScalableVector/SimdScalableVector

Renaming to remove any ambiguity as to what "vector" refers to in this
context
This commit is contained in:
David Wood
2026-03-02 16:58:49 +00:00
parent f760fdd8dc
commit db5e2dc248
24 changed files with 42 additions and 42 deletions
+1 -1
View File
@@ -83,7 +83,7 @@ pub fn homogeneous_aggregate<C>(&self, cx: &C) -> Result<HomogeneousAggregate, H
}))
}
BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdScalableVector { .. } => {
unreachable!("`homogeneous_aggregate` should not be called for scalable vectors")
}
+3 -3
View File
@@ -484,7 +484,7 @@ pub fn layout_of_union<
BackendRepr::Scalar(..)
| BackendRepr::ScalarPair(..)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => repr,
},
};
@@ -557,7 +557,7 @@ fn layout_of_struct<
hide_niches(b);
}
BackendRepr::SimdVector { element, .. }
| BackendRepr::ScalableVector { element, .. } => hide_niches(element),
| BackendRepr::SimdScalableVector { element, .. } => hide_niches(element),
BackendRepr::Memory { sized: _ } => {}
}
st.largest_niche = None;
@@ -1560,7 +1560,7 @@ fn vector_type_layout<FieldIdx, VariantIdx, F>(
elt.size.checked_mul(count, dl).ok_or_else(|| LayoutCalculatorError::SizeOverflow)?;
let (repr, align) = match kind {
VectorKind::Scalable => {
(BackendRepr::ScalableVector { element, count }, dl.llvmlike_vector_align(size))
(BackendRepr::SimdScalableVector { element, count }, dl.llvmlike_vector_align(size))
}
// Non-power-of-two vectors have padding up to the next power-of-two.
// If we're a packed repr, remove the padding while keeping the alignment as close
+10 -10
View File
@@ -1731,7 +1731,7 @@ impl AddressSpace {
pub enum BackendRepr {
Scalar(Scalar),
ScalarPair(Scalar, Scalar),
ScalableVector {
SimdScalableVector {
element: Scalar,
count: u64,
},
@@ -1758,7 +1758,7 @@ pub fn is_unsized(&self) -> bool {
// fully implemented, scalable vectors will remain `Sized`, they just won't be
// `const Sized` - whether `is_unsized` continues to return `false` at that point will
// need to be revisited and will depend on what `is_unsized` is used for.
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::SimdVector { .. } => false,
BackendRepr::Memory { sized } => !sized,
}
@@ -1801,7 +1801,7 @@ pub fn scalar_align<C: HasDataLayout>(&self, cx: &C) -> Option<Align> {
// The align of a Vector can vary in surprising ways
BackendRepr::SimdVector { .. }
| BackendRepr::Memory { .. }
| BackendRepr::ScalableVector { .. } => None,
| BackendRepr::SimdScalableVector { .. } => None,
}
}
@@ -1825,7 +1825,7 @@ pub fn scalar_size<C: HasDataLayout>(&self, cx: &C) -> Option<Size> {
// The size of a Vector can vary in surprising ways
BackendRepr::SimdVector { .. }
| BackendRepr::Memory { .. }
| BackendRepr::ScalableVector { .. } => None,
| BackendRepr::SimdScalableVector { .. } => None,
}
}
@@ -1840,8 +1840,8 @@ pub fn to_union(&self) -> Self {
BackendRepr::SimdVector { element: element.to_union(), count }
}
BackendRepr::Memory { .. } => BackendRepr::Memory { sized: true },
BackendRepr::ScalableVector { element, count } => {
BackendRepr::ScalableVector { element: element.to_union(), count }
BackendRepr::SimdScalableVector { element, count } => {
BackendRepr::SimdScalableVector { element: element.to_union(), count }
}
}
}
@@ -2085,7 +2085,7 @@ pub fn is_aggregate(&self) -> bool {
match self.backend_repr {
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. } => false,
| BackendRepr::SimdScalableVector { .. } => false,
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => true,
}
}
@@ -2182,13 +2182,13 @@ pub fn is_1zst(&self) -> bool {
/// Returns `true` if the size of the type is only known at runtime.
pub fn is_runtime_sized(&self) -> bool {
matches!(self.backend_repr, BackendRepr::ScalableVector { .. })
matches!(self.backend_repr, BackendRepr::SimdScalableVector { .. })
}
/// Returns the elements count of a scalable vector.
pub fn scalable_vector_element_count(&self) -> Option<u64> {
match self.backend_repr {
BackendRepr::ScalableVector { count, .. } => Some(count),
BackendRepr::SimdScalableVector { count, .. } => Some(count),
_ => None,
}
}
@@ -2201,7 +2201,7 @@ pub fn is_zst(&self) -> bool {
match self.backend_repr {
BackendRepr::Scalar(_)
| BackendRepr::ScalarPair(..)
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::SimdVector { .. } => false,
BackendRepr::Memory { sized } => sized && self.size.bytes() == 0,
}
@@ -505,7 +505,7 @@ fn codegen_intrinsic_call(
let layout = self.layout_of(tp_ty).layout;
let _use_integer_compare = match layout.backend_repr() {
Scalar(_) | ScalarPair(_, _) => true,
SimdVector { .. } | ScalableVector { .. } => false,
SimdVector { .. } | SimdScalableVector { .. } => false,
Memory { .. } => {
// For rusty ABIs, small aggregates are actually passed
// as `RegKind::Integer` (see `FnAbi::adjust_for_abi`),
+3 -3
View File
@@ -85,7 +85,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
);
}
BackendRepr::Memory { .. } => {}
BackendRepr::ScalableVector { .. } => todo!(),
BackendRepr::SimdScalableVector { .. } => todo!(),
}
let name = match *layout.ty.kind() {
@@ -181,7 +181,7 @@ fn is_gcc_immediate(&self) -> bool {
match self.backend_repr {
BackendRepr::Scalar(_) | BackendRepr::SimdVector { .. } => true,
// FIXME(rustc_scalable_vector): Not yet implemented in rustc_codegen_gcc.
BackendRepr::ScalableVector { .. } => todo!(),
BackendRepr::SimdScalableVector { .. } => todo!(),
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => false,
}
}
@@ -191,7 +191,7 @@ fn is_gcc_scalar_pair(&self) -> bool {
BackendRepr::ScalarPair(..) => true,
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => false,
}
}
+1 -1
View File
@@ -493,7 +493,7 @@ fn codegen_intrinsic_call(
let use_integer_compare = match layout.backend_repr() {
Scalar(_) | ScalarPair(_, _) => true,
SimdVector { .. } => false,
ScalableVector { .. } => {
SimdScalableVector { .. } => {
tcx.dcx().emit_err(InvalidMonomorphization::NonScalableType {
span,
name: sym::raw_eq,
+3 -3
View File
@@ -24,7 +24,7 @@ fn uncached_llvm_type<'a, 'tcx>(
let element = layout.scalar_llvm_type_at(cx, element);
return cx.type_vector(element, count);
}
BackendRepr::ScalableVector { ref element, count } => {
BackendRepr::SimdScalableVector { ref element, count } => {
let element = if element.is_bool() {
cx.type_i1()
} else {
@@ -187,7 +187,7 @@ fn is_llvm_immediate(&self) -> bool {
match self.backend_repr {
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. } => true,
| BackendRepr::SimdScalableVector { .. } => true,
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => false,
}
}
@@ -197,7 +197,7 @@ fn is_llvm_scalar_pair(&self) -> bool {
BackendRepr::ScalarPair(..) => true,
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => false,
}
}
+2 -2
View File
@@ -551,7 +551,7 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
registers_for_primitive(scalar1.primitive());
registers_for_primitive(scalar2.primitive());
}
BackendRepr::SimdVector { .. } | BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => {
// Because no instance of VaArgSafe uses a non-scalar `BackendRepr`.
unreachable!(
"No x86-64 SysV va_arg implementation for {:?}",
@@ -692,7 +692,7 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
}
// The Previous match on `BackendRepr` means control flow already escaped.
BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => unreachable!(),
};
@@ -404,7 +404,7 @@ pub(crate) fn extract_field<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
}
BackendRepr::ScalarPair(_, _)
| BackendRepr::Memory { .. }
| BackendRepr::ScalableVector { .. } => bug!(),
| BackendRepr::SimdScalableVector { .. } => bug!(),
})
};
@@ -691,7 +691,7 @@ pub(super) fn new(layout: TyAndLayout<'tcx>) -> Self {
BackendRepr::ScalarPair(a, b) => {
OperandValueBuilder::Pair(Either::Right(a), Either::Right(b))
}
BackendRepr::SimdVector { .. } | BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => {
OperandValueBuilder::Vector(Either::Right(()))
}
BackendRepr::Memory { .. } => {
@@ -904,7 +904,7 @@ pub(super) fn copy_op_no_validate(
}
// Everything else can only exist in memory anyway, so it doesn't matter.
BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => true,
};
@@ -1331,7 +1331,7 @@ fn visit_value(&mut self, val: &PlaceTy<'tcx, M::Provenance>) -> InterpResult<'t
self.visit_scalar(b, b_layout)?;
}
}
BackendRepr::SimdVector { .. } | BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => {
// No checks here, we assume layout computation gets this right.
// (This is harder to check since Miri does not represent these as `Immediate`. We
// also cannot use field projections since this might be a newtype around a vector.)
@@ -119,7 +119,7 @@ fn check_validity_requirement_lax<'tcx>(
}
BackendRepr::SimdVector { element: s, count } => count == 0 || scalar_allows_raw_init(s),
BackendRepr::Memory { .. } => true, // Fields are checked below.
BackendRepr::ScalableVector { element, .. } => scalar_allows_raw_init(element),
BackendRepr::SimdScalableVector { element, .. } => scalar_allows_raw_init(element),
};
if !valid {
+1 -1
View File
@@ -1699,7 +1699,7 @@ fn transmute_may_have_niche_of_interest_to_backend(
!a.is_always_valid(&self.ecx) || !b.is_always_valid(&self.ecx)
}
BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => false,
}
}
@@ -36,7 +36,7 @@ fn passes_vectors_by_value(mode: &PassMode, repr: &BackendRepr) -> UsesVectorReg
UsesVectorRegisters::FixedVector
}
PassMode::Direct(..) | PassMode::Pair(..)
if matches!(repr, BackendRepr::ScalableVector { .. }) =>
if matches!(repr, BackendRepr::SimdScalableVector { .. }) =>
{
UsesVectorRegisters::ScalableVector
}
@@ -265,7 +265,7 @@ fn stable<'cx>(
rustc_abi::BackendRepr::SimdVector { element, count } => {
ValueAbi::Vector { element: element.stable(tables, cx), count }
}
rustc_abi::BackendRepr::ScalableVector { element, count } => {
rustc_abi::BackendRepr::SimdScalableVector { element, count } => {
ValueAbi::ScalableVector { element: element.stable(tables, cx), count }
}
rustc_abi::BackendRepr::Memory { sized } => ValueAbi::Aggregate { sized },
@@ -88,7 +88,7 @@ fn should_use_fp_conv_helper<'a, Ty, C>(
BackendRepr::SimdVector { .. } => {
return Err(CannotUseFpConv);
}
BackendRepr::ScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::SimdScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => match arg_layout.fields {
FieldsShape::Primitive => {
unreachable!("aggregates can't have `FieldsShape::Primitive`")
+2 -2
View File
@@ -392,7 +392,7 @@ pub fn new(
),
BackendRepr::SimdVector { .. } => PassMode::Direct(ArgAttributes::new()),
BackendRepr::Memory { .. } => Self::indirect_pass_mode(&layout),
BackendRepr::ScalableVector { .. } => PassMode::Direct(ArgAttributes::new()),
BackendRepr::SimdScalableVector { .. } => PassMode::Direct(ArgAttributes::new()),
};
ArgAbi { layout, mode }
}
@@ -878,7 +878,7 @@ fn layout_is_noundef<'a, Ty, C>(layout: TyAndLayout<'a, Ty>, cx: &C) -> bool
matches!(layout.variants, Variants::Single { .. }) && fields_are_noundef(layout, cx)
}
},
BackendRepr::SimdVector { .. } | BackendRepr::ScalableVector { .. } => false,
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => false,
}
}
+1 -1
View File
@@ -91,7 +91,7 @@ fn should_use_fp_conv_helper<'a, Ty, C>(
}
}
},
BackendRepr::SimdVector { .. } | BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => {
return Err(CannotUseFpConv);
}
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => match arg_layout.fields {
@@ -65,7 +65,7 @@ fn classify<'a, Ty, C>(
Primitive::Int(_, _) | Primitive::Pointer(_) => { /* pass in integer registers */ }
},
BackendRepr::SimdVector { .. } => {}
BackendRepr::ScalableVector { .. } => {}
BackendRepr::SimdScalableVector { .. } => {}
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => match arg_layout.fields {
FieldsShape::Primitive => {
unreachable!("aggregates can't have `FieldsShape::Primitive`")
+1 -1
View File
@@ -103,7 +103,7 @@ fn contains_vector<'a, Ty, C>(cx: &C, layout: TyAndLayout<'a, Ty>) -> bool
}
false
}
BackendRepr::ScalableVector { .. } => {
BackendRepr::SimdScalableVector { .. } => {
panic!("scalable vectors are unsupported")
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ fn classify<'a, Ty, C>(
BackendRepr::SimdVector { .. } => Class::Sse,
BackendRepr::ScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::SimdScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => {
for i in 0..layout.fields.count() {
@@ -25,7 +25,7 @@ pub(crate) fn compute_abi_info<'a, Ty, C: HasTargetSpec>(cx: &C, fn_abi: &mut Fn
// FIXME(eddyb) there should be a size cap here
// (probably what clang calls "illegal vectors").
}
BackendRepr::ScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::SimdScalableVector { .. } => panic!("scalable vectors are unsupported"),
BackendRepr::Scalar(scalar) => {
if is_ret && matches!(scalar.primitive(), Primitive::Int(Integer::I128, _)) {
if cx.target_spec().rustc_abi == Some(RustcAbi::Softfloat) {
+1 -1
View File
@@ -485,7 +485,7 @@ fn fn_arg_sanity_check<'tcx>(
match arg.layout.backend_repr {
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::ScalableVector { .. } => {}
| BackendRepr::SimdScalableVector { .. } => {}
BackendRepr::ScalarPair(..) => {
panic!("`PassMode::Direct` used for ScalarPair type {}", arg.layout.ty)
}
@@ -250,7 +250,7 @@ fn check_layout_abi<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
// And the size has to be element * count plus alignment padding, of course
assert!(size == (element_size * count).align_to(align));
}
BackendRepr::Memory { .. } | BackendRepr::ScalableVector { .. } => {} // Nothing to check.
BackendRepr::Memory { .. } | BackendRepr::SimdScalableVector { .. } => {} // Nothing to check.
}
}