Outline a bug! invocation

This reduces the amount of llvm ir lines for intrinsic related code from
23801 to 20478.
This commit is contained in:
bjorn3 2022-07-26 16:26:35 +00:00
parent 54eb0d992a
commit d3099a40c7

View File

@ -7,7 +7,7 @@ macro_rules! intrinsic_args {
let ($($arg),*) = if let [$($arg),*] = $args { let ($($arg),*) = if let [$($arg),*] = $args {
($(codegen_operand($fx, $arg)),*) ($(codegen_operand($fx, $arg)),*)
} else { } else {
bug!("wrong number of args for intrinsic {}", $intrinsic); $crate::intrinsics::bug_on_incorrect_arg_count($intrinsic);
}; };
} }
} }
@ -26,6 +26,10 @@ macro_rules! intrinsic_args {
use crate::prelude::*; use crate::prelude::*;
use cranelift_codegen::ir::AtomicRmwOp; use cranelift_codegen::ir::AtomicRmwOp;
fn bug_on_incorrect_arg_count(intrinsic: impl std::fmt::Display) -> ! {
bug!("wrong number of args for intrinsic {}", intrinsic);
}
fn report_atomic_type_validation_error<'tcx>( fn report_atomic_type_validation_error<'tcx>(
fx: &mut FunctionCx<'_, '_, 'tcx>, fx: &mut FunctionCx<'_, '_, 'tcx>,
intrinsic: Symbol, intrinsic: Symbol,