about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-07 12:08:41 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-16 14:15:13 +0200
commit484e07c231e29febc68f2f21e970f8eb19818ad6 (patch)
treebc5962d8ee9199d97fa3413a07e32b06fcde0cc1 /src/librustc_codegen_llvm
parent0a1c50955b35892643a4bcfce08e72d9297b5bca (diff)
downloadrust-484e07c231e29febc68f2f21e970f8eb19818ad6.tar.gz
rust-484e07c231e29febc68f2f21e970f8eb19818ad6.zip
[eddyb/rebase cleanup] s/&self./self.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/builder.rs8
-rw-r--r--src/librustc_codegen_llvm/common.rs34
-rw-r--r--src/librustc_codegen_llvm/consts.rs58
-rw-r--r--src/librustc_codegen_llvm/context.rs58
4 files changed, 79 insertions, 79 deletions
diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs
index cee046c86c7..a7a00dd0707 100644
--- a/src/librustc_codegen_llvm/builder.rs
+++ b/src/librustc_codegen_llvm/builder.rs
@@ -761,7 +761,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
         }).collect::<Vec<_>>();
 
         debug!("Asm Output Type: {:?}", output);
-        let fty = &self.cx().type_func(&argtys[..], output);
+        let fty = self.cx().type_func(&argtys[..], output);
         unsafe {
             // Ask LLVM to verify that the constraints are well-formed.
             let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons);
@@ -896,9 +896,9 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
     fn vector_splat(&self, num_elts: usize, elt: &'ll Value) -> &'ll Value {
         unsafe {
             let elt_ty = self.cx.val_ty(elt);
-            let undef = llvm::LLVMGetUndef(&self.cx().type_vector(elt_ty, num_elts as u64));
+            let undef = llvm::LLVMGetUndef(self.cx().type_vector(elt_ty, num_elts as u64));
             let vec = self.insert_element(undef, elt, self.cx.const_i32(0));
-            let vec_i32_ty = &self.cx().type_vector(&self.cx().type_i32(), num_elts as u64);
+            let vec_i32_ty = self.cx().type_vector(self.cx().type_i32(), num_elts as u64);
             self.shuffle_vector(vec, undef, self.cx().const_null(vec_i32_ty))
         }
     }
@@ -1305,6 +1305,6 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
     }
 
     fn cx(&self) -> &'a CodegenCx<'ll, 'tcx> {
-        &self.cx
+        self.cx
     }
 }
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs
index fde834a2481..e20a93e4e3e 100644
--- a/src/librustc_codegen_llvm/common.rs
+++ b/src/librustc_codegen_llvm/common.rs
@@ -255,19 +255,19 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
     }
 
     fn const_bool(&self, val: bool) -> &'ll Value {
-        &self.const_uint(&self.type_i1(), val as u64)
+        self.const_uint(self.type_i1(), val as u64)
     }
 
     fn const_i32(&self, i: i32) -> &'ll Value {
-        &self.const_int(&self.type_i32(), i as i64)
+        self.const_int(self.type_i32(), i as i64)
     }
 
     fn const_u32(&self, i: u32) -> &'ll Value {
-        &self.const_uint(&self.type_i32(), i as u64)
+        self.const_uint(self.type_i32(), i as u64)
     }
 
     fn const_u64(&self, i: u64) -> &'ll Value {
-        &self.const_uint(&self.type_i64(), i)
+        self.const_uint(self.type_i64(), i)
     }
 
     fn const_usize(&self, i: u64) -> &'ll Value {
@@ -277,11 +277,11 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
             assert!(i < (1<<bit_size));
         }
 
-        &self.const_uint(&self.isize_ty, i)
+        self.const_uint(self.isize_ty, i)
     }
 
     fn const_u8(&self, i: u8) -> &'ll Value {
-        &self.const_uint(&self.type_i8(), i as u64)
+        self.const_uint(self.type_i8(), i as u64)
     }
 
 
@@ -293,23 +293,23 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
         null_terminated: bool,
     ) -> &'ll Value {
         unsafe {
-            if let Some(&llval) = &self.const_cstr_cache.borrow().get(&s) {
+            if let Some(&llval) = self.const_cstr_cache.borrow().get(&s) {
                 return llval;
             }
 
-            let sc = llvm::LLVMConstStringInContext(&self.llcx,
+            let sc = llvm::LLVMConstStringInContext(self.llcx,
                                                     s.as_ptr() as *const c_char,
                                                     s.len() as c_uint,
                                                     !null_terminated as Bool);
-            let sym = &self.generate_local_symbol_name("str");
-            let g = declare::define_global(&self, &sym[..], &self.val_ty(sc)).unwrap_or_else(||{
+            let sym = self.generate_local_symbol_name("str");
+            let g = declare::define_global(&self, &sym[..], self.val_ty(sc)).unwrap_or_else(||{
                 bug!("symbol `{}` is already defined", sym);
             });
             llvm::LLVMSetInitializer(g, sc);
             llvm::LLVMSetGlobalConstant(g, True);
             llvm::LLVMRustSetLinkage(g, llvm::Linkage::InternalLinkage);
 
-            &self.const_cstr_cache.borrow_mut().insert(s, g);
+            self.const_cstr_cache.borrow_mut().insert(s, g);
             g
         }
     }
@@ -318,9 +318,9 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
     // you will be kicked off fast isel. See issue #4352 for an example of this.
     fn const_str_slice(&self, s: LocalInternedString) -> &'ll Value {
         let len = s.len();
-        let cs = consts::ptrcast(&self.const_cstr(s, false),
-            &self.type_ptr_to(&self.layout_of(&self.tcx.mk_str()).llvm_type(&self)));
-        &self.const_fat_ptr(cs, &self.const_usize(len as u64))
+        let cs = consts::ptrcast(self.const_cstr(s, false),
+            self.type_ptr_to(self.layout_of(self.tcx.mk_str()).llvm_type(&self)));
+        self.const_fat_ptr(cs, self.const_usize(len as u64))
     }
 
     fn const_fat_ptr(
@@ -330,7 +330,7 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
     ) -> &'ll Value {
         assert_eq!(abi::FAT_PTR_ADDR, 0);
         assert_eq!(abi::FAT_PTR_EXTRA, 1);
-        &self.const_struct(&[ptr, meta], false)
+        self.const_struct(&[ptr, meta], false)
     }
 
     fn const_struct(
@@ -338,7 +338,7 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
         elts: &[&'ll Value],
         packed: bool
     ) -> &'ll Value {
-        struct_in_context(&self.llcx, elts, packed)
+        struct_in_context(self.llcx, elts, packed)
     }
 
     fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
@@ -354,7 +354,7 @@ impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
     }
 
     fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
-        bytes_in_context(&self.llcx, bytes)
+        bytes_in_context(self.llcx, bytes)
     }
 
     fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {
diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs
index 83036e65ba3..9b330bc5f8e 100644
--- a/src/librustc_codegen_llvm/consts.rs
+++ b/src/librustc_codegen_llvm/consts.rs
@@ -137,16 +137,16 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
     ) -> &'ll Value {
         unsafe {
             let gv = match kind {
-                Some(kind) if !&self.tcx.sess.fewer_names() => {
-                    let name = &self.generate_local_symbol_name(kind);
+                Some(kind) if !self.tcx.sess.fewer_names() => {
+                    let name = self.generate_local_symbol_name(kind);
                     let gv = declare::define_global(&self, &name[..],
-                        &self.val_ty(cv)).unwrap_or_else(||{
+                        self.val_ty(cv)).unwrap_or_else(||{
                             bug!("symbol `{}` is already defined", name);
                     });
                     llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage);
                     gv
                 },
-                _ => declare::define_private_global(&self, &self.val_ty(cv)),
+                _ => declare::define_private_global(&self, self.val_ty(cv)),
             };
             llvm::LLVMSetInitializer(gv, cv);
             set_global_alignment(&self, gv, align);
@@ -161,7 +161,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
         align: Align,
         kind: Option<&str>,
     ) -> &'ll Value {
-        if let Some(&gv) = &self.const_globals.borrow().get(&cv) {
+        if let Some(&gv) = self.const_globals.borrow().get(&cv) {
             unsafe {
                 // Upgrade the alignment in cases where the same constant is used with different
                 // alignment requirements
@@ -172,21 +172,21 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             }
             return gv;
         }
-        let gv = &self.static_addr_of_mut(cv, align, kind);
+        let gv = self.static_addr_of_mut(cv, align, kind);
         unsafe {
             llvm::LLVMSetGlobalConstant(gv, True);
         }
-        &self.const_globals.borrow_mut().insert(cv, gv);
+        self.const_globals.borrow_mut().insert(cv, gv);
         gv
     }
 
     fn get_static(&self, def_id: DefId) -> &'ll Value {
         let instance = Instance::mono(self.tcx, def_id);
-        if let Some(&g) = &self.instances.borrow().get(&instance) {
+        if let Some(&g) = self.instances.borrow().get(&instance) {
             return g;
         }
 
-        let defined_in_current_codegen_unit = &self.codegen_unit
+        let defined_in_current_codegen_unit = self.codegen_unit
                                                 .items()
                                                 .contains_key(&MonoItem::Static(def_id));
         assert!(!defined_in_current_codegen_unit,
@@ -201,8 +201,8 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
 
         let g = if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
 
-            let llty = &self.layout_of(ty).llvm_type(&self);
-            let (g, attrs) = match &self.tcx.hir.get(id) {
+            let llty = self.layout_of(ty).llvm_type(&self);
+            let (g, attrs) = match self.tcx.hir.get(id) {
                 Node::Item(&hir::Item {
                     ref attrs, span, node: hir::ItemKind::Static(..), ..
                 }) => {
@@ -212,7 +212,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
 
                     let g = declare::define_global(&self, &sym[..], llty).unwrap();
 
-                    if !&self.tcx.is_reachable_non_generic(def_id) {
+                    if !self.tcx.is_reachable_non_generic(def_id) {
                         unsafe {
                             llvm::LLVMRustSetVisibility(g, llvm::Visibility::Hidden);
                         }
@@ -224,7 +224,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 Node::ForeignItem(&hir::ForeignItem {
                     ref attrs, span, node: hir::ForeignItemKind::Static(..), ..
                 }) => {
-                    let fn_attrs = &self.tcx.codegen_fn_attrs(def_id);
+                    let fn_attrs = self.tcx.codegen_fn_attrs(def_id);
                     (check_and_apply_linkage(&self, &fn_attrs, ty, sym, Some(span)), attrs)
                 }
 
@@ -242,9 +242,9 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             g
         } else {
             // FIXME(nagisa): perhaps the map of externs could be offloaded to llvm somehow?
-            debug!("get_static: sym={} item_attr={:?}", sym, &self.tcx.item_attrs(def_id));
+            debug!("get_static: sym={} item_attr={:?}", sym, self.tcx.item_attrs(def_id));
 
-            let attrs = &self.tcx.codegen_fn_attrs(def_id);
+            let attrs = self.tcx.codegen_fn_attrs(def_id);
             let g = check_and_apply_linkage(&self, &attrs, ty, sym, None);
 
             // Thread-local statics in some other crate need to *always* be linked
@@ -258,11 +258,11 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             }
 
             let needs_dll_storage_attr =
-                self.use_dll_storage_attrs && !&self.tcx.is_foreign_item(def_id) &&
+                self.use_dll_storage_attrs && !self.tcx.is_foreign_item(def_id) &&
                 // ThinLTO can't handle this workaround in all cases, so we don't
                 // emit the attrs. Instead we make them unnecessary by disallowing
                 // dynamic linking when cross-language LTO is enabled.
-                !&self.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled();
+                !self.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled();
 
             // If this assertion triggers, there's something wrong with commandline
             // argument validation.
@@ -281,7 +281,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 // crates, so there are cases where a static with an upstream DefId
                 // is actually present in the current crate. We can find out via the
                 // is_codegened_item query.
-                if !&self.tcx.is_codegened_item(def_id) {
+                if !self.tcx.is_codegened_item(def_id) {
                     unsafe {
                         llvm::LLVMSetDLLStorageClass(g, llvm::DLLStorageClass::DllImport);
                     }
@@ -297,7 +297,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             }
         }
 
-        &self.instances.borrow_mut().insert(instance, g);
+        self.instances.borrow_mut().insert(instance, g);
         g
     }
 
@@ -307,7 +307,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
         is_mutable: bool,
     ) {
         unsafe {
-            let attrs = &self.tcx.codegen_fn_attrs(def_id);
+            let attrs = self.tcx.codegen_fn_attrs(def_id);
 
             let (v, alloc) = match ::mir::codegen_static_initializer(&self, def_id) {
                 Ok(v) => v,
@@ -315,7 +315,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 Err(_) => return,
             };
 
-            let g = &self.get_static(def_id);
+            let g = self.get_static(def_id);
 
             // boolean SSA values are i1, but they have to be stored in i8 slots,
             // otherwise some LLVM optimization passes don't work as expected
@@ -344,7 +344,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 let visibility = llvm::LLVMRustGetVisibility(g);
 
                 let new_g = llvm::LLVMRustGetOrInsertGlobal(
-                    &self.llmod, name_string.as_ptr(), val_llty);
+                    self.llmod, name_string.as_ptr(), val_llty);
 
                 llvm::LLVMRustSetLinkage(new_g, linkage);
                 llvm::LLVMRustSetVisibility(new_g, visibility);
@@ -352,7 +352,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
                 // To avoid breaking any invariants, we leave around the old
                 // global for the moment; we'll replace all references to it
                 // with the new global later. (See base::codegen_backend.)
-                &self.statics_to_rauw.borrow_mut().push((g, new_g));
+                self.statics_to_rauw.borrow_mut().push((g, new_g));
                 new_g
             };
             set_global_alignment(&self, g, self.align_of(ty));
@@ -416,19 +416,19 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
             if self.tcx.sess.opts.target_triple.triple().starts_with("wasm32") {
                 if let Some(section) = attrs.link_section {
                     let section = llvm::LLVMMDStringInContext(
-                        &self.llcx,
+                        self.llcx,
                         section.as_str().as_ptr() as *const _,
                         section.as_str().len() as c_uint,
                     );
                     let alloc = llvm::LLVMMDStringInContext(
-                        &self.llcx,
+                        self.llcx,
                         alloc.bytes.as_ptr() as *const _,
                         alloc.bytes.len() as c_uint,
                     );
                     let data = [section, alloc];
-                    let meta = llvm::LLVMMDNodeInContext(&self.llcx, data.as_ptr(), 2);
+                    let meta = llvm::LLVMMDNodeInContext(self.llcx, data.as_ptr(), 2);
                     llvm::LLVMAddNamedMetadataOperand(
-                        &self.llmod,
+                        self.llmod,
                         "wasm.custom_sections\0".as_ptr() as *const _,
                         meta,
                     );
@@ -439,8 +439,8 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> {
 
             if attrs.flags.contains(CodegenFnAttrFlags::USED) {
                 // This static will be stored in the llvm.used variable which is an array of i8*
-                let cast = llvm::LLVMConstPointerCast(g, &self.type_i8p());
-                &self.used_statics.borrow_mut().push(cast);
+                let cast = llvm::LLVMConstPointerCast(g, self.type_i8p());
+                self.used_statics.borrow_mut().push(cast);
             }
         }
     }
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs
index 896fb9e6e43..cd0c2ffacd5 100644
--- a/src/librustc_codegen_llvm/context.rs
+++ b/src/librustc_codegen_llvm/context.rs
@@ -339,52 +339,52 @@ impl IntrinsicDeclarationMethods for CodegenCx<'b, 'tcx> {
         macro_rules! ifn {
             ($name:expr, fn() -> $ret:expr) => (
                 if key == $name {
-                    let f = declare::declare_cfn(&self, $name, &self.type_func(&[], $ret));
+                    let f = declare::declare_cfn(&self, $name, self.type_func(&[], $ret));
                     llvm::SetUnnamedAddr(f, false);
-                    &self.intrinsics.borrow_mut().insert($name, f.clone());
+                    self.intrinsics.borrow_mut().insert($name, f.clone());
                     return Some(f);
                 }
             );
             ($name:expr, fn(...) -> $ret:expr) => (
                 if key == $name {
-                    let f = declare::declare_cfn(&self, $name, &self.type_variadic_func(&[], $ret));
+                    let f = declare::declare_cfn(&self, $name, self.type_variadic_func(&[], $ret));
                     llvm::SetUnnamedAddr(f, false);
-                    &self.intrinsics.borrow_mut().insert($name, f.clone());
+                    self.intrinsics.borrow_mut().insert($name, f.clone());
                     return Some(f);
                 }
             );
             ($name:expr, fn($($arg:expr),*) -> $ret:expr) => (
                 if key == $name {
-                    let f = declare::declare_cfn(&self, $name, &self.type_func(&[$($arg),*], $ret));
+                    let f = declare::declare_cfn(&self, $name, self.type_func(&[$($arg),*], $ret));
                     llvm::SetUnnamedAddr(f, false);
-                    &self.intrinsics.borrow_mut().insert($name, f.clone());
+                    self.intrinsics.borrow_mut().insert($name, f.clone());
                     return Some(f);
                 }
             );
         }
         macro_rules! mk_struct {
-            ($($field_ty:expr),*) => (&self.type_struct( &[$($field_ty),*], false))
+            ($($field_ty:expr),*) => (self.type_struct( &[$($field_ty),*], false))
         }
 
-        let i8p = &self.type_i8p();
-        let void = &self.type_void();
-        let i1 = &self.type_i1();
-        let t_i8 = &self.type_i8();
-        let t_i16 = &self.type_i16();
-        let t_i32 = &self.type_i32();
-        let t_i64 = &self.type_i64();
-        let t_i128 = &self.type_i128();
-        let t_f32 = &self.type_f32();
-        let t_f64 = &self.type_f64();
-
-        let t_v2f32 = &self.type_vector(t_f32, 2);
-        let t_v4f32 = &self.type_vector(t_f32, 4);
-        let t_v8f32 = &self.type_vector(t_f32, 8);
-        let t_v16f32 = &self.type_vector(t_f32, 16);
-
-        let t_v2f64 = &self.type_vector(t_f64, 2);
-        let t_v4f64 = &self.type_vector(t_f64, 4);
-        let t_v8f64 = &self.type_vector(t_f64, 8);
+        let i8p = self.type_i8p();
+        let void = self.type_void();
+        let i1 = self.type_i1();
+        let t_i8 = self.type_i8();
+        let t_i16 = self.type_i16();
+        let t_i32 = self.type_i32();
+        let t_i64 = self.type_i64();
+        let t_i128 = self.type_i128();
+        let t_f32 = self.type_f32();
+        let t_f64 = self.type_f64();
+
+        let t_v2f32 = self.type_vector(t_f32, 2);
+        let t_v4f32 = self.type_vector(t_f32, 4);
+        let t_v8f32 = self.type_vector(t_f32, 8);
+        let t_v16f32 = self.type_vector(t_f32, 16);
+
+        let t_v2f64 = self.type_vector(t_f64, 2);
+        let t_v4f64 = self.type_vector(t_f64, 4);
+        let t_v8f64 = self.type_vector(t_f64, 8);
 
         ifn!("llvm.memset.p0i8.i16", fn(i8p, t_i8, t_i16, t_i32, i1) -> void);
         ifn!("llvm.memset.p0i8.i32", fn(i8p, t_i8, t_i32, t_i32, i1) -> void);
@@ -637,8 +637,8 @@ impl IntrinsicDeclarationMethods for CodegenCx<'b, 'tcx> {
         ifn!("llvm.prefetch", fn(i8p, t_i32, t_i32, t_i32) -> void);
 
         if self.sess().opts.debuginfo != DebugInfo::None {
-            ifn!("llvm.dbg.declare", fn(&self.type_metadata(), &self.type_metadata()) -> void);
-            ifn!("llvm.dbg.value", fn(&self.type_metadata(), t_i64, &self.type_metadata()) -> void);
+            ifn!("llvm.dbg.declare", fn(self.type_metadata(), self.type_metadata()) -> void);
+            ifn!("llvm.dbg.value", fn(self.type_metadata(), t_i64, self.type_metadata()) -> void);
         }
         return None;
     }
@@ -694,7 +694,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
                 } else {
                     "rust_eh_personality"
                 };
-                let fty = &self.type_variadic_func(&[], &self.type_i32());
+                let fty = self.type_variadic_func(&[], self.type_i32());
                 declare::declare_cfn(self, name, fty)
             }
         };