Skip to content

Commit 09864b6

Browse files
committed
c-variadic: minor cleanups of va_arg
1 parent 4586feb commit 09864b6

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

compiler/rustc_codegen_llvm/src/va_arg.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn emit_ptr_va_arg<'ll, 'tcx>(
131131
);
132132
if indirect {
133133
let tmp_ret = bx.load(llty, addr, addr_align);
134-
bx.load(bx.cx.layout_of(target_ty).llvm_type(bx.cx), tmp_ret, align.abi)
134+
bx.load(layout.llvm_type(bx.cx), tmp_ret, align.abi)
135135
} else {
136136
bx.load(llty, addr, addr_align)
137137
}
@@ -1149,13 +1149,10 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
11491149
// This includes `target.is_like_darwin`, which on x86_64 targets is like sysv64.
11501150
Arch::X86_64 => emit_x86_64_sysv64_va_arg(bx, addr, target_ty),
11511151
Arch::Xtensa => emit_xtensa_va_arg(bx, addr, target_ty),
1152-
Arch::Hexagon => {
1153-
if target.env == Env::Musl {
1154-
emit_hexagon_va_arg_musl(bx, addr, target_ty)
1155-
} else {
1156-
emit_hexagon_va_arg_bare_metal(bx, addr, target_ty)
1157-
}
1158-
}
1152+
Arch::Hexagon => match target.env {
1153+
Env::Musl => emit_hexagon_va_arg_musl(bx, addr, target_ty),
1154+
_ => emit_hexagon_va_arg_bare_metal(bx, addr, target_ty),
1155+
},
11591156
// For all other architecture/OS combinations fall back to using
11601157
// the LLVM va_arg instruction.
11611158
// https://llvm.org/docs/LangRef.html#va-arg-instruction

0 commit comments

Comments
 (0)