Skip to content

Commit aa0ce23

Browse files
committed
c-variadic: minor cleanups of va_arg
1 parent 55407b8 commit aa0ce23

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
}
@@ -1140,13 +1140,10 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
11401140
// This includes `target.is_like_darwin`, which on x86_64 targets is like sysv64.
11411141
Arch::X86_64 => emit_x86_64_sysv64_va_arg(bx, addr, target_ty),
11421142
Arch::Xtensa => emit_xtensa_va_arg(bx, addr, target_ty),
1143-
Arch::Hexagon => {
1144-
if target.env == Env::Musl {
1145-
emit_hexagon_va_arg_musl(bx, addr, target_ty)
1146-
} else {
1147-
emit_hexagon_va_arg_bare_metal(bx, addr, target_ty)
1148-
}
1149-
}
1143+
Arch::Hexagon => match target.env {
1144+
Env::Musl => emit_hexagon_va_arg_musl(bx, addr, target_ty),
1145+
_ => emit_hexagon_va_arg_bare_metal(bx, addr, target_ty),
1146+
},
11501147
// For all other architecture/OS combinations fall back to using
11511148
// the LLVM va_arg instruction.
11521149
// https://llvm.org/docs/LangRef.html#va-arg-instruction

0 commit comments

Comments
 (0)