about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-01-25 17:12:16 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-01-25 17:12:16 +0100
commit2b58d8c187936567d92ab45be8a34be087071e05 (patch)
treecb677c7f8dcd5b4204fd18af10017c38fcc51ebb
parentde713a80cac60164f435a4e6a7ca710f5fdccd45 (diff)
downloadrust-2b58d8c187936567d92ab45be8a34be087071e05.tar.gz
rust-2b58d8c187936567d92ab45be8a34be087071e05.zip
Misc cleanups
-rw-r--r--src/abi/comments.rs3
-rw-r--r--src/abi/pass_mode.rs32
-rw-r--r--src/abi/returning.rs1
3 files changed, 6 insertions, 30 deletions
diff --git a/src/abi/comments.rs b/src/abi/comments.rs
index af42e54451b..4847b007a36 100644
--- a/src/abi/comments.rs
+++ b/src/abi/comments.rs
@@ -24,7 +24,6 @@ pub(super) fn add_arg_comment<'tcx>(
     local_field: Option<usize>,
     params: EmptySinglePair<Value>,
     arg_abi: &ArgAbi<'tcx, Ty<'tcx>>,
-    ty: Ty<'tcx>,
 ) {
     let local = if let Some(local) = local {
         Cow::Owned(format!("{:?}", local))
@@ -51,7 +50,7 @@ pub(super) fn add_arg_comment<'tcx>(
         local_field = local_field,
         params = params,
         pass_mode = pass_mode,
-        ty = ty,
+        ty = arg_abi.layout.ty,
     ));
 }
 
diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs
index 51fc4ecd1ef..aec321bd4a0 100644
--- a/src/abi/pass_mode.rs
+++ b/src/abi/pass_mode.rs
@@ -123,10 +123,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
             RustcPassMode::Direct(_) => match &self.layout.abi {
                 Abi::Scalar(scalar) => (
                     None,
-                    vec![AbiParam::new(scalar_to_clif_type(
-                        tcx,
-                        scalar.clone(),
-                    ))],
+                    vec![AbiParam::new(scalar_to_clif_type(tcx, scalar.clone()))],
                 ),
                 // FIXME implement Vector Abi in a cg_llvm compatible way
                 Abi::Vector { .. } => {
@@ -139,10 +136,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
                 Abi::ScalarPair(a, b) => {
                     let a = scalar_to_clif_type(tcx, a.clone());
                     let b = scalar_to_clif_type(tcx, b.clone());
-                    (
-                        None,
-                        vec![AbiParam::new(a), AbiParam::new(b)],
-                    )
+                    (None, vec![AbiParam::new(a), AbiParam::new(b)])
                 }
                 _ => unreachable!("{:?}", self.layout.abi),
             },
@@ -192,11 +186,7 @@ pub(super) fn get_arg_abi<'tcx>(
             // FIXME implement Vector Abi in a cg_llvm compatible way
             Abi::Vector { .. } => {
                 if crate::intrinsics::clif_vector_type(tcx, arg_abi.layout).is_none() {
-                    arg_abi.mode = RustcPassMode::Indirect {
-                        attrs: ArgAttributes::new(),
-                        extra_attrs: None,
-                        on_stack: false,
-                    };
+                    arg_abi.make_indirect();
                 }
             }
             _ => unreachable!("{:?}", arg_abi.layout.abi),
@@ -206,11 +196,7 @@ pub(super) fn get_arg_abi<'tcx>(
                 let a = scalar_to_clif_type(tcx, a.clone());
                 let b = scalar_to_clif_type(tcx, b.clone());
                 if a == types::I128 && b == types::I128 {
-                    arg_abi.mode = RustcPassMode::Indirect {
-                        attrs: ArgAttributes::new(),
-                        extra_attrs: None,
-                        on_stack: false,
-                    };
+                    arg_abi.make_indirect();
                 }
             }
             _ => unreachable!("{:?}", arg_abi.layout.abi),
@@ -257,15 +243,7 @@ pub(super) fn cvalue_for_param<'tcx>(
         clif_types.map(|abi_param| fx.bcx.append_block_param(start_block, abi_param.value_type));
 
     #[cfg(debug_assertions)]
-    crate::abi::comments::add_arg_comment(
-        fx,
-        "arg",
-        local,
-        local_field,
-        block_params,
-        &arg_abi,
-        arg_ty,
-    );
+    crate::abi::comments::add_arg_comment(fx, "arg", local, local_field, block_params, &arg_abi);
 
     match arg_abi.mode {
         RustcPassMode::Ignore => None,
diff --git a/src/abi/returning.rs b/src/abi/returning.rs
index 9edaa1dd879..3a5f61315f8 100644
--- a/src/abi/returning.rs
+++ b/src/abi/returning.rs
@@ -69,7 +69,6 @@ pub(super) fn codegen_return_param<'tcx>(
         None,
         ret_param,
         &ret_arg_abi,
-        ret_layout.ty,
     );
 
     ret_place