about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-12-02 15:58:40 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2019-03-29 17:17:12 +0100
commita3fa1161d22f5055e28340cd6c00d1451e4d9572 (patch)
treeb1d15f3cb18735d95f70ed08135e08b1b66c2353 /src/librustc_codegen_llvm
parenta0056333f12ae3b916fbd0a14c1b641460140797 (diff)
downloadrust-a3fa1161d22f5055e28340cd6c00d1451e4d9572.tar.gz
rust-a3fa1161d22f5055e28340cd6c00d1451e4d9572.zip
Remove const_{fat_ptr,array,vector,bytes} from cg_ssa
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/common.rs54
1 files changed, 28 insertions, 26 deletions
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs
index 4bd036ea3b1..aab0d8ac602 100644
--- a/src/librustc_codegen_llvm/common.rs
+++ b/src/librustc_codegen_llvm/common.rs
@@ -93,6 +93,34 @@ impl BackendTypes for CodegenCx<'ll, 'tcx> {
     type DIScope = &'ll llvm::debuginfo::DIScope;
 }
 
+impl CodegenCx<'ll, 'tcx> {
+    pub fn const_fat_ptr(
+        &self,
+        ptr: &'ll Value,
+        meta: &'ll Value
+    ) -> &'ll Value {
+        assert_eq!(abi::FAT_PTR_ADDR, 0);
+        assert_eq!(abi::FAT_PTR_EXTRA, 1);
+        self.const_struct(&[ptr, meta], false)
+    }
+
+    pub fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
+        unsafe {
+            return llvm::LLVMConstArray(ty, elts.as_ptr(), elts.len() as c_uint);
+        }
+    }
+
+    pub fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
+        unsafe {
+            return llvm::LLVMConstVector(elts.as_ptr(), elts.len() as c_uint);
+        }
+    }
+
+    pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
+        bytes_in_context(self.llcx, bytes)
+    }
+}
+
 impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
     fn const_null(&self, t: &'ll Type) -> &'ll Value {
         unsafe {
@@ -189,16 +217,6 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
         self.const_fat_ptr(cs, self.const_usize(len as u64))
     }
 
-    fn const_fat_ptr(
-        &self,
-        ptr: &'ll Value,
-        meta: &'ll Value
-    ) -> &'ll Value {
-        assert_eq!(abi::FAT_PTR_ADDR, 0);
-        assert_eq!(abi::FAT_PTR_EXTRA, 1);
-        self.const_struct(&[ptr, meta], false)
-    }
-
     fn const_struct(
         &self,
         elts: &[&'ll Value],
@@ -207,22 +225,6 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
         struct_in_context(self.llcx, elts, packed)
     }
 
-    fn const_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
-        unsafe {
-            return llvm::LLVMConstArray(ty, elts.as_ptr(), elts.len() as c_uint);
-        }
-    }
-
-    fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
-        unsafe {
-            return llvm::LLVMConstVector(elts.as_ptr(), elts.len() as c_uint);
-        }
-    }
-
-    fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
-        bytes_in_context(self.llcx, bytes)
-    }
-
     fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value {
         unsafe {
             assert_eq!(idx as c_uint as u64, idx);