Switch from tuple matching to match guards

This commit is contained in:
Jake Goulding 2020-10-24 09:44:57 -04:00
parent 07a63e6d1f
commit c6ab758e54

View File

@ -173,26 +173,24 @@ pub(super) fn emit_va_arg(
// is lacking in some instances, so we should only use it as a fallback. // is lacking in some instances, so we should only use it as a fallback.
let target = &bx.cx.tcx.sess.target; let target = &bx.cx.tcx.sess.target;
let arch = &bx.cx.tcx.sess.target.arch; let arch = &bx.cx.tcx.sess.target.arch;
match (&**arch, target.options.is_like_windows) { match &**arch {
// Windows x86 // Windows x86
("x86", true) => { "x86" if target.options.is_like_windows => {
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), false) emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), false)
} }
// Generic x86 // Generic x86
("x86", _) => { "x86" => emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), true),
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), true)
}
// Windows AArch64 // Windows AArch64
("aarch64", true) => { "aarch64" if target.options.is_like_windows => {
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false) emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false)
} }
// iOS AArch64 // iOS AArch64
("aarch64", _) if target.target_os == "ios" => { "aarch64" if target.target_os == "ios" => {
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true) emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true)
} }
("aarch64", _) => emit_aapcs_va_arg(bx, addr, target_ty), "aarch64" => emit_aapcs_va_arg(bx, addr, target_ty),
// Windows x86_64 // Windows x86_64
("x86_64", true) => { "x86_64" if target.options.is_like_windows => {
let target_ty_size = bx.cx.size_of(target_ty).bytes(); let target_ty_size = bx.cx.size_of(target_ty).bytes();
let indirect: bool = target_ty_size > 8 || !target_ty_size.is_power_of_two(); let indirect: bool = target_ty_size > 8 || !target_ty_size.is_power_of_two();
emit_ptr_va_arg(bx, addr, target_ty, indirect, Align::from_bytes(8).unwrap(), false) emit_ptr_va_arg(bx, addr, target_ty, indirect, Align::from_bytes(8).unwrap(), false)