Skip to content

Commit 69af784

Browse files
committed
Re-add rustc_codegen_ssa::builder::array_alloca
This function was removed in the #102551 I need this function in #100316 for the custom entry function for UEFI. Signed-off-by: Ayush Singh <[email protected]>
1 parent 5b3e909 commit 69af784

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
655655
self.current_func().new_local(None, aligned_type, &format!("stack_var_{}", self.stack_var_count.get())).get_address(None)
656656
}
657657

658-
fn byte_array_alloca(&mut self, _len: RValue<'gcc>, _align: Align) -> RValue<'gcc> {
658+
fn array_alloca(&mut self, _ty: Type<'gcc>, _len: RValue<'gcc>, _align: Align) -> RValue<'gcc> {
659659
unimplemented!();
660660
}
661661

compiler/rustc_codegen_llvm/src/builder.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,9 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
421421
}
422422
}
423423

424-
fn byte_array_alloca(&mut self, len: &'ll Value, align: Align) -> &'ll Value {
424+
fn array_alloca(&mut self, ty: &'ll Type, len: &'ll Value, align: Align) -> &'ll Value {
425425
unsafe {
426-
let alloca =
427-
llvm::LLVMBuildArrayAlloca(self.llbuilder, self.cx().type_i8(), len, UNNAMED);
426+
let alloca = llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len, UNNAMED);
428427
llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint);
429428
alloca
430429
}

compiler/rustc_codegen_ssa/src/traits/builder.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ pub trait BuilderMethods<'a, 'tcx>:
135135
fn to_immediate_scalar(&mut self, val: Self::Value, scalar: Scalar) -> Self::Value;
136136

137137
fn alloca(&mut self, ty: Self::Type, align: Align) -> Self::Value;
138-
fn byte_array_alloca(&mut self, len: Self::Value, align: Align) -> Self::Value;
138+
fn array_alloca(&mut self, ty: Self::Type, len: Self::Value, align: Align) -> Self::Value;
139+
fn byte_array_alloca(&mut self, len: Self::Value, align: Align) -> Self::Value {
140+
self.array_alloca(self.cx().type_i8(), len, align)
141+
}
139142

140143
fn load(&mut self, ty: Self::Type, ptr: Self::Value, align: Align) -> Self::Value;
141144
fn volatile_load(&mut self, ty: Self::Type, ptr: Self::Value) -> Self::Value;

0 commit comments

Comments
 (0)