Skip to content

Commit 11bc2e0

Browse files
codegen: implement repr(scalable)
Introduces `BackendRepr::ScalableVector` corresponding to scalable vector types annotated with `repr(scalable)` which lowers to a scalable vector type in LLVM. Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
1 parent f0418b3 commit 11bc2e0

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
943943
.get_address(self.location)
944944
}
945945

946+
fn scalable_alloca(&mut self, _elt: u64, _align: Align, _element_ty: Ty<'_>) -> RValue<'gcc> {
947+
todo!()
948+
}
949+
946950
fn load(&mut self, pointee_ty: Type<'gcc>, ptr: RValue<'gcc>, align: Align) -> RValue<'gcc> {
947951
let block = self.llbb();
948952
let function = block.get_function();

src/intrinsic/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
504504
let layout = self.layout_of(tp_ty).layout;
505505
let _use_integer_compare = match layout.backend_repr() {
506506
Scalar(_) | ScalarPair(_, _) => true,
507-
SimdVector { .. } => false,
507+
SimdVector { .. } | ScalableVector { .. } => false,
508508
Memory { .. } => {
509509
// For rusty ABIs, small aggregates are actually passed
510510
// as `RegKind::Integer` (see `FnAbi::adjust_for_abi`),

src/type_of.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
8585
);
8686
}
8787
BackendRepr::Memory { .. } => {}
88+
BackendRepr::ScalableVector { .. } => todo!(),
8889
}
8990

9091
let name = match *layout.ty.kind() {
@@ -179,6 +180,8 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
179180
fn is_gcc_immediate(&self) -> bool {
180181
match self.backend_repr {
181182
BackendRepr::Scalar(_) | BackendRepr::SimdVector { .. } => true,
183+
// FIXME(rustc_scalable_vector): Not yet implemented in rustc_codegen_gcc.
184+
BackendRepr::ScalableVector { .. } => todo!(),
182185
BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => false,
183186
}
184187
}
@@ -188,6 +191,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
188191
BackendRepr::ScalarPair(..) => true,
189192
BackendRepr::Scalar(_)
190193
| BackendRepr::SimdVector { .. }
194+
| BackendRepr::ScalableVector { .. }
191195
| BackendRepr::Memory { .. } => false,
192196
}
193197
}

0 commit comments

Comments
 (0)