]> git.lizzy.rs Git - rust.git/commitdiff
Prefixed const methods with "const" instead of "c"
authorDenis Merigoux <denis.merigoux@gmail.com>
Thu, 6 Sep 2018 18:57:42 +0000 (11:57 -0700)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 16 Nov 2018 12:11:59 +0000 (14:11 +0200)
19 files changed:
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/asm.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/common.rs
src/librustc_codegen_llvm/debuginfo/gdb.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/glue.rs
src/librustc_codegen_llvm/interfaces/common.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/meth.rs
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/constant.rs
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/operand.rs
src/librustc_codegen_llvm/mir/place.rs
src/librustc_codegen_llvm/mir/rvalue.rs

index f07ec35049bb5a5ec9f64f995905724ce04699c9..edd1ff59a01e5eb3922adceea9a313835314c912 100644 (file)
@@ -244,7 +244,7 @@ fn store(
                                   self.layout.align,
                                   bx.pointercast(llscratch, cx.i8p()),
                                   scratch_align,
-                                  cx.c_usize(self.layout.size.bytes()),
+                                  cx.const_usize(self.layout.size.bytes()),
                                   MemFlags::empty());
 
                 bx.lifetime_end(llscratch, scratch_size);
index 15eceaf405f7f01ad585597ba3b5ea658598b2cb..fcf2ea8f8fa23921678461419a9b7550de749f51 100644 (file)
@@ -110,7 +110,7 @@ pub fn codegen_inline_asm(
         let kind = llvm::LLVMGetMDKindIDInContext(bx.cx().llcx,
             key.as_ptr() as *const c_char, key.len() as c_uint);
 
-        let val: &'ll Value = bx.cx().c_i32(ia.ctxt.outer().as_u32() as i32);
+        let val: &'ll Value = bx.cx().const_i32(ia.ctxt.outer().as_u32() as i32);
 
         llvm::LLVMSetMetadata(r, kind,
             llvm::LLVMMDNodeInContext(bx.cx().llcx, &val, 1));
index 7f1dafbe1611f36fe0a53ab0652bd2e0e3977502..9eaafb1c21d3ed0acf1fe18eca78a8b06f3f083a 100644 (file)
@@ -442,17 +442,17 @@ fn val_ty(&self, v: &'ll Value) -> &'ll Type {
         common::val_ty(v)
     }
 
-    fn c_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
-        common::c_bytes_in_context(llcx, bytes)
+    fn const_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
+        common::const_bytes_in_context(llcx, bytes)
     }
 
-    fn c_struct_in_context(
+    fn const_struct_in_context(
         &self,
         llcx: &'a llvm::Context,
         elts: &[&'a Value],
         packed: bool,
     ) -> &'a Value {
-        common::c_struct_in_context(llcx, elts, packed)
+        common::const_struct_in_context(llcx, elts, packed)
     }
 }
 
@@ -926,7 +926,7 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext,
                         llcx: &llvm::Context,
                         llmod: &llvm::Module,
                         bitcode: Option<&[u8]>) {
-    let llconst = cgcx.c_bytes_in_context(llcx, bitcode.unwrap_or(&[]));
+    let llconst = cgcx.const_bytes_in_context(llcx, bitcode.unwrap_or(&[]));
     let llglobal = llvm::LLVMAddGlobal(
         llmod,
         cgcx.val_ty(llconst),
@@ -946,7 +946,7 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext,
     llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage);
     llvm::LLVMSetGlobalConstant(llglobal, llvm::True);
 
-    let llconst = cgcx.c_bytes_in_context(llcx, &[]);
+    let llconst = cgcx.const_bytes_in_context(llcx, &[]);
     let llglobal = llvm::LLVMAddGlobal(
         llmod,
         cgcx.val_ty(llconst),
index df0e47621a0532b017c692472f970414636ad79e..6d75d64124b8398f7263bb05397f94b1b761ca26 100644 (file)
@@ -198,7 +198,7 @@ pub fn unsized_info(
     let (source, target) = cx.tcx.struct_lockstep_tails(source, target);
     match (&source.sty, &target.sty) {
         (&ty::Array(_, len), &ty::Slice(_)) => {
-            cx.c_usize(len.unwrap_usize(cx.tcx))
+            cx.const_usize(len.unwrap_usize(cx.tcx))
         }
         (&ty::Dynamic(..), &ty::Dynamic(..)) => {
             // For now, upcasts are limited to changes in marker
@@ -460,7 +460,7 @@ pub fn memcpy_ty<'a, 'll: 'a, 'tcx: 'll>(
         return;
     }
 
-    call_memcpy(bx, dst, dst_align, src, src_align, bx.cx().c_usize(size), flags);
+    call_memcpy(bx, dst, dst_align, src, src_align, bx.cx().const_usize(size), flags);
 }
 
 pub fn call_memset(
@@ -474,7 +474,7 @@ pub fn call_memset(
     let ptr_width = &bx.cx().sess().target.target.target_pointer_width;
     let intrinsic_key = format!("llvm.memset.p0i8.i{}", ptr_width);
     let llintrinsicfn = bx.cx().get_intrinsic(&intrinsic_key);
-    let volatile = bx.cx().c_bool(volatile);
+    let volatile = bx.cx().const_bool(volatile);
     bx.call(llintrinsicfn, &[ptr, fill_byte, size, align, volatile], None)
 }
 
@@ -649,8 +649,8 @@ enum MetadataKind {
     DeflateEncoder::new(&mut compressed, Compression::fast())
         .write_all(&metadata.raw_data).unwrap();
 
-    let llmeta = llvm_module.c_bytes_in_context(metadata_llcx, &compressed);
-    let llconst = llvm_module.c_struct_in_context(metadata_llcx, &[llmeta], false);
+    let llmeta = llvm_module.const_bytes_in_context(metadata_llcx, &compressed);
+    let llconst = llvm_module.const_struct_in_context(metadata_llcx, &[llmeta], false);
     let name = exported_symbols::metadata_symbol_name(tcx);
     let buf = CString::new(name).unwrap();
     let llglobal = unsafe {
@@ -1151,7 +1151,7 @@ fn module_codegen<'a, 'tcx>(
             if !cx.used_statics.borrow().is_empty() {
                 let name = const_cstr!("llvm.used");
                 let section = const_cstr!("llvm.metadata");
-                let array = cx.c_array(&cx.ptr_to(cx.i8()), &*cx.used_statics.borrow());
+                let array = cx.const_array(&cx.ptr_to(cx.i8()), &*cx.used_statics.borrow());
 
                 unsafe {
                     let g = llvm::LLVMAddGlobal(cx.llmod,
index 1d3ef94f1552c156bd4ea1eaa174a90a08df5acb..ef7f29ac7ddc8d23e6fccef94ee94bb983b6bdd3 100644 (file)
@@ -530,8 +530,8 @@ fn range_metadata(&self, load: &'ll Value, range: Range<u128>) {
         unsafe {
             let llty = self.cx.val_ty(load);
             let v = [
-                self.cx.c_uint_big(llty, range.start),
-                self.cx.c_uint_big(llty, range.end)
+                self.cx.const_uint_big(llty, range.start),
+                self.cx.const_uint_big(llty, range.end)
             ];
 
             llvm::LLVMSetMetadata(load, llvm::MD_range as c_uint,
@@ -578,7 +578,7 @@ fn store_with_flags(
                 // *always* point to a metadata value of the integer 1.
                 //
                 // [1]: http://llvm.org/docs/LangRef.html#store-instruction
-                let one = self.cx.c_i32(1);
+                let one = self.cx.const_i32(1);
                 let node = llvm::LLVMMDNodeInContext(self.cx.llcx, &one, 1);
                 llvm::LLVMSetMetadata(store, llvm::MD_nontemporal as c_uint, node);
             }
@@ -862,9 +862,9 @@ 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().vector(elt_ty, num_elts as u64));
-            let vec = self.insert_element(undef, elt, self.cx.c_i32(0));
+            let vec = self.insert_element(undef, elt, self.cx.const_i32(0));
             let vec_i32_ty = &self.cx().vector(&self.cx().i32(), num_elts as u64);
-            self.shuffle_vector(vec, undef, self.cx().c_null(vec_i32_ty))
+            self.shuffle_vector(vec, undef, self.cx().const_null(vec_i32_ty))
         }
     }
 
@@ -1228,7 +1228,7 @@ fn call_lifetime_intrinsic(&self, intrinsic: &str, ptr: &'ll Value, size: Size)
         let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic);
 
         let ptr = self.pointercast(ptr, self.cx.i8p());
-        self.call(lifetime_intrinsic, &[self.cx.c_u64(size), ptr], None);
+        self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None);
     }
 
     fn call(&self, llfn: &'ll Value, args: &[&'ll Value],
index e31c5f1cae43f81e71e1ca2ae487b0da672dc71f..db4d732ff142720c4d43d614dcefa4082f8a360d 100644 (file)
@@ -204,71 +204,71 @@ impl Backend for CodegenCx<'ll, 'tcx> {
 impl<'ll, 'tcx: 'll> CommonMethods for CodegenCx<'ll, 'tcx> {
 
     // LLVM constant constructors.
-    fn c_null(&self, t: &'ll Type) -> &'ll Value {
+    fn const_null(&self, t: &'ll Type) -> &'ll Value {
         unsafe {
             llvm::LLVMConstNull(t)
         }
     }
 
-    fn c_undef(&self, t: &'ll Type) -> &'ll Value {
+    fn const_undef(&self, t: &'ll Type) -> &'ll Value {
         unsafe {
             llvm::LLVMGetUndef(t)
         }
     }
 
-    fn c_int(&self, t: &'ll Type, i: i64) -> &'ll Value {
+    fn const_int(&self, t: &'ll Type, i: i64) -> &'ll Value {
         unsafe {
             llvm::LLVMConstInt(t, i as u64, True)
         }
     }
 
-    fn c_uint(&self, t: &'ll Type, i: u64) -> &'ll Value {
+    fn const_uint(&self, t: &'ll Type, i: u64) -> &'ll Value {
         unsafe {
             llvm::LLVMConstInt(t, i, False)
         }
     }
 
-    fn c_uint_big(&self, t: &'ll Type, u: u128) -> &'ll Value {
+    fn const_uint_big(&self, t: &'ll Type, u: u128) -> &'ll Value {
         unsafe {
             let words = [u as u64, (u >> 64) as u64];
             llvm::LLVMConstIntOfArbitraryPrecision(t, 2, words.as_ptr())
         }
     }
 
-    fn c_bool(&self, val: bool) -> &'ll Value {
-        &self.c_uint(&self.i1(), val as u64)
+    fn const_bool(&self, val: bool) -> &'ll Value {
+        &self.const_uint(&self.i1(), val as u64)
     }
 
-    fn c_i32(&self, i: i32) -> &'ll Value {
-        &self.c_int(&self.i32(), i as i64)
+    fn const_i32(&self, i: i32) -> &'ll Value {
+        &self.const_int(&self.i32(), i as i64)
     }
 
-    fn c_u32(&self, i: u32) -> &'ll Value {
-        &self.c_uint(&self.i32(), i as u64)
+    fn const_u32(&self, i: u32) -> &'ll Value {
+        &self.const_uint(&self.i32(), i as u64)
     }
 
-    fn c_u64(&self, i: u64) -> &'ll Value {
-        &self.c_uint(&self.i64(), i)
+    fn const_u64(&self, i: u64) -> &'ll Value {
+        &self.const_uint(&self.i64(), i)
     }
 
-    fn c_usize(&self, i: u64) -> &'ll Value {
+    fn const_usize(&self, i: u64) -> &'ll Value {
         let bit_size = self.data_layout().pointer_size.bits();
         if bit_size < 64 {
             // make sure it doesn't overflow
             assert!(i < (1<<bit_size));
         }
 
-        &self.c_uint(&self.isize_ty, i)
+        &self.const_uint(&self.isize_ty, i)
     }
 
-    fn c_u8(&self, i: u8) -> &'ll Value {
-        &self.c_uint(&self.i8(), i as u64)
+    fn const_u8(&self, i: u8) -> &'ll Value {
+        &self.const_uint(&self.i8(), i as u64)
     }
 
 
     // This is a 'c-like' raw string, which differs from
     // our boxed-and-length-annotated strings.
-    fn c_cstr(
+    fn const_cstr(
         &self,
         s: LocalInternedString,
         null_terminated: bool,
@@ -297,45 +297,45 @@ fn c_cstr(
 
     // NB: Do not use `do_spill_noroot` to make this into a constant string, or
     // you will be kicked off fast isel. See issue #4352 for an example of this.
-    fn c_str_slice(&self, s: LocalInternedString) -> &'ll Value {
+    fn const_str_slice(&self, s: LocalInternedString) -> &'ll Value {
         let len = s.len();
-        let cs = consts::ptrcast(&self.c_cstr(s, false),
+        let cs = consts::ptrcast(&self.const_cstr(s, false),
             &self.ptr_to(&self.layout_of(&self.tcx.mk_str()).llvm_type(&self)));
-        &self.c_fat_ptr(cs, &self.c_usize(len as u64))
+        &self.const_fat_ptr(cs, &self.const_usize(len as u64))
     }
 
-    fn c_fat_ptr(
+    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.c_struct(&[ptr, meta], false)
+        &self.const_struct(&[ptr, meta], false)
     }
 
-    fn c_struct(
+    fn const_struct(
         &self,
         elts: &[&'ll Value],
         packed: bool
     ) -> &'ll Value {
-        &self.c_struct_in_context(&self.llcx, elts, packed)
+        &self.const_struct_in_context(&self.llcx, elts, packed)
     }
 
-    fn c_array(&self, ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value {
+    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 c_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
+    fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
         unsafe {
             return llvm::LLVMConstVector(elts.as_ptr(), elts.len() as c_uint);
         }
     }
 
-    fn c_bytes(&self, bytes: &[u8]) -> &'ll Value {
-        &self.c_bytes_in_context(&self.llcx, bytes)
+    fn const_bytes(&self, bytes: &[u8]) -> &'ll Value {
+        &self.const_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 c_bytes_in_context(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
+pub fn const_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 c_struct_in_context(
+pub fn const_struct_in_context(
     llcx: &'a llvm::Context,
     elts: &[&'a Value],
     packed: bool,
@@ -430,17 +430,17 @@ fn val_ty(&self, v: &'ll Value) -> &'ll Type {
         val_ty(v)
     }
 
-    fn c_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
-        c_bytes_in_context(llcx, bytes)
+    fn const_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
+        const_bytes_in_context(llcx, bytes)
     }
 
-    fn c_struct_in_context(
+    fn const_struct_in_context(
         &self,
         llcx: &'a llvm::Context,
         elts: &[&'a Value],
         packed: bool,
     ) -> &'a Value {
-        c_struct_in_context(llcx, elts, packed)
+        const_struct_in_context(llcx, elts, packed)
     }
 }
 
@@ -511,9 +511,9 @@ pub fn shift_mask_val(
             // i8/u8 can shift by at most 7, i16/u16 by at most 15, etc.
             let val = bx.cx().int_width(llty) - 1;
             if invert {
-                bx.cx.c_int(mask_llty, !val as i64)
+                bx.cx.const_int(mask_llty, !val as i64)
             } else {
-                bx.cx.c_uint(mask_llty, val)
+                bx.cx.const_uint(mask_llty, val)
             }
         },
         TypeKind::Vector => {
index 35b17a265a45494448c2e16d9e11f3495cf16cff..f7e4d80d109e92eaec2fbf2094b80a27e84f1378 100644 (file)
@@ -29,7 +29,7 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &Builder) {
         let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx.cx());
         // Load just the first byte as that's all that's necessary to force
         // LLVM to keep around the reference to the global.
-        let indices = [bx.cx().c_i32(0), bx.cx().c_i32(0)];
+        let indices = [bx.cx().const_i32(0), bx.cx().const_i32(0)];
         let element = bx.inbounds_gep(gdb_debug_scripts_section, &indices);
         let volative_load_instruction = bx.volatile_load(element);
         unsafe {
@@ -63,7 +63,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>)
                 bug!("symbol `{}` is already defined", section_var_name)
             });
             llvm::LLVMSetSection(section_var, section_name.as_ptr() as *const _);
-            llvm::LLVMSetInitializer(section_var, cx.c_bytes(section_contents));
+            llvm::LLVMSetInitializer(section_var, cx.const_bytes(section_contents));
             llvm::LLVMSetGlobalConstant(section_var, llvm::True);
             llvm::LLVMSetUnnamedAddr(section_var, llvm::True);
             llvm::LLVMRustSetLinkage(section_var, llvm::Linkage::LinkOnceODRLinkage);
index e0bada7e8860a9457772761570b687bf6431d0c6..14b263380eb45ad69a7f6d29b6d0e834ef93e929 100644 (file)
@@ -1811,7 +1811,7 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>,
                     member_description.offset.bits(),
                     match member_description.discriminant {
                         None => None,
-                        Some(value) => Some(cx.c_u64(value)),
+                        Some(value) => Some(cx.const_u64(value)),
                     },
                     member_description.flags,
                     member_description.type_metadata))
index 8e0fbe08c34aa01c074bd94c361630b3d71e5778..fa2514b0ce895c4d157be9ea6fcaf5cf4a116418 100644 (file)
@@ -33,8 +33,8 @@ pub fn size_and_align_of_dst(
         let (size, align) = bx.cx().size_and_align_of(t);
         debug!("size_and_align_of_dst t={} info={:?} size: {:?} align: {:?}",
                t, info, size, align);
-        let size = bx.cx().c_usize(size.bytes());
-        let align = bx.cx().c_usize(align.abi());
+        let size = bx.cx().const_usize(size.bytes());
+        let align = bx.cx().const_usize(align.abi());
         return (size, align);
     }
     match t.sty {
@@ -48,8 +48,8 @@ pub fn size_and_align_of_dst(
             // The info in this case is the length of the str, so the size is that
             // times the unit size.
             let (size, align) = bx.cx().size_and_align_of(unit);
-            (bx.mul(info.unwrap(), bx.cx().c_usize(size.bytes())),
-             bx.cx().c_usize(align.abi()))
+            (bx.mul(info.unwrap(), bx.cx().const_usize(size.bytes())),
+             bx.cx().const_usize(align.abi()))
         }
         _ => {
             let cx = bx.cx();
@@ -65,8 +65,8 @@ pub fn size_and_align_of_dst(
             let sized_align = layout.align.abi();
             debug!("DST {} statically sized prefix size: {} align: {}",
                    t, sized_size, sized_align);
-            let sized_size = cx.c_usize(sized_size);
-            let sized_align = cx.c_usize(sized_align);
+            let sized_size = cx.const_usize(sized_size);
+            let sized_align = cx.const_usize(sized_align);
 
             // Recurse to get the size of the dynamically sized field (must be
             // the last field).
@@ -97,7 +97,7 @@ pub fn size_and_align_of_dst(
                 (Some(sized_align), Some(unsized_align)) => {
                     // If both alignments are constant, (the sized_align should always be), then
                     // pick the correct alignment statically.
-                    cx.c_usize(std::cmp::max(sized_align, unsized_align) as u64)
+                    cx.const_usize(std::cmp::max(sized_align, unsized_align) as u64)
                 }
                 _ => bx.select(bx.icmp(IntPredicate::IntUGT, sized_align, unsized_align),
                                sized_align,
@@ -115,7 +115,7 @@ pub fn size_and_align_of_dst(
             //
             //   `(size + (align-1)) & -align`
 
-            let addend = bx.sub(align, bx.cx().c_usize(1));
+            let addend = bx.sub(align, bx.cx().const_usize(1));
             let size = bx.and(bx.add(size, addend), bx.neg(align));
 
             (size, align)
index 35f588368fe1ec3a764fb799b2058a3d543e6c97..04b2d18db9506289c73e4ae4ccdc2f875acb1b8d 100644 (file)
 
 pub trait CommonMethods: Backend + CommonWriteMethods {
     // Constant constructors
-    fn c_null(&self, t: Self::Type) -> Self::Value;
-    fn c_undef(&self, t: Self::Type) -> Self::Value;
-    fn c_int(&self, t: Self::Type, i: i64) -> Self::Value;
-    fn c_uint(&self, t: Self::Type, i: u64) -> Self::Value;
-    fn c_uint_big(&self, t: Self::Type, u: u128) -> Self::Value;
-    fn c_bool(&self, val: bool) -> Self::Value;
-    fn c_i32(&self, i: i32) -> Self::Value;
-    fn c_u32(&self, i: u32) -> Self::Value;
-    fn c_u64(&self, i: u64) -> Self::Value;
-    fn c_usize(&self, i: u64) -> Self::Value;
-    fn c_u8(&self, i: u8) -> Self::Value;
-    fn c_cstr(
+    fn const_null(&self, t: Self::Type) -> Self::Value;
+    fn const_undef(&self, t: Self::Type) -> Self::Value;
+    fn const_int(&self, t: Self::Type, i: i64) -> Self::Value;
+    fn const_uint(&self, t: Self::Type, i: u64) -> Self::Value;
+    fn const_uint_big(&self, t: Self::Type, u: u128) -> Self::Value;
+    fn const_bool(&self, val: bool) -> Self::Value;
+    fn const_i32(&self, i: i32) -> Self::Value;
+    fn const_u32(&self, i: u32) -> Self::Value;
+    fn const_u64(&self, i: u64) -> Self::Value;
+    fn const_usize(&self, i: u64) -> Self::Value;
+    fn const_u8(&self, i: u8) -> Self::Value;
+    fn const_cstr(
         &self,
         s: LocalInternedString,
         null_terminated: bool,
     ) -> Self::Value;
-    fn c_str_slice(&self, s: LocalInternedString) -> Self::Value;
-    fn c_fat_ptr(
+    fn const_str_slice(&self, s: LocalInternedString) -> Self::Value;
+    fn const_fat_ptr(
         &self,
         ptr: Self::Value,
         meta: Self::Value
     ) -> Self::Value;
-    fn c_struct(
+    fn const_struct(
         &self,
         elts: &[Self::Value],
         packed: bool
     ) -> Self::Value;
-    fn c_array(&self, ty: Self::Type, elts: &[Self::Value]) -> Self::Value;
-    fn c_vector(&self, elts: &[Self::Value]) -> Self::Value;
-    fn c_bytes(&self, bytes: &[u8]) -> Self::Value;
+    fn const_array(&self, ty: Self::Type, elts: &[Self::Value]) -> Self::Value;
+    fn const_vector(&self, elts: &[Self::Value]) -> Self::Value;
+    fn const_bytes(&self, bytes: &[u8]) -> Self::Value;
 
     fn const_get_elt(&self, v: Self::Value, idx: u64) -> Self::Value;
     fn const_get_real(&self, v: Self::Value) -> Option<(f64, bool)>;
@@ -55,8 +55,8 @@ fn c_struct(
 
 pub trait CommonWriteMethods: Backend {
         fn val_ty(&self, v: Self::Value) -> Self::Type;
-        fn c_bytes_in_context(&self, llcx: Self::Context, bytes: &[u8]) -> Self::Value;
-        fn c_struct_in_context(
+        fn const_bytes_in_context(&self, llcx: Self::Context, bytes: &[u8]) -> Self::Value;
+        fn const_struct_in_context(
             &self,
             llcx: Self::Context,
             elts: &[Self::Value],
index 6cc6692c3d16b07e578356de7d598125d8424df3..be03dc5e143309eb2a7a5ae43582a03bb53102d1 100644 (file)
@@ -127,11 +127,11 @@ pub fn codegen_intrinsic_call(
         },
         "likely" => {
             let expect = cx.get_intrinsic(&("llvm.expect.i1"));
-            bx.call(expect, &[args[0].immediate(), bx.cx().c_bool(true)], None)
+            bx.call(expect, &[args[0].immediate(), bx.cx().const_bool(true)], None)
         }
         "unlikely" => {
             let expect = cx.get_intrinsic(&("llvm.expect.i1"));
-            bx.call(expect, &[args[0].immediate(), bx.cx().c_bool(false)], None)
+            bx.call(expect, &[args[0].immediate(), bx.cx().const_bool(false)], None)
         }
         "try" => {
             try_intrinsic(bx, cx,
@@ -147,7 +147,7 @@ pub fn codegen_intrinsic_call(
         }
         "size_of" => {
             let tp_ty = substs.type_at(0);
-            cx.c_usize(cx.size_of(tp_ty).bytes())
+            cx.const_usize(cx.size_of(tp_ty).bytes())
         }
         "size_of_val" => {
             let tp_ty = substs.type_at(0);
@@ -156,12 +156,12 @@ pub fn codegen_intrinsic_call(
                     glue::size_and_align_of_dst(bx, tp_ty, Some(meta));
                 llsize
             } else {
-                cx.c_usize(cx.size_of(tp_ty).bytes())
+                cx.const_usize(cx.size_of(tp_ty).bytes())
             }
         }
         "min_align_of" => {
             let tp_ty = substs.type_at(0);
-            cx.c_usize(cx.align_of(tp_ty).abi())
+            cx.const_usize(cx.align_of(tp_ty).abi())
         }
         "min_align_of_val" => {
             let tp_ty = substs.type_at(0);
@@ -170,20 +170,20 @@ pub fn codegen_intrinsic_call(
                     glue::size_and_align_of_dst(bx, tp_ty, Some(meta));
                 llalign
             } else {
-                cx.c_usize(cx.align_of(tp_ty).abi())
+                cx.const_usize(cx.align_of(tp_ty).abi())
             }
         }
         "pref_align_of" => {
             let tp_ty = substs.type_at(0);
-            cx.c_usize(cx.align_of(tp_ty).pref())
+            cx.const_usize(cx.align_of(tp_ty).pref())
         }
         "type_name" => {
             let tp_ty = substs.type_at(0);
             let ty_name = Symbol::intern(&tp_ty.to_string()).as_str();
-            cx.c_str_slice(ty_name)
+            cx.const_str_slice(ty_name)
         }
         "type_id" => {
-            cx.c_u64(cx.tcx.type_id_hash(substs.type_at(0)))
+            cx.const_u64(cx.tcx.type_id_hash(substs.type_at(0)))
         }
         "init" => {
             let ty = substs.type_at(0);
@@ -197,8 +197,8 @@ pub fn codegen_intrinsic_call(
                     false,
                     ty,
                     llresult,
-                    cx.c_u8(0),
-                    cx.c_usize(1)
+                    cx.const_u8(0),
+                    cx.const_usize(1)
                 );
             }
             return;
@@ -210,7 +210,7 @@ pub fn codegen_intrinsic_call(
         "needs_drop" => {
             let tp_ty = substs.type_at(0);
 
-            cx.c_bool(bx.cx().type_needs_drop(tp_ty))
+            cx.const_bool(bx.cx().type_needs_drop(tp_ty))
         }
         "offset" => {
             let ptr = args[0].immediate();
@@ -287,9 +287,9 @@ pub fn codegen_intrinsic_call(
             };
             bx.call(expect, &[
                 args[0].immediate(),
-                cx.c_i32(rw),
+                cx.const_i32(rw),
                 args[1].immediate(),
-                cx.c_i32(cache_type)
+                cx.const_i32(cache_type)
             ], None)
         },
         "ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" | "ctpop" | "bswap" |
@@ -302,12 +302,12 @@ pub fn codegen_intrinsic_call(
                 Some((width, signed)) =>
                     match name {
                         "ctlz" | "cttz" => {
-                            let y = cx.c_bool(false);
+                            let y = cx.const_bool(false);
                             let llfn = cx.get_intrinsic(&format!("llvm.{}.i{}", name, width));
                             bx.call(llfn, &[args[0].immediate(), y], None)
                         }
                         "ctlz_nonzero" | "cttz_nonzero" => {
-                            let y = cx.c_bool(true);
+                            let y = cx.const_bool(true);
                             let llvm_name = &format!("llvm.{}.i{}", &name[..4], width);
                             let llfn = cx.get_intrinsic(llvm_name);
                             bx.call(llfn, &[args[0].immediate(), y], None)
@@ -388,7 +388,7 @@ pub fn codegen_intrinsic_call(
                             } else {
                                 // rotate_left: (X << (S % BW)) | (X >> ((BW - S) % BW))
                                 // rotate_right: (X << ((BW - S) % BW)) | (X >> (S % BW))
-                                let width = cx.c_uint(cx.ix(width), width);
+                                let width = cx.const_uint(cx.ix(width), width);
                                 let shift = bx.urem(raw_shift, width);
                                 let inv_shift = bx.urem(bx.sub(width, raw_shift), width);
                                 let shift1 = bx.shl(val, if is_left { shift } else { inv_shift });
@@ -725,7 +725,7 @@ fn copy_intrinsic(
 ) -> &'ll Value {
     let cx = bx.cx();
     let (size, align) = cx.size_and_align_of(ty);
-    let size = cx.c_usize(size.bytes());
+    let size = cx.const_usize(size.bytes());
     let align = align.abi();
     let dst_ptr = bx.pointercast(dst, cx.i8p());
     let src_ptr = bx.pointercast(src, cx.i8p());
@@ -746,8 +746,8 @@ fn memset_intrinsic(
 ) -> &'ll Value {
     let cx = bx.cx();
     let (size, align) = cx.size_and_align_of(ty);
-    let size = cx.c_usize(size.bytes());
-    let align = cx.c_i32(align.abi() as i32);
+    let size = cx.const_usize(size.bytes());
+    let align = cx.const_i32(align.abi() as i32);
     let dst = bx.pointercast(dst, cx.i8p());
     call_memset(bx, dst, val, bx.mul(size, count), align, volatile)
 }
@@ -763,7 +763,7 @@ fn try_intrinsic(
     if bx.sess().no_landing_pads() {
         bx.call(func, &[data], None);
         let ptr_align = bx.tcx().data_layout.pointer_align;
-        bx.store(cx.c_null(cx.i8p()), dest, ptr_align);
+        bx.store(cx.const_null(cx.i8p()), dest, ptr_align);
     } else if wants_msvc_seh(bx.sess()) {
         codegen_msvc_try(bx, cx, func, data, local_ptr, dest);
     } else {
@@ -844,7 +844,7 @@ fn codegen_msvc_try(
         let slot = bx.alloca(i64p, "slot", ptr_align);
         bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(), None);
 
-        normal.ret(cx.c_i32(0));
+        normal.ret(cx.const_i32(0));
 
         let cs = catchswitch.catch_switch(None, None, 1);
         catchswitch.add_handler(cs, catchpad.llbb());
@@ -854,19 +854,19 @@ fn codegen_msvc_try(
             Some(did) => ::consts::get_static(cx, did),
             None => bug!("msvc_try_filter not defined"),
         };
-        let tok = catchpad.catch_pad(cs, &[tydesc, cx.c_i32(0), slot]);
+        let tok = catchpad.catch_pad(cs, &[tydesc, cx.const_i32(0), slot]);
         let addr = catchpad.load(slot, ptr_align);
 
         let i64_align = bx.tcx().data_layout.i64_align;
         let arg1 = catchpad.load(addr, i64_align);
-        let val1 = cx.c_i32(1);
+        let val1 = cx.const_i32(1);
         let arg2 = catchpad.load(catchpad.inbounds_gep(addr, &[val1]), i64_align);
         let local_ptr = catchpad.bitcast(local_ptr, i64p);
         catchpad.store(arg1, local_ptr, i64_align);
         catchpad.store(arg2, catchpad.inbounds_gep(local_ptr, &[val1]), i64_align);
         catchpad.catch_ret(tok, caught.llbb());
 
-        caught.ret(cx.c_i32(1));
+        caught.ret(cx.const_i32(1));
     });
 
     // Note that no invoke is used here because by definition this function
@@ -922,7 +922,7 @@ fn codegen_gnu_try(
         let data = llvm::get_param(bx.llfn(), 1);
         let local_ptr = llvm::get_param(bx.llfn(), 2);
         bx.invoke(func, &[data], then.llbb(), catch.llbb(), None);
-        then.ret(cx.c_i32(0));
+        then.ret(cx.const_i32(0));
 
         // Type indicator for the exception being thrown.
         //
@@ -932,11 +932,11 @@ fn codegen_gnu_try(
         // rust_try ignores the selector.
         let lpad_ty = cx.struct_(&[cx.i8p(), cx.i32()], false);
         let vals = catch.landing_pad(lpad_ty, bx.cx().eh_personality(), 1);
-        catch.add_clause(vals, bx.cx().c_null(cx.i8p()));
+        catch.add_clause(vals, bx.cx().const_null(cx.i8p()));
         let ptr = catch.extract_value(vals, 0);
         let ptr_align = bx.tcx().data_layout.pointer_align;
         catch.store(ptr, catch.bitcast(local_ptr, cx.ptr_to(cx.i8p())), ptr_align);
-        catch.ret(cx.c_i32(1));
+        catch.ret(cx.const_i32(1));
     });
 
     // Note that no invoke is used here because by definition this function
@@ -1125,18 +1125,18 @@ macro_rules! require_simd {
                                     arg_idx, total_len);
                         None
                     }
-                    Some(idx) => Some(bx.cx().c_i32(idx as i32)),
+                    Some(idx) => Some(bx.cx().const_i32(idx as i32)),
                 }
             })
             .collect();
         let indices = match indices {
             Some(i) => i,
-            None => return Ok(bx.cx().c_null(llret_ty))
+            None => return Ok(bx.cx().const_null(llret_ty))
         };
 
         return Ok(bx.shuffle_vector(args[0].immediate(),
                                     args[1].immediate(),
-                                    bx.cx().c_vector(&indices)))
+                                    bx.cx().const_vector(&indices)))
     }
 
     if name == "simd_insert" {
@@ -1387,7 +1387,7 @@ fn non_ptr(t: ty::Ty) -> ty::Ty {
 
         // Alignment of T, must be a constant integer value:
         let alignment_ty = bx.cx().i32();
-        let alignment = bx.cx().c_i32(bx.cx().align_of(in_elem).abi() as i32);
+        let alignment = bx.cx().const_i32(bx.cx().align_of(in_elem).abi() as i32);
 
         // Truncate the mask vector to a vector of i1s:
         let (mask, mask_ty) = {
@@ -1487,7 +1487,7 @@ fn non_ptr(t: ty::Ty) -> ty::Ty {
 
         // Alignment of T, must be a constant integer value:
         let alignment_ty = bx.cx().i32();
-        let alignment = bx.cx().c_i32(bx.cx().align_of(in_elem).abi() as i32);
+        let alignment = bx.cx().const_i32(bx.cx().align_of(in_elem).abi() as i32);
 
         // Truncate the mask vector to a vector of i1s:
         let (mask, mask_ty) = {
@@ -1565,8 +1565,8 @@ macro_rules! arith_red {
                         } else {
                             // unordered arithmetic reductions do not:
                             match f.bit_width() {
-                                32 => bx.cx().c_undef(bx.cx().f32()),
-                                64 => bx.cx().c_undef(bx.cx().f64()),
+                                32 => bx.cx().const_undef(bx.cx().f32()),
+                                64 => bx.cx().const_undef(bx.cx().f64()),
                                 v => {
                                     return_error!(r#"
 unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
index 4e80fe0b343db9f62ba9266c9fd7cbfeebea95dc..f3dc9ca0002215c83adfc93ba4ced6c4c7f453d7 100644 (file)
@@ -364,17 +364,17 @@ fn val_ty(&self, v: &'ll Value) -> &'ll Type {
         common::val_ty(v)
     }
 
-    fn c_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
-        common::c_bytes_in_context(llcx, bytes)
+    fn const_bytes_in_context(&self, llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value {
+        common::const_bytes_in_context(llcx, bytes)
     }
 
-    fn c_struct_in_context(
+    fn const_struct_in_context(
         &self,
         llcx: &'a llvm::Context,
         elts: &[&'a Value],
         packed: bool,
     ) -> &'a Value {
-        common::c_struct_in_context(llcx, elts, packed)
+        common::const_struct_in_context(llcx, elts, packed)
     }
 }
 
index a8312b2a469d31b1aad0dc6ffaa73cd702189eb5..7f76b9b1efa5499ce40dad2489b73170ad44d04a 100644 (file)
@@ -46,7 +46,7 @@ pub fn get_fn(self, bx: &Builder<'a, 'll, 'tcx>,
         );
         let ptr_align = bx.tcx().data_layout.pointer_align;
         let ptr = bx.load(
-            bx.inbounds_gep(llvtable, &[bx.cx().c_usize(self.0)]),
+            bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]),
             ptr_align
         );
         bx.nonnull_metadata(ptr);
@@ -66,7 +66,7 @@ pub fn get_usize(
         let llvtable = bx.pointercast(llvtable, bx.cx().ptr_to(bx.cx().isize()));
         let usize_align = bx.tcx().data_layout.pointer_align;
         let ptr = bx.load(
-            bx.inbounds_gep(llvtable, &[bx.cx().c_usize(self.0)]),
+            bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]),
             usize_align
         );
         // Vtable loads are invariant
@@ -98,7 +98,7 @@ pub fn get_vtable(
     }
 
     // Not in the cache. Build it.
-    let nullptr = cx.c_null(cx.i8p());
+    let nullptr = cx.const_null(cx.i8p());
 
     let methods = tcx.vtable_methods(trait_ref.with_self_ty(tcx, ty));
     let methods = methods.iter().cloned().map(|opt_mth| {
@@ -114,11 +114,11 @@ pub fn get_vtable(
     // /////////////////////////////////////////////////////////////////////////////////////////////
     let components: Vec<_> = [
         callee::get_fn(cx, monomorphize::resolve_drop_in_place(cx.tcx, ty)),
-        cx.c_usize(size.bytes()),
-        cx.c_usize(align.abi())
+        cx.const_usize(size.bytes()),
+        cx.const_usize(align.abi())
     ].iter().cloned().chain(methods).collect();
 
-    let vtable_const = cx.c_struct(&components, false);
+    let vtable_const = cx.const_struct(&components, false);
     let align = cx.data_layout().pointer_align;
     let vtable = consts::addr_of(cx, vtable_const, align, Some("vtable"));
 
index 810baab48d6637994aaf4df51593139d0d6b6e55..27a0b9c5682bda59346ed2d9c6ba8916c1441865 100644 (file)
@@ -171,7 +171,7 @@ fn codegen_terminator(&mut self,
                     slot.storage_dead(&bx);
 
                     if !bx.sess().target.target.options.custom_unwind_resume {
-                        let mut lp = bx.cx().c_undef(self.landing_pad_type());
+                        let mut lp = bx.cx().const_undef(self.landing_pad_type());
                         lp = bx.insert_value(lp, lp0, 0);
                         lp = bx.insert_value(lp, lp1, 1);
                         bx.resume(lp);
@@ -209,7 +209,7 @@ fn codegen_terminator(&mut self,
                         }
                     } else {
                         let switch_llty = bx.cx().layout_of(switch_ty).immediate_llvm_type(bx.cx());
-                        let llval = bx.cx().c_uint_big(switch_llty, values[0]);
+                        let llval = bx.cx().const_uint_big(switch_llty, values[0]);
                         let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval);
                         bx.cond_br(cmp, lltrue, llfalse);
                     }
@@ -220,7 +220,7 @@ fn codegen_terminator(&mut self,
                                            values.len());
                     let switch_llty = bx.cx().layout_of(switch_ty).immediate_llvm_type(bx.cx());
                     for (&value, target) in values.iter().zip(targets) {
-                        let llval =bx.cx().c_uint_big(switch_llty, value);
+                        let llval =bx.cx().const_uint_big(switch_llty, value);
                         let llbb = llblock(self, *target);
                         bx.add_case(switch, llval, llbb)
                     }
@@ -346,7 +346,7 @@ fn codegen_terminator(&mut self,
 
                 // Pass the condition through llvm.expect for branch hinting.
                 let expect = bx.cx().get_intrinsic(&"llvm.expect.i1");
-                let cond = bx.call(expect, &[cond, bx.cx().c_bool(expected)], None);
+                let cond = bx.call(expect, &[cond, bx.cx().const_bool(expected)], None);
 
                 // Create the failure block and the conditional branch to it.
                 let lltarget = llblock(self, target);
@@ -364,9 +364,9 @@ fn codegen_terminator(&mut self,
                 // Get the location information.
                 let loc = bx.sess().source_map().lookup_char_pos(span.lo());
                 let filename = Symbol::intern(&loc.file.name.to_string()).as_str();
-                let filename = bx.cx().c_str_slice(filename);
-                let line = bx.cx().c_u32(loc.line as u32);
-                let col = bx.cx().c_u32(loc.col.to_usize() as u32 + 1);
+                let filename = bx.cx().const_str_slice(filename);
+                let line = bx.cx().const_u32(loc.line as u32);
+                let col = bx.cx().const_u32(loc.col.to_usize() as u32 + 1);
                 let align = tcx.data_layout.aggregate_align
                     .max(tcx.data_layout.i32_align)
                     .max(tcx.data_layout.pointer_align);
@@ -377,7 +377,7 @@ fn codegen_terminator(&mut self,
                         let len = self.codegen_operand(&mut bx, len).immediate();
                         let index = self.codegen_operand(&mut bx, index).immediate();
 
-                        let file_line_col = bx.cx().c_struct(&[filename, line, col], false);
+                        let file_line_col = bx.cx().const_struct(&[filename, line, col], false);
                         let file_line_col = consts::addr_of(bx.cx(),
                                                             file_line_col,
                                                             align,
@@ -388,8 +388,8 @@ fn codegen_terminator(&mut self,
                     _ => {
                         let str = msg.description();
                         let msg_str = Symbol::intern(str).as_str();
-                        let msg_str = bx.cx().c_str_slice(msg_str);
-                        let msg_file_line_col = bx.cx().c_struct(
+                        let msg_str = bx.cx().const_str_slice(msg_str);
+                        let msg_file_line_col = bx.cx().const_struct(
                             &[msg_str, filename, line, col],
                             false
                         );
@@ -498,9 +498,9 @@ fn codegen_terminator(&mut self,
                 {
                     let loc = bx.sess().source_map().lookup_char_pos(span.lo());
                     let filename = Symbol::intern(&loc.file.name.to_string()).as_str();
-                    let filename = bx.cx.c_str_slice(filename);
-                    let line = bx.cx.c_u32(loc.line as u32);
-                    let col = bx.cx.c_u32(loc.col.to_usize() as u32 + 1);
+                    let filename = bx.cx.const_str_slice(filename);
+                    let line = bx.cx.const_u32(loc.line as u32);
+                    let col = bx.cx.const_u32(loc.col.to_usize() as u32 + 1);
                     let align = tcx.data_layout.aggregate_align
                         .max(tcx.data_layout.i32_align)
                         .max(tcx.data_layout.pointer_align);
@@ -511,8 +511,8 @@ fn codegen_terminator(&mut self,
                         if intrinsic == Some("init") { "zeroed" } else { "uninitialized" }
                     );
                     let msg_str = Symbol::intern(&str).as_str();
-                    let msg_str = bx.cx.c_str_slice(msg_str);
-                    let msg_file_line_col = bx.cx.c_struct(
+                    let msg_str = bx.cx.const_str_slice(msg_str);
+                    let msg_file_line_col = bx.cx.const_struct(
                         &[msg_str, filename, line, col],
                         false,
                     );
@@ -560,7 +560,7 @@ fn codegen_terminator(&mut self,
                     let dest = match ret_dest {
                         _ if fn_ty.ret.is_indirect() => llargs[0],
                         ReturnDest::Nothing => {
-                            bx.cx().c_undef(bx.cx().ptr_to(fn_ty.ret.memory_ty(bx.cx())))
+                            bx.cx().const_undef(bx.cx().ptr_to(fn_ty.ret.memory_ty(bx.cx())))
                         }
                         ReturnDest::IndirectOperand(dst, _) |
                         ReturnDest::Store(dst) => dst.llval,
@@ -741,7 +741,7 @@ fn codegen_argument(&mut self,
                       arg: &ArgType<'tcx, Ty<'tcx>>) {
         // Fill padding with undef value, where applicable.
         if let Some(ty) = arg.pad {
-            llargs.push(bx.cx().c_undef(ty.llvm_type(bx.cx())));
+            llargs.push(bx.cx().const_undef(ty.llvm_type(bx.cx())));
         }
 
         if arg.is_ignore() {
index 4c401a3fdb84a4af8c4d300ae94baad8bb7b75b3..d3640c1934268e25484e975c2aba2447a83eb657 100644 (file)
@@ -40,11 +40,11 @@ pub fn scalar_to_llvm(
     match cv {
         Scalar::Bits { size: 0, .. } => {
             assert_eq!(0, layout.value.size(cx).bytes());
-            cx.c_undef(cx.ix(0))
+            cx.const_undef(cx.ix(0))
         },
         Scalar::Bits { bits, size } => {
             assert_eq!(size as u64, layout.value.size(cx).bytes());
-            let llval = cx.c_uint_big(cx.ix(bitsize), bits);
+            let llval = cx.const_uint_big(cx.ix(bitsize), bits);
             if layout.value == layout::Pointer {
                 unsafe { llvm::LLVMConstIntToPtr(llval, llty) }
             } else {
@@ -73,7 +73,7 @@ pub fn scalar_to_llvm(
             };
             let llval = unsafe { llvm::LLVMConstInBoundsGEP(
                 consts::bitcast(base_addr, cx.i8p()),
-                &cx.c_usize(ptr.offset.bytes()),
+                &cx.const_usize(ptr.offset.bytes()),
                 1,
             ) };
             if layout.value != layout::Pointer {
@@ -96,7 +96,7 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll
         assert_eq!(offset as usize as u64, offset);
         let offset = offset as usize;
         if offset > next_offset {
-            llvals.push(cx.c_bytes(&alloc.bytes[next_offset..offset]));
+            llvals.push(cx.const_bytes(&alloc.bytes[next_offset..offset]));
         }
         let ptr_offset = read_target_uint(
             dl.endian,
@@ -114,10 +114,10 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll
         next_offset = offset + pointer_size;
     }
     if alloc.bytes.len() >= next_offset {
-        llvals.push(cx.c_bytes(&alloc.bytes[next_offset ..]));
+        llvals.push(cx.const_bytes(&alloc.bytes[next_offset ..]));
     }
 
-    cx.c_struct(&llvals, true)
+    cx.const_struct(&llvals, true)
 }
 
 pub fn codegen_static_initializer(
@@ -207,7 +207,7 @@ pub fn simd_shuffle_indices(
                         bug!("simd shuffle field {:?}", field)
                     }
                 }).collect();
-                let llval = bx.cx().c_struct(&values?, false);
+                let llval = bx.cx().const_struct(&values?, false);
                 Ok((llval, c.ty))
             })
             .unwrap_or_else(|_| {
@@ -218,7 +218,7 @@ pub fn simd_shuffle_indices(
                 // We've errored, so we don't have to produce working code.
                 let ty = self.monomorphize(&ty);
                 let llty = bx.cx().layout_of(ty).llvm_type(bx.cx());
-                (bx.cx().c_undef(llty), ty)
+                (bx.cx().const_undef(llty), ty)
             })
     }
 }
index 10282c1053f4644c01661c71c7e49761f20783ee..b4880ed4888a7e4dd4bf512c809cc3a063da538f 100644 (file)
@@ -419,8 +419,8 @@ fn create_funclets(
                 // C++ personality function, but `catch (...)` has no type so
                 // it's null. The 64 here is actually a bitfield which
                 // represents that this is a catch-all block.
-                let null = bx.cx().c_null(bx.cx().i8p());
-                let sixty_four = bx.cx().c_i32(64);
+                let null = bx.cx().const_null(bx.cx().i8p());
+                let sixty_four = bx.cx().const_i32(64);
                 cleanup = cp_bx.catch_pad(cs, &[null, sixty_four, null]);
                 cp_bx.br(llbb);
             }
index 887b8fb0d0fe4b45951a2f9da5bcdda81d9c3184..c2725acbf1234c020aed407e26cfe3665bb79fb7 100644 (file)
@@ -72,7 +72,7 @@ pub fn new_zst(cx: &CodegenCx<'ll, 'tcx>,
                    layout: TyLayout<'tcx>) -> OperandRef<'tcx, &'ll Value> {
         assert!(layout.is_zst());
         OperandRef {
-            val: OperandValue::Immediate(cx.c_undef(layout.immediate_llvm_type(cx))),
+            val: OperandValue::Immediate(cx.const_undef(layout.immediate_llvm_type(cx))),
             layout
         }
     }
@@ -166,7 +166,7 @@ pub fn immediate_or_packed_pair(self, bx: &Builder<'a, 'll, 'tcx>) -> &'ll Value
             debug!("Operand::immediate_or_packed_pair: packing {:?} into {:?}",
                    self, llty);
             // Reconstruct the immediate aggregate.
-            let mut llpair = bx.cx().c_undef(llty);
+            let mut llpair = bx.cx().const_undef(llty);
             llpair = bx.insert_value(llpair, base::from_immediate(bx, a), 0);
             llpair = bx.insert_value(llpair, base::from_immediate(bx, b), 1);
             llpair
@@ -231,7 +231,7 @@ pub fn extract_field(
             // `#[repr(simd)]` types are also immediate.
             (OperandValue::Immediate(llval), &layout::Abi::Vector { .. }) => {
                 OperandValue::Immediate(
-                    bx.extract_element(llval, bx.cx().c_usize(i as u64)))
+                    bx.extract_element(llval, bx.cx().const_usize(i as u64)))
             }
 
             _ => bug!("OperandRef::extract_field({:?}): not applicable", self)
@@ -462,7 +462,7 @@ pub fn codegen_operand(&mut self,
                         // We've errored, so we don't have to produce working code.
                         let layout = bx.cx().layout_of(ty);
                         PlaceRef::new_sized(
-                            bx.cx().c_undef(bx.cx().ptr_to(layout.llvm_type(bx.cx()))),
+                            bx.cx().const_undef(bx.cx().ptr_to(layout.llvm_type(bx.cx()))),
                             layout,
                             layout.align,
                         ).load(bx)
index b34eea0ce1c1da50704787b30a6eaf4274bf8c16..b0740008995ed7b75841305d8c81d5fd34a83e17 100644 (file)
@@ -68,7 +68,7 @@ pub fn from_const_alloc(
 
         let llval = unsafe { LLVMConstInBoundsGEP(
             consts::bitcast(base_addr, bx.cx().i8p()),
-            &bx.cx().c_usize(offset.bytes()),
+            &bx.cx().const_usize(offset.bytes()),
             1,
         )};
         let llval = consts::bitcast(llval, bx.cx().ptr_to(layout.llvm_type(bx.cx())));
@@ -102,7 +102,7 @@ pub fn len(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Value {
                 assert_eq!(count, 0);
                 self.llextra.unwrap()
             } else {
-                cx.c_usize(count)
+                cx.const_usize(count)
             }
         } else {
             bug!("unexpected layout `{:#?}` in PlaceRef::len", self.layout)
@@ -247,7 +247,7 @@ pub fn project_field(
 
         let meta = self.llextra;
 
-        let unaligned_offset = cx.c_usize(offset.bytes());
+        let unaligned_offset = cx.const_usize(offset.bytes());
 
         // Get the alignment of the field
         let (_, unsized_align) = glue::size_and_align_of_dst(bx, field.ty, meta);
@@ -258,7 +258,7 @@ pub fn project_field(
         //   (unaligned offset + (align - 1)) & -align
 
         // Calculate offset
-        let align_sub_1 = bx.sub(unsized_align, cx.c_usize(1u64));
+        let align_sub_1 = bx.sub(unsized_align, cx.const_usize(1u64));
         let offset = bx.and(bx.add(unaligned_offset, align_sub_1),
         bx.neg(unsized_align));
 
@@ -288,14 +288,14 @@ pub fn codegen_get_discr(
     ) -> &'ll Value {
         let cast_to = bx.cx().layout_of(cast_to).immediate_llvm_type(bx.cx());
         if self.layout.abi.is_uninhabited() {
-            return bx.cx().c_undef(cast_to);
+            return bx.cx().const_undef(cast_to);
         }
         match self.layout.variants {
             layout::Variants::Single { index } => {
                 let discr_val = self.layout.ty.ty_adt_def().map_or(
                     index.as_u32() as u128,
                     |def| def.discriminant_for_variant(bx.cx().tcx, index).val);
-                return bx.cx().c_uint_big(cast_to, discr_val);
+                return bx.cx().const_uint_big(cast_to, discr_val);
             }
             layout::Variants::Tagged { .. } |
             layout::Variants::NicheFilling { .. } => {},
@@ -327,22 +327,22 @@ pub fn codegen_get_discr(
                     // FIXME(eddyb) Check the actual primitive type here.
                     let niche_llval = if niche_start == 0 {
                         // HACK(eddyb) Using `c_null` as it works on all types.
-                        bx.cx().c_null(niche_llty)
+                        bx.cx().const_null(niche_llty)
                     } else {
-                        bx.cx().c_uint_big(niche_llty, niche_start)
+                        bx.cx().const_uint_big(niche_llty, niche_start)
                     };
                     bx.select(bx.icmp(IntPredicate::IntEQ, lldiscr, niche_llval),
-                        bx.cx().c_uint(cast_to, niche_variants.start().as_u32() as u64),
-                        bx.cx().c_uint(cast_to, dataful_variant.as_u32() as u64))
+                        bx.cx().const_uint(cast_to, niche_variants.start().as_u32() as u64),
+                        bx.cx().const_uint(cast_to, dataful_variant.as_u32() as u64))
                 } else {
                     // Rebase from niche values to discriminant values.
                     let delta = niche_start.wrapping_sub(niche_variants.start().as_u32() as u128);
-                    let lldiscr = bx.sub(lldiscr, bx.cx().c_uint_big(niche_llty, delta));
+                    let lldiscr = bx.sub(lldiscr, bx.cx().const_uint_big(niche_llty, delta));
                     let lldiscr_max =
-                        bx.cx().c_uint(niche_llty, niche_variants.end().as_u32() as u64);
+                        bx.cx().const_uint(niche_llty, niche_variants.end().as_u32() as u64);
                     bx.select(bx.icmp(IntPredicate::IntULE, lldiscr, lldiscr_max),
                         bx.intcast(lldiscr, cast_to, false),
-                        bx.cx().c_uint(cast_to, dataful_variant.as_u32() as u64))
+                        bx.cx().const_uint(cast_to, dataful_variant.as_u32() as u64))
                 }
             }
         }
@@ -364,7 +364,7 @@ pub fn codegen_set_discr(&self, bx: &Builder<'a, 'll, 'tcx>, variant_index: Vari
                     .discriminant_for_variant(bx.tcx(), variant_index)
                     .val;
                 bx.store(
-                    bx.cx().c_uint_big(ptr.layout.llvm_type(bx.cx()), to),
+                    bx.cx().const_uint_big(ptr.layout.llvm_type(bx.cx()), to),
                     ptr.llval,
                     ptr.align);
             }
@@ -380,10 +380,10 @@ pub fn codegen_set_discr(&self, bx: &Builder<'a, 'll, 'tcx>, variant_index: Vari
                         // Issue #34427: As workaround for LLVM bug on ARM,
                         // use memset of 0 before assigning niche value.
                         let llptr = bx.pointercast(self.llval, bx.cx().ptr_to(bx.cx().i8()));
-                        let fill_byte = bx.cx().c_u8(0);
+                        let fill_byte = bx.cx().const_u8(0);
                         let (size, align) = self.layout.size_and_align();
-                        let size = bx.cx().c_usize(size.bytes());
-                        let align = bx.cx().c_u32(align.abi() as u32);
+                        let size = bx.cx().const_usize(size.bytes());
+                        let align = bx.cx().const_u32(align.abi() as u32);
                         base::call_memset(bx, llptr, fill_byte, size, align, false);
                     }
 
@@ -395,9 +395,9 @@ pub fn codegen_set_discr(&self, bx: &Builder<'a, 'll, 'tcx>, variant_index: Vari
                     // FIXME(eddyb) Check the actual primitive type here.
                     let niche_llval = if niche_value == 0 {
                         // HACK(eddyb) Using `c_null` as it works on all types.
-                        bx.cx().c_null(niche_llty)
+                        bx.cx().const_null(niche_llty)
                     } else {
-                        bx.cx().c_uint_big(niche_llty, niche_value)
+                        bx.cx().const_uint_big(niche_llty, niche_value)
                     };
                     OperandValue::Immediate(niche_llval).store(bx, niche);
                 }
@@ -408,7 +408,7 @@ pub fn codegen_set_discr(&self, bx: &Builder<'a, 'll, 'tcx>, variant_index: Vari
     pub fn project_index(&self, bx: &Builder<'a, 'll, 'tcx>, llindex: &'ll Value)
                          -> PlaceRef<'tcx, &'ll Value> {
         PlaceRef {
-            llval: bx.inbounds_gep(self.llval, &[bx.cx().c_usize(0), llindex]),
+            llval: bx.inbounds_gep(self.llval, &[bx.cx().const_usize(0), llindex]),
             llextra: None,
             layout: self.layout.field(bx.cx(), 0),
             align: self.align
@@ -483,7 +483,7 @@ pub fn codegen_place(&mut self,
                         // so we generate an abort
                         let fnname = bx.cx().get_intrinsic(&("llvm.trap"));
                         bx.call(fnname, &[], None);
-                        let llval = bx.cx().c_undef(bx.cx().ptr_to(layout.llvm_type(bx.cx())));
+                        let llval = bx.cx().const_undef(bx.cx().ptr_to(layout.llvm_type(bx.cx())));
                         PlaceRef::new_sized(llval, layout, layout.align)
                     }
                 }
@@ -516,20 +516,20 @@ pub fn codegen_place(&mut self,
                     mir::ProjectionElem::ConstantIndex { offset,
                                                          from_end: false,
                                                          min_length: _ } => {
-                        let lloffset = bx.cx().c_usize(offset as u64);
+                        let lloffset = bx.cx().const_usize(offset as u64);
                         cg_base.project_index(bx, lloffset)
                     }
                     mir::ProjectionElem::ConstantIndex { offset,
                                                          from_end: true,
                                                          min_length: _ } => {
-                        let lloffset = bx.cx().c_usize(offset as u64);
+                        let lloffset = bx.cx().const_usize(offset as u64);
                         let lllen = cg_base.len(bx.cx());
                         let llindex = bx.sub(lllen, lloffset);
                         cg_base.project_index(bx, llindex)
                     }
                     mir::ProjectionElem::Subslice { from, to } => {
                         let mut subslice = cg_base.project_index(bx,
-                            bx.cx().c_usize(from as u64));
+                            bx.cx().const_usize(from as u64));
                         let projected_ty = PlaceTy::Ty { ty: cg_base.layout.ty }
                             .projection_ty(tcx, &projection.elem)
                             .to_ty(bx.tcx());
@@ -537,7 +537,7 @@ pub fn codegen_place(&mut self,
 
                         if subslice.layout.is_unsized() {
                             subslice.llextra = Some(bx.sub(cg_base.llextra.unwrap(),
-                                bx.cx().c_usize((from as u64) + (to as u64))));
+                                bx.cx().const_usize((from as u64) + (to as u64))));
                         }
 
                         // Cast the place pointer type to the new
index 3066e38753aac79f1eaceb83080f0d1cfc7526eb..4dcb0bec3f49fa42af762e9fd2a17f6fda981e4f 100644 (file)
@@ -102,15 +102,15 @@ pub fn codegen_rvalue(&mut self,
                     return bx;
                 }
 
-                let start = dest.project_index(&bx, bx.cx().c_usize(0)).llval;
+                let start = dest.project_index(&bx, bx.cx().const_usize(0)).llval;
 
                 if let OperandValue::Immediate(v) = cg_elem.val {
-                    let align = bx.cx().c_i32(dest.align.abi() as i32);
-                    let size = bx.cx().c_usize(dest.layout.size.bytes());
+                    let align = bx.cx().const_i32(dest.align.abi() as i32);
+                    let size = bx.cx().const_usize(dest.layout.size.bytes());
 
                     // Use llvm.memset.p0i8.* to initialize all zero arrays
                     if bx.cx().is_const_integral(v) && bx.cx().const_to_uint(v) == 0 {
-                        let fill = bx.cx().c_u8(0);
+                        let fill = bx.cx().const_u8(0);
                         base::call_memset(&bx, start, fill, size, align, false);
                         return bx;
                     }
@@ -123,7 +123,7 @@ pub fn codegen_rvalue(&mut self,
                     }
                 }
 
-                let count = bx.cx().c_usize(count);
+                let count = bx.cx().const_usize(count);
                 let end = dest.project_index(&bx, count).llval;
 
                 let header_bx = bx.build_sibling_block("repeat_loop_header");
@@ -139,7 +139,7 @@ pub fn codegen_rvalue(&mut self,
                 cg_elem.val.store(&body_bx,
                     PlaceRef::new_sized(current, cg_elem.layout, dest.align));
 
-                let next = body_bx.inbounds_gep(current, &[bx.cx().c_usize(1)]);
+                let next = body_bx.inbounds_gep(current, &[bx.cx().const_usize(1)]);
                 body_bx.br(header_bx.llbb());
                 header_bx.add_incoming_to_phi(current, next, body_bx.llbb());
 
@@ -291,7 +291,7 @@ pub fn codegen_rvalue_operand(
                         assert!(cast.is_llvm_immediate());
                         let ll_t_out = cast.immediate_llvm_type(bx.cx());
                         if operand.layout.abi.is_uninhabited() {
-                            let val = OperandValue::Immediate(bx.cx().c_undef(ll_t_out));
+                            let val = OperandValue::Immediate(bx.cx().const_undef(ll_t_out));
                             return (bx, OperandRef {
                                 val,
                                 layout: cast,
@@ -307,7 +307,7 @@ pub fn codegen_rvalue_operand(
                                     let discr_val = def
                                         .discriminant_for_variant(bx.cx().tcx, index)
                                         .val;
-                                    let discr = bx.cx().c_uint_big(ll_t_out, discr_val);
+                                    let discr = bx.cx().const_uint_big(ll_t_out, discr_val);
                                     return (bx, OperandRef {
                                         val: OperandValue::Immediate(discr),
                                         layout: cast,
@@ -338,7 +338,7 @@ pub fn codegen_rvalue_operand(
                                     base::call_assume(&bx, bx.icmp(
                                         IntPredicate::IntULE,
                                         llval,
-                                        bx.cx().c_uint_big(ll_t_in, *scalar.valid_range.end())
+                                        bx.cx().const_uint_big(ll_t_in, *scalar.valid_range.end())
                                     ));
                                 }
                             }
@@ -489,7 +489,7 @@ pub fn codegen_rvalue_operand(
 
             mir::Rvalue::NullaryOp(mir::NullOp::SizeOf, ty) => {
                 assert!(bx.cx().type_is_sized(ty));
-                let val = bx.cx().c_usize(bx.cx().size_of(ty).bytes());
+                let val = bx.cx().const_usize(bx.cx().size_of(ty).bytes());
                 let tcx = bx.tcx();
                 (bx, OperandRef {
                     val: OperandValue::Immediate(val),
@@ -500,8 +500,8 @@ pub fn codegen_rvalue_operand(
             mir::Rvalue::NullaryOp(mir::NullOp::Box, content_ty) => {
                 let content_ty: Ty<'tcx> = self.monomorphize(&content_ty);
                 let (size, align) = bx.cx().size_and_align_of(content_ty);
-                let llsize = bx.cx().c_usize(size.bytes());
-                let llalign = bx.cx().c_usize(align.abi());
+                let llsize = bx.cx().const_usize(size.bytes());
+                let llalign = bx.cx().const_usize(align.abi());
                 let box_layout = bx.cx().layout_of(bx.tcx().mk_box(content_ty));
                 let llty_ptr = box_layout.llvm_type(bx.cx());
 
@@ -548,7 +548,7 @@ fn evaluate_array_len(
             if let LocalRef::Operand(Some(op)) = self.locals[index] {
                 if let ty::Array(_, n) = op.layout.ty.sty {
                     let n = n.unwrap_usize(bx.cx().tcx);
-                    return bx.cx().c_usize(n);
+                    return bx.cx().const_usize(n);
                 }
             }
         }
@@ -606,7 +606,7 @@ pub fn codegen_scalar_binop(
             mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
             mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
             mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
-                bx.cx().c_bool(match op {
+                bx.cx().const_bool(match op {
                     mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
                     mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
                     _ => unreachable!()
@@ -685,7 +685,7 @@ pub fn codegen_scalar_checked_binop(&mut self,
         // while the current crate doesn't use overflow checks.
         if !bx.cx().check_overflow {
             let val = self.codegen_scalar_binop(bx, op, lhs, rhs, input_ty);
-            return OperandValue::Pair(val, bx.cx().c_bool(false));
+            return OperandValue::Pair(val, bx.cx().const_bool(false));
         }
 
         let (val, of) = match op {
@@ -709,7 +709,7 @@ pub fn codegen_scalar_checked_binop(&mut self,
                 let invert_mask = common::shift_mask_val(&bx, lhs_llty, rhs_llty, true);
                 let outer_bits = bx.and(rhs, invert_mask);
 
-                let of = bx.icmp(IntPredicate::IntNE, outer_bits, bx.cx().c_null(rhs_llty));
+                let of = bx.icmp(IntPredicate::IntNE, outer_bits, bx.cx().const_null(rhs_llty));
                 let val = self.codegen_scalar_binop(bx, op, lhs, rhs, input_ty);
 
                 (val, of)
@@ -838,9 +838,9 @@ fn cast_int_to_float(bx: &Builder<'_, 'll, '_>,
         use rustc_apfloat::Float;
         const MAX_F32_PLUS_HALF_ULP: u128 = ((1 << (Single::PRECISION + 1)) - 1)
                                             << (Single::MAX_EXP - Single::PRECISION as i16);
-        let max = bx.cx().c_uint_big(int_ty, MAX_F32_PLUS_HALF_ULP);
+        let max = bx.cx().const_uint_big(int_ty, MAX_F32_PLUS_HALF_ULP);
         let overflow = bx.icmp(IntPredicate::IntUGE, x, max);
-        let infinity_bits = bx.cx().c_u32(ieee::Single::INFINITY.to_bits() as u32);
+        let infinity_bits = bx.cx().const_u32(ieee::Single::INFINITY.to_bits() as u32);
         let infinity = consts::bitcast(infinity_bits, float_ty);
         bx.select(overflow, infinity, bx.uitofp(x, float_ty))
     } else {
@@ -918,8 +918,8 @@ fn cast_float_to_int(bx: &Builder<'_, 'll, '_>,
 
     let float_bits_to_llval = |bits| {
         let bits_llval = match bx.cx().float_width(float_ty) {
-            32 => bx.cx().c_u32(bits as u32),
-            64 => bx.cx().c_u64(bits as u64),
+            32 => bx.cx().const_u32(bits as u32),
+            64 => bx.cx().const_u64(bits as u64),
             n => bug!("unsupported float width {}", n),
         };
         consts::bitcast(bits_llval, float_ty)
@@ -974,8 +974,8 @@ fn cast_float_to_int(bx: &Builder<'_, 'll, '_>,
     // performed is ultimately up to the backend, but at least x86 does perform them.
     let less_or_nan = bx.fcmp(RealPredicate::RealULT, x, f_min);
     let greater = bx.fcmp(RealPredicate::RealOGT, x, f_max);
-    let int_max = bx.cx().c_uint_big(int_ty, int_max(signed, int_ty));
-    let int_min = bx.cx().c_uint_big(int_ty, int_min(signed, int_ty) as u128);
+    let int_max = bx.cx().const_uint_big(int_ty, int_max(signed, int_ty));
+    let int_min = bx.cx().const_uint_big(int_ty, int_min(signed, int_ty) as u128);
     let s0 = bx.select(less_or_nan, int_min, fptosui_result);
     let s1 = bx.select(greater, int_max, s0);
 
@@ -984,7 +984,7 @@ fn cast_float_to_int(bx: &Builder<'_, 'll, '_>,
     // Therefore we only need to execute this step for signed integer types.
     if signed {
         // LLVM has no isNaN predicate, so we use (x == x) instead
-        bx.select(bx.fcmp(RealPredicate::RealOEQ, x, x), s1, bx.cx().c_uint(int_ty, 0))
+        bx.select(bx.fcmp(RealPredicate::RealOEQ, x, x), s1, bx.cx().const_uint(int_ty, 0))
     } else {
         s1
     }