summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/common.rs
diff options
context:
space:
mode:
authorDenis Merigoux <denis.merigoux@gmail.com>2018-09-06 14:44:51 -0700
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-16 14:11:59 +0200
commita1d0d4f9439640d8694ebb7fa905f4e328d5febd (patch)
tree447f51146f100f004852565c52e10e7b3eabb260 /src/librustc_codegen_llvm/common.rs
parente224f063e8b7ea16302d0b048b9272dfe8465734 (diff)
downloadrust-a1d0d4f9439640d8694ebb7fa905f4e328d5febd.tar.gz
rust-a1d0d4f9439640d8694ebb7fa905f4e328d5febd.zip
Removing LLVM content from CommonMethods -> ConstMethods
Diffstat (limited to 'src/librustc_codegen_llvm/common.rs')
-rw-r--r--src/librustc_codegen_llvm/common.rs32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs
index fb049b0c9a8..6783807e563 100644
--- a/src/librustc_codegen_llvm/common.rs
+++ b/src/librustc_codegen_llvm/common.rs
@@ -24,7 +24,7 @@ use declare;
 use type_::Type;
 use type_of::LayoutLlvmExt;
 use value::Value;
-use interfaces::{Backend, CommonMethods, CommonWriteMethods, TypeMethods};
+use interfaces::{Backend, ConstMethods, TypeMethods};
 
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::layout::{HasDataLayout, LayoutOf};
@@ -201,7 +201,7 @@ impl Backend for CodegenCx<'ll, 'tcx> {
     type Context = &'ll llvm::Context;
 }
 
-impl<'ll, 'tcx: 'll> CommonMethods for CodegenCx<'ll, 'tcx> {
+impl<'ll, 'tcx: 'll> ConstMethods for CodegenCx<'ll, 'tcx> {
 
     // LLVM constant constructors.
     fn const_null(&self, t: &'ll Type) -> &'ll Value {
@@ -319,7 +319,7 @@ impl<'ll, 'tcx: 'll> CommonMethods for CodegenCx<'ll, 'tcx> {
         elts: &[&'ll Value],
         packed: bool
     ) -> &'ll Value {
-        &self.const_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 {
@@ -335,7 +335,7 @@ impl<'ll, 'tcx: 'll> CommonMethods for CodegenCx<'ll, 'tcx> {
     }
 
     fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
-        &self.const_bytes_in_context(&self.llcx, bytes)
+        bytes_in_context(&self.llcx, bytes)
     }
 
     fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {
@@ -406,14 +406,14 @@ pub fn val_ty(v: &'ll Value) -> &'ll Type {
     }
 }
 
-pub fn const_bytes_in_context(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
+pub fn bytes_in_context(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
     unsafe {
         let ptr = bytes.as_ptr() as *const c_char;
         return llvm::LLVMConstStringInContext(llcx, ptr, bytes.len() as c_uint, True);
     }
 }
 
-pub fn const_struct_in_context(
+pub fn struct_in_context(
     llcx: &'a llvm::Context,
     elts: &[&'a Value],
     packed: bool,
@@ -425,26 +425,6 @@ pub fn const_struct_in_context(
     }
 }
 
-impl<'ll, 'tcx: 'll> CommonWriteMethods for CodegenCx<'ll, 'tcx> {
-    fn val_ty(&self, v: &'ll Value) -> &'ll Type {
-        val_ty(v)
-    }
-
-    fn const_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
-        const_bytes_in_context(llcx, bytes)
-    }
-
-    fn const_struct_in_context(
-        &self,
-        llcx: &'a llvm::Context,
-        elts: &[&'a Value],
-        packed: bool,
-    ) -> &'a Value {
-        const_struct_in_context(llcx, elts, packed)
-    }
-}
-
-
 #[inline]
 fn hi_lo_to_u128(lo: u64, hi: u64) -> u128 {
     ((hi as u128) << 64) | (lo as u128)