Skip to content

Commit 198d4e6

Browse files
committed
va_arg: use emit_ptr_va_arg for mips
1 parent 781e189 commit 198d4e6

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,14 +1169,26 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
11691169
AllowHigherAlign::Yes,
11701170
ForceRightAdjust::No,
11711171
),
1172+
Arch::Mips | Arch::Mips32r6 | Arch::Mips64 | Arch::Mips64r6 => emit_ptr_va_arg(
1173+
bx,
1174+
addr,
1175+
target_ty,
1176+
PassMode::Direct,
1177+
if target.llvm_abiname.starts_with("n32") || target.llvm_abiname.starts_with("n64") {
1178+
SlotSize::Bytes8
1179+
} else {
1180+
SlotSize::Bytes4
1181+
},
1182+
AllowHigherAlign::Yes,
1183+
match bx.tcx().sess.target.endian {
1184+
Endian::Big => ForceRightAdjust::Yes,
1185+
Endian::Little => ForceRightAdjust::No,
1186+
},
1187+
),
11721188

11731189
Arch::Bpf => bug!("bpf does not support c-variadic functions"),
11741190
Arch::SpirV => bug!("spirv does not support c-variadic functions"),
11751191

1176-
Arch::Mips | Arch::Mips32r6 | Arch::Mips64 | Arch::Mips64r6 => {
1177-
// FIXME: port MipsTargetLowering::lowerVAARG.
1178-
bx.va_arg(addr.immediate(), bx.cx.layout_of(target_ty).llvm_type(bx.cx))
1179-
}
11801192
Arch::Sparc | Arch::Avr | Arch::M68k | Arch::Msp430 => {
11811193
// Clang uses the LLVM implementation for these architectures.
11821194
bx.va_arg(addr.immediate(), bx.cx.layout_of(target_ty).llvm_type(bx.cx))

0 commit comments

Comments
 (0)