codegen_llvm: whitespace & formatting improvements
This commit is contained in:
parent
ef5c00d0ca
commit
61f47737b5
13 changed files with 69 additions and 80 deletions
|
@ -259,8 +259,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
|
|||
}
|
||||
|
||||
pub trait FnTypeExt<'tcx> {
|
||||
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>)
|
||||
-> Self;
|
||||
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>) -> Self;
|
||||
fn new(cx: &CodegenCx<'ll, 'tcx>,
|
||||
sig: ty::FnSig<'tcx>,
|
||||
extra_args: &[Ty<'tcx>]) -> Self;
|
||||
|
@ -283,8 +282,7 @@ pub trait FnTypeExt<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
|
||||
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>)
|
||||
-> Self {
|
||||
fn of_instance(cx: &CodegenCx<'ll, 'tcx>, instance: &ty::Instance<'tcx>) -> Self {
|
||||
let fn_ty = instance.ty(cx.tcx);
|
||||
let sig = ty_fn_sig(cx, fn_ty);
|
||||
let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig);
|
||||
|
|
|
@ -737,8 +737,8 @@ fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
rx: mpsc::Receiver<Box<dyn Any + Send>>)
|
||||
-> OngoingCodegen {
|
||||
|
||||
-> OngoingCodegen
|
||||
{
|
||||
check_for_rustc_errors_attr(tcx);
|
||||
|
||||
if let Some(true) = tcx.sess.opts.debugging_opts.thinlto {
|
||||
|
@ -803,8 +803,7 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
// Run the monomorphization collector and partition the collected items into
|
||||
// codegen units.
|
||||
let codegen_units =
|
||||
tcx.collect_and_partition_mono_items(LOCAL_CRATE).1;
|
||||
let codegen_units = tcx.collect_and_partition_mono_items(LOCAL_CRATE).1;
|
||||
let codegen_units = (*codegen_units).clone();
|
||||
|
||||
// Force all codegen_unit queries so they are already either red or green
|
||||
|
|
|
@ -59,8 +59,8 @@ pub struct CodegenCx<'a, 'tcx: 'a> {
|
|||
/// Cache instances of monomorphic and polymorphic items
|
||||
pub instances: RefCell<FxHashMap<Instance<'tcx>, &'a Value>>,
|
||||
/// Cache generated vtables
|
||||
pub vtables: RefCell<FxHashMap<(Ty<'tcx>,
|
||||
Option<ty::PolyExistentialTraitRef<'tcx>>), &'a Value>>,
|
||||
pub vtables: RefCell<FxHashMap<(Ty<'tcx>, Option<ty::PolyExistentialTraitRef<'tcx>>),
|
||||
&'a Value>>,
|
||||
/// Cache of constant strings,
|
||||
pub const_cstr_cache: RefCell<FxHashMap<LocalInternedString, &'a Value>>,
|
||||
|
||||
|
|
|
@ -373,7 +373,6 @@ pub fn codegen_intrinsic_call(
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => {
|
||||
let sty = &arg_tys[0].sty;
|
||||
|
@ -822,8 +821,7 @@ fn codegen_msvc_try(
|
|||
let i64p = Type::i64(cx).ptr_to();
|
||||
let ptr_align = bx.tcx().data_layout.pointer_align;
|
||||
let slot = bx.alloca(i64p, "slot", ptr_align);
|
||||
bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(),
|
||||
None);
|
||||
bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(), None);
|
||||
|
||||
normal.ret(C_i32(cx, 0));
|
||||
|
||||
|
@ -911,8 +909,7 @@ fn codegen_gnu_try(
|
|||
// being thrown. The second value is a "selector" indicating which of
|
||||
// the landing pad clauses the exception's type had been matched to.
|
||||
// rust_try ignores the selector.
|
||||
let lpad_ty = Type::struct_(cx, &[Type::i8p(cx), Type::i32(cx)],
|
||||
false);
|
||||
let lpad_ty = Type::struct_(cx, &[Type::i8p(cx), Type::i32(cx)], false);
|
||||
let vals = catch.landing_pad(lpad_ty, bx.cx.eh_personality(), 1);
|
||||
catch.add_clause(vals, C_null(Type::i8p(cx)));
|
||||
let ptr = catch.extract_value(vals, 0);
|
||||
|
@ -1000,11 +997,11 @@ fn generic_simd_intrinsic(
|
|||
($msg: tt, $($fmt: tt)*) => {
|
||||
span_invalid_monomorphization_error(
|
||||
bx.sess(), span,
|
||||
&format!(concat!("invalid monomorphization of `{}` intrinsic: ",
|
||||
$msg),
|
||||
&format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg),
|
||||
name, $($fmt)*));
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! return_error {
|
||||
($($fmt: tt)*) => {
|
||||
{
|
||||
|
@ -1021,14 +1018,13 @@ fn generic_simd_intrinsic(
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! require_simd {
|
||||
($ty: expr, $position: expr) => {
|
||||
require!($ty.is_simd(), "expected SIMD {} type, found non-SIMD `{}`", $position, $ty)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
let tcx = bx.tcx();
|
||||
let sig = tcx.normalize_erasing_late_bound_regions(
|
||||
ty::ParamEnv::reveal_all(),
|
||||
|
@ -1150,9 +1146,7 @@ fn generic_simd_intrinsic(
|
|||
);
|
||||
match m_elem_ty.sty {
|
||||
ty::Int(_) => {},
|
||||
_ => {
|
||||
return_error!("mask element type is `{}`, expected `i_`", m_elem_ty);
|
||||
}
|
||||
_ => return_error!("mask element type is `{}`, expected `i_`", m_elem_ty)
|
||||
}
|
||||
// truncate the mask to a vector of i1s
|
||||
let i1 = Type::i1(bx.cx);
|
||||
|
@ -1177,8 +1171,7 @@ fn generic_simd_intrinsic(
|
|||
($msg: tt, $($fmt: tt)*) => {
|
||||
span_invalid_monomorphization_error(
|
||||
bx.sess(), span,
|
||||
&format!(concat!("invalid monomorphization of `{}` intrinsic: ",
|
||||
$msg),
|
||||
&format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg),
|
||||
name, $($fmt)*));
|
||||
}
|
||||
}
|
||||
|
@ -1570,7 +1563,6 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
Ok(bx.$float_reduce(acc, args[0].immediate()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue