about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/abi/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/abi/mod.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/abi/mod.rs63
1 files changed, 30 insertions, 33 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
index 80169122843..81091728692 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -300,7 +300,7 @@ impl<'tcx, M: Module> FunctionCx<'_, 'tcx, M> {
         return_ty: Ty<'tcx>,
     ) -> CValue<'tcx> {
         let (input_tys, args): (Vec<_>, Vec<_>) = args
-            .into_iter()
+            .iter()
             .map(|arg| {
                 (
                     self.clif_type(arg.layout().ty).unwrap(),
@@ -421,34 +421,31 @@ pub(crate) fn codegen_fn_prelude<'tcx>(
 
         // While this is normally an optimization to prevent an unnecessary copy when an argument is
         // not mutated by the current function, this is necessary to support unsized arguments.
-        match arg_kind {
-            ArgKind::Normal(Some(val)) => {
-                if let Some((addr, meta)) = val.try_to_ptr() {
-                    let local_decl = &fx.mir.local_decls[local];
-                    //                       v this ! is important
-                    let internally_mutable = !val.layout().ty.is_freeze(
-                        fx.tcx.at(local_decl.source_info.span),
-                        ParamEnv::reveal_all(),
-                    );
-                    if local_decl.mutability == mir::Mutability::Not && !internally_mutable {
-                        // We wont mutate this argument, so it is fine to borrow the backing storage
-                        // of this argument, to prevent a copy.
-
-                        let place = if let Some(meta) = meta {
-                            CPlace::for_ptr_with_extra(addr, meta, val.layout())
-                        } else {
-                            CPlace::for_ptr(addr, val.layout())
-                        };
-
-                        #[cfg(debug_assertions)]
-                        self::comments::add_local_place_comments(fx, place, local);
-
-                        assert_eq!(fx.local_map.push(place), local);
-                        continue;
-                    }
+        if let ArgKind::Normal(Some(val)) = arg_kind {
+            if let Some((addr, meta)) = val.try_to_ptr() {
+                let local_decl = &fx.mir.local_decls[local];
+                //                       v this ! is important
+                let internally_mutable = !val.layout().ty.is_freeze(
+                    fx.tcx.at(local_decl.source_info.span),
+                    ParamEnv::reveal_all(),
+                );
+                if local_decl.mutability == mir::Mutability::Not && !internally_mutable {
+                    // We wont mutate this argument, so it is fine to borrow the backing storage
+                    // of this argument, to prevent a copy.
+
+                    let place = if let Some(meta) = meta {
+                        CPlace::for_ptr_with_extra(addr, meta, val.layout())
+                    } else {
+                        CPlace::for_ptr(addr, val.layout())
+                    };
+
+                    #[cfg(debug_assertions)]
+                    self::comments::add_local_place_comments(fx, place, local);
+
+                    assert_eq!(fx.local_map.push(place), local);
+                    continue;
                 }
             }
-            _ => {}
         }
 
         let place = make_local_place(fx, local, layout, is_ssa);
@@ -500,7 +497,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
         .tcx
         .normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &fn_ty.fn_sig(fx.tcx));
 
-    let destination = destination.map(|(place, bb)| (trans_place(fx, place), bb));
+    let destination = destination.map(|(place, bb)| (codegen_place(fx, place), bb));
 
     // Handle special calls like instrinsics and empty drop glue.
     let instance = if let ty::FnDef(def_id, substs) = *fn_ty.kind() {
@@ -553,8 +550,8 @@ pub(crate) fn codegen_terminator_call<'tcx>(
     // Unpack arguments tuple for closures
     let args = if fn_sig.abi == Abi::RustCall {
         assert_eq!(args.len(), 2, "rust-call abi requires two arguments");
-        let self_arg = trans_operand(fx, &args[0]);
-        let pack_arg = trans_operand(fx, &args[1]);
+        let self_arg = codegen_operand(fx, &args[0]);
+        let pack_arg = codegen_operand(fx, &args[1]);
 
         let tupled_arguments = match pack_arg.layout().ty.kind() {
             ty::Tuple(ref tupled_arguments) => tupled_arguments,
@@ -568,8 +565,8 @@ pub(crate) fn codegen_terminator_call<'tcx>(
         }
         args
     } else {
-        args.into_iter()
-            .map(|arg| trans_operand(fx, arg))
+        args.iter()
+            .map(|arg| codegen_operand(fx, arg))
             .collect::<Vec<_>>()
     };
 
@@ -613,7 +610,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
                 let nop_inst = fx.bcx.ins().nop();
                 fx.add_comment(nop_inst, "indirect call");
             }
-            let func = trans_operand(fx, func).load_scalar(fx);
+            let func = codegen_operand(fx, func).load_scalar(fx);
             (
                 Some(func),
                 args.get(0)