]> git.lizzy.rs Git - rust.git/commitdiff
rustc_trans: rename CrateContext to CodegenCx.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Fri, 5 Jan 2018 05:01:54 +0000 (07:01 +0200)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Sun, 14 Jan 2018 06:55:57 +0000 (08:55 +0200)
39 files changed:
src/librustc_trans/abi.rs
src/librustc_trans/asm.rs
src/librustc_trans/attributes.rs
src/librustc_trans/base.rs
src/librustc_trans/builder.rs
src/librustc_trans/cabi_aarch64.rs
src/librustc_trans/cabi_arm.rs
src/librustc_trans/cabi_asmjs.rs
src/librustc_trans/cabi_mips.rs
src/librustc_trans/cabi_mips64.rs
src/librustc_trans/cabi_powerpc.rs
src/librustc_trans/cabi_powerpc64.rs
src/librustc_trans/cabi_s390x.rs
src/librustc_trans/cabi_sparc.rs
src/librustc_trans/cabi_sparc64.rs
src/librustc_trans/cabi_x86.rs
src/librustc_trans/cabi_x86_64.rs
src/librustc_trans/callee.rs
src/librustc_trans/common.rs
src/librustc_trans/consts.rs
src/librustc_trans/context.rs
src/librustc_trans/debuginfo/create_scope_map.rs
src/librustc_trans/debuginfo/doc.rs
src/librustc_trans/debuginfo/gdb.rs
src/librustc_trans/debuginfo/metadata.rs
src/librustc_trans/debuginfo/mod.rs
src/librustc_trans/debuginfo/namespace.rs
src/librustc_trans/debuginfo/type_names.rs
src/librustc_trans/debuginfo/utils.rs
src/librustc_trans/declare.rs
src/librustc_trans/intrinsic.rs
src/librustc_trans/meth.rs
src/librustc_trans/mir/constant.rs
src/librustc_trans/mir/mod.rs
src/librustc_trans/mir/operand.rs
src/librustc_trans/mir/place.rs
src/librustc_trans/trans_item.rs
src/librustc_trans/type_.rs
src/librustc_trans/type_of.rs

index e1c8311651fd315a64a32b79194f074fed7e6876..47e4d748e3f0922afda8edf653ef07a78454d2de 100644 (file)
@@ -12,7 +12,7 @@
 use base;
 use builder::Builder;
 use common::{ty_fn_sig, C_usize};
-use context::CrateContext;
+use context::CodegenCx;
 use cabi_x86;
 use cabi_x86_64;
 use cabi_x86_win64;
@@ -209,7 +209,7 @@ impl Reg {
 }
 
 impl Reg {
-    pub fn align(&self, ccx: &CrateContext) -> Align {
+    pub fn align(&self, ccx: &CodegenCx) -> Align {
         let dl = ccx.data_layout();
         match self.kind {
             RegKind::Integer => {
@@ -234,7 +234,7 @@ pub fn align(&self, ccx: &CrateContext) -> Align {
         }
     }
 
-    pub fn llvm_type(&self, ccx: &CrateContext) -> Type {
+    pub fn llvm_type(&self, ccx: &CodegenCx) -> Type {
         match self.kind {
             RegKind::Integer => Type::ix(ccx, self.size.bits()),
             RegKind::Float => {
@@ -276,11 +276,11 @@ fn from(unit: Reg) -> Uniform {
 }
 
 impl Uniform {
-    pub fn align(&self, ccx: &CrateContext) -> Align {
+    pub fn align(&self, ccx: &CodegenCx) -> Align {
         self.unit.align(ccx)
     }
 
-    pub fn llvm_type(&self, ccx: &CrateContext) -> Type {
+    pub fn llvm_type(&self, ccx: &CodegenCx) -> Type {
         let llunit = self.unit.llvm_type(ccx);
 
         if self.total <= self.unit.size {
@@ -307,7 +307,7 @@ pub fn llvm_type(&self, ccx: &CrateContext) -> Type {
 
 pub trait LayoutExt<'tcx> {
     fn is_aggregate(&self) -> bool;
-    fn homogeneous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option<Reg>;
+    fn homogeneous_aggregate<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Option<Reg>;
 }
 
 impl<'tcx> LayoutExt<'tcx> for TyLayout<'tcx> {
@@ -321,7 +321,7 @@ fn is_aggregate(&self) -> bool {
         }
     }
 
-    fn homogeneous_aggregate<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Option<Reg> {
+    fn homogeneous_aggregate<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Option<Reg> {
         match self.abi {
             layout::Abi::Uninhabited => None,
 
@@ -423,7 +423,7 @@ fn from(uniform: Uniform) -> CastTarget {
 }
 
 impl CastTarget {
-    pub fn size(&self, ccx: &CrateContext) -> Size {
+    pub fn size(&self, ccx: &CodegenCx) -> Size {
         match *self {
             CastTarget::Uniform(u) => u.total,
             CastTarget::Pair(a, b) => {
@@ -433,7 +433,7 @@ pub fn size(&self, ccx: &CrateContext) -> Size {
         }
     }
 
-    pub fn align(&self, ccx: &CrateContext) -> Align {
+    pub fn align(&self, ccx: &CodegenCx) -> Align {
         match *self {
             CastTarget::Uniform(u) => u.align(ccx),
             CastTarget::Pair(a, b) => {
@@ -444,7 +444,7 @@ pub fn align(&self, ccx: &CrateContext) -> Align {
         }
     }
 
-    pub fn llvm_type(&self, ccx: &CrateContext) -> Type {
+    pub fn llvm_type(&self, ccx: &CodegenCx) -> Type {
         match *self {
             CastTarget::Uniform(u) => u.llvm_type(ccx),
             CastTarget::Pair(a, b) => {
@@ -547,7 +547,7 @@ pub fn is_ignore(&self) -> bool {
 
     /// Get the LLVM type for an place of the original Rust type of
     /// this argument/return, i.e. the result of `type_of::type_of`.
-    pub fn memory_ty(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
+    pub fn memory_ty(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type {
         self.layout.llvm_type(ccx)
     }
 
@@ -647,7 +647,7 @@ pub struct FnType<'tcx> {
 }
 
 impl<'a, 'tcx> FnType<'tcx> {
-    pub fn of_instance(ccx: &CrateContext<'a, 'tcx>, instance: &ty::Instance<'tcx>)
+    pub fn of_instance(ccx: &CodegenCx<'a, 'tcx>, instance: &ty::Instance<'tcx>)
                        -> Self {
         let fn_ty = instance.ty(ccx.tcx);
         let sig = ty_fn_sig(ccx, fn_ty);
@@ -655,7 +655,7 @@ pub fn of_instance(ccx: &CrateContext<'a, 'tcx>, instance: &ty::Instance<'tcx>)
         FnType::new(ccx, sig, &[])
     }
 
-    pub fn new(ccx: &CrateContext<'a, 'tcx>,
+    pub fn new(ccx: &CodegenCx<'a, 'tcx>,
                sig: ty::FnSig<'tcx>,
                extra_args: &[Ty<'tcx>]) -> FnType<'tcx> {
         let mut fn_ty = FnType::unadjusted(ccx, sig, extra_args);
@@ -663,7 +663,7 @@ pub fn new(ccx: &CrateContext<'a, 'tcx>,
         fn_ty
     }
 
-    pub fn new_vtable(ccx: &CrateContext<'a, 'tcx>,
+    pub fn new_vtable(ccx: &CodegenCx<'a, 'tcx>,
                       sig: ty::FnSig<'tcx>,
                       extra_args: &[Ty<'tcx>]) -> FnType<'tcx> {
         let mut fn_ty = FnType::unadjusted(ccx, sig, extra_args);
@@ -688,7 +688,7 @@ pub fn new_vtable(ccx: &CrateContext<'a, 'tcx>,
         fn_ty
     }
 
-    pub fn unadjusted(ccx: &CrateContext<'a, 'tcx>,
+    pub fn unadjusted(ccx: &CodegenCx<'a, 'tcx>,
                       sig: ty::FnSig<'tcx>,
                       extra_args: &[Ty<'tcx>]) -> FnType<'tcx> {
         debug!("FnType::unadjusted({:?}, {:?})", sig, extra_args);
@@ -863,7 +863,7 @@ pub fn unadjusted(ccx: &CrateContext<'a, 'tcx>,
     }
 
     fn adjust_for_abi(&mut self,
-                      ccx: &CrateContext<'a, 'tcx>,
+                      ccx: &CodegenCx<'a, 'tcx>,
                       abi: Abi) {
         if abi == Abi::Unadjusted { return }
 
@@ -939,7 +939,7 @@ fn adjust_for_abi(&mut self,
         }
     }
 
-    pub fn llvm_type(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
+    pub fn llvm_type(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type {
         let mut llargument_tys = Vec::new();
 
         let llreturn_ty = match self.ret.mode {
index 709af224c9767b8d76d15540719173b3d6b38646..fd8bcef924e51ff4ddfedbfda74cfd97c6d9cd17 100644 (file)
@@ -119,7 +119,7 @@ pub fn trans_inline_asm<'a, 'tcx>(
     }
 }
 
-pub fn trans_global_asm<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn trans_global_asm<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                   ga: &hir::GlobalAsm) {
     let asm = CString::new(ga.asm.as_str().as_bytes()).unwrap();
     unsafe {
index 1f33681507951eac6644f84c3c5770988dd9f32e..8619577560c46ed4d5219a3e25c080939030b17a 100644 (file)
@@ -24,7 +24,7 @@
 use llvm_util;
 pub use syntax::attr::{self, InlineAttr};
 use syntax::ast;
-use context::CrateContext;
+use context::CodegenCx;
 
 /// Mark LLVM function to use provided inline heuristic.
 #[inline]
@@ -67,7 +67,7 @@ pub fn naked(val: ValueRef, is_naked: bool) {
     Attribute::Naked.toggle_llfn(Function, val, is_naked);
 }
 
-pub fn set_frame_pointer_elimination(ccx: &CrateContext, llfn: ValueRef) {
+pub fn set_frame_pointer_elimination(ccx: &CodegenCx, llfn: ValueRef) {
     // FIXME: #11906: Omitting frame pointers breaks retrieving the value of a
     // parameter.
     if ccx.sess().must_not_eliminate_frame_pointers() {
@@ -77,7 +77,7 @@ pub fn set_frame_pointer_elimination(ccx: &CrateContext, llfn: ValueRef) {
     }
 }
 
-pub fn set_probestack(ccx: &CrateContext, llfn: ValueRef) {
+pub fn set_probestack(ccx: &CodegenCx, llfn: ValueRef) {
     // Only use stack probes if the target specification indicates that we
     // should be using stack probes
     if !ccx.sess().target.target.options.stack_probes {
@@ -101,7 +101,7 @@ pub fn set_probestack(ccx: &CrateContext, llfn: ValueRef) {
 
 /// Composite function which sets LLVM attributes for function depending on its AST (#[attribute])
 /// attributes.
-pub fn from_fn_attrs(ccx: &CrateContext, llfn: ValueRef, id: DefId) {
+pub fn from_fn_attrs(ccx: &CodegenCx, llfn: ValueRef, id: DefId) {
     use syntax::attr::*;
     let attrs = ccx.tcx.get_attrs(id);
     inline(llfn, find_inline_attr(Some(ccx.sess().diagnostic()), &attrs));
index c6e31298863e0eb2f06c121b7da4837bdddc6bc9..593c5699245faf723723f518ac4567a9d5f3cdd2 100644 (file)
@@ -59,7 +59,7 @@
 use rustc_mir::monomorphize::collector::{self, MonoItemCollectionMode};
 use common::{self, C_struct_in_context, C_array, val_ty};
 use consts;
-use context::{self, CrateContext};
+use context::{self, CodegenCx};
 use debuginfo;
 use declare;
 use meth;
 pub use rustc_mir::monomorphize::item::linkage_by_name;
 
 pub struct StatRecorder<'a, 'tcx: 'a> {
-    ccx: &'a CrateContext<'a, 'tcx>,
+    ccx: &'a CodegenCx<'a, 'tcx>,
     name: Option<String>,
     istart: usize,
 }
 
 impl<'a, 'tcx> StatRecorder<'a, 'tcx> {
-    pub fn new(ccx: &'a CrateContext<'a, 'tcx>, name: String) -> StatRecorder<'a, 'tcx> {
+    pub fn new(ccx: &'a CodegenCx<'a, 'tcx>, name: String) -> StatRecorder<'a, 'tcx> {
         let istart = ccx.stats.borrow().n_llvm_insns;
         StatRecorder {
             ccx,
@@ -189,7 +189,7 @@ pub fn compare_simd_types<'a, 'tcx>(
 /// The `old_info` argument is a bit funny. It is intended for use
 /// in an upcast, where the new vtable for an object will be derived
 /// from the old one.
-pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
+pub fn unsized_info<'ccx, 'tcx>(ccx: &CodegenCx<'ccx, 'tcx>,
                                 source: Ty<'tcx>,
                                 target: Ty<'tcx>,
                                 old_info: Option<ValueRef>)
@@ -455,7 +455,7 @@ pub fn call_memset<'a, 'tcx>(b: &Builder<'a, 'tcx>,
     b.call(llintrinsicfn, &[ptr, fill_byte, size, align, volatile], None)
 }
 
-pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance<'tcx>) {
+pub fn trans_instance<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, instance: Instance<'tcx>) {
     let _s = if ccx.sess().trans_stats() {
         let mut instance_name = String::new();
         DefPathBasedNames::new(ccx.tcx, true, true)
@@ -506,7 +506,7 @@ pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance
     mir::trans_mir(ccx, lldecl, &mir, instance, sig);
 }
 
-pub fn set_link_section(ccx: &CrateContext,
+pub fn set_link_section(ccx: &CodegenCx,
                         llval: ValueRef,
                         attrs: &[ast::Attribute]) {
     if let Some(sect) = attr::first_attr_value_str_by_name(attrs, "link_section") {
@@ -522,7 +522,7 @@ pub fn set_link_section(ccx: &CrateContext,
 
 /// Create the `main` function which will initialize the rust runtime and call
 /// users main function.
-fn maybe_create_entry_wrapper(ccx: &CrateContext) {
+fn maybe_create_entry_wrapper(ccx: &CodegenCx) {
     let (main_def_id, span) = match *ccx.sess().entry_fn.borrow() {
         Some((id, span)) => {
             (ccx.tcx.hir.local_def_id(id), span)
@@ -547,7 +547,7 @@ fn maybe_create_entry_wrapper(ccx: &CrateContext) {
         config::EntryNone => {}    // Do nothing.
     }
 
-    fn create_entry_fn<'ccx>(ccx: &'ccx CrateContext,
+    fn create_entry_fn<'ccx>(ccx: &'ccx CodegenCx,
                        sp: Span,
                        rust_main: ValueRef,
                        rust_main_def_id: DefId,
@@ -1203,7 +1203,7 @@ fn module_translation<'a, 'tcx>(
                                    .to_fingerprint().to_hex());
 
         // Instantiate translation items without filling out definitions yet...
-        let ccx = CrateContext::new(tcx, cgu, &llmod_id);
+        let ccx = CodegenCx::new(tcx, cgu, &llmod_id);
         let module = {
             let trans_items = ccx.codegen_unit
                                  .items_in_deterministic_order(ccx.tcx);
index b636b1e8a8613642503bc0a05ed8bd903870e6f5..cbc3f5e0c124c0586ff21f6379ee776bb16efb99 100644 (file)
@@ -32,7 +32,7 @@
 #[must_use]
 pub struct Builder<'a, 'tcx: 'a> {
     pub llbuilder: BuilderRef,
-    pub ccx: &'a CrateContext<'a, 'tcx>,
+    pub ccx: &'a CodegenCx<'a, 'tcx>,
 }
 
 impl<'a, 'tcx> Drop for Builder<'a, 'tcx> {
@@ -51,7 +51,7 @@ fn noname() -> *const c_char {
 }
 
 impl<'a, 'tcx> Builder<'a, 'tcx> {
-    pub fn new_block<'b>(ccx: &'a CrateContext<'a, 'tcx>, llfn: ValueRef, name: &'b str) -> Self {
+    pub fn new_block<'b>(ccx: &'a CodegenCx<'a, 'tcx>, llfn: ValueRef, name: &'b str) -> Self {
         let builder = Builder::with_ccx(ccx);
         let llbb = unsafe {
             let name = CString::new(name).unwrap();
@@ -65,7 +65,7 @@ pub fn new_block<'b>(ccx: &'a CrateContext<'a, 'tcx>, llfn: ValueRef, name: &'b
         builder
     }
 
-    pub fn with_ccx(ccx: &'a CrateContext<'a, 'tcx>) -> Self {
+    pub fn with_ccx(ccx: &'a CodegenCx<'a, 'tcx>) -> Self {
         // Create a fresh builder from the crate context.
         let llbuilder = unsafe {
             llvm::LLVMCreateBuilderInContext(ccx.llcx)
index d5f341f9685833dd987b2e0b1d94afed5b8ba875..a6f5844711976df71f74b921ceebea596087092a 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
-fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>)
+fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>)
                                      -> Option<Uniform> {
     arg.layout.homogeneous_aggregate(ccx).and_then(|unit| {
         let size = arg.layout.size;
@@ -38,7 +38,7 @@ fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut Ar
     })
 }
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
     if !ret.layout.is_aggregate() {
         ret.extend_integer_width_to(32);
         return;
@@ -69,7 +69,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc
     ret.make_indirect();
 }
 
-fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
+fn classify_arg_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
     if !arg.layout.is_aggregate() {
         arg.extend_integer_width_to(32);
         return;
@@ -100,7 +100,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc
     arg.make_indirect();
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret);
     }
index 438053d63b51d37bd638ad3c699464cc5b17ef17..ca53918ddec815a467659be607a4b76dfce16fb1 100644 (file)
@@ -9,10 +9,10 @@
 // except according to those terms.
 
 use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 use llvm::CallConv;
 
-fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>)
+fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>)
                                      -> Option<Uniform> {
     arg.layout.homogeneous_aggregate(ccx).and_then(|unit| {
         let size = arg.layout.size;
@@ -39,7 +39,7 @@ fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut Ar
     })
 }
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>, vfp: bool) {
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>, vfp: bool) {
     if !ret.layout.is_aggregate() {
         ret.extend_integer_width_to(32);
         return;
@@ -71,7 +71,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc
     ret.make_indirect();
 }
 
-fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>, vfp: bool) {
+fn classify_arg_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>, vfp: bool) {
     if !arg.layout.is_aggregate() {
         arg.extend_integer_width_to(32);
         return;
@@ -92,7 +92,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc
     });
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     // If this is a target with a hard-float ABI, and the function is not explicitly
     // `extern "aapcs"`, then we must use the VFP registers for homogeneous aggregates.
     let vfp = ccx.sess().target.target.llvm_target.ends_with("hf")
index 1664251cf897b0edd10b84bc6787814714dc695c..4f966cf450c2ed04b73fbb7240a4cecb2efd2a7a 100644 (file)
@@ -9,14 +9,14 @@
 // except according to those terms.
 
 use abi::{FnType, ArgType, LayoutExt, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
 // Data layout: e-p:32:32-i64:64-v128:32:128-n32-S128
 
 // See the https://github.com/kripken/emscripten-fastcomp-clang repository.
 // The class `EmscriptenABIInfo` in `/lib/CodeGen/TargetInfo.cpp` contains the ABI definitions.
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
     if ret.layout.is_aggregate() {
         if let Some(unit) = ret.layout.homogeneous_aggregate(ccx) {
             let size = ret.layout.size;
@@ -39,7 +39,7 @@ fn classify_arg_ty(arg: &mut ArgType) {
     }
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret);
     }
index 0ae737e52bf276a07c889eeb94933fffdb41867d..3cba9aeb7a85a17de32ecd4a3e286535ff428752 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 use abi::{ArgType, FnType, LayoutExt, Reg, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::Size;
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              ret: &mut ArgType<'tcx>,
                              offset: &mut Size) {
     if !ret.layout.is_aggregate() {
@@ -24,7 +24,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
+fn classify_arg_ty(ccx: &CodegenCx, arg: &mut ArgType, offset: &mut Size) {
     let dl = &ccx.tcx.data_layout;
     let size = arg.layout.size;
     let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align);
@@ -44,7 +44,7 @@ fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
     *offset = offset.abi_align(align) + size.abi_align(align);
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let mut offset = Size::from_bytes(0);
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret, &mut offset);
index 2bdcf1d3a75217b29f3cec4323f97b07c3318f3a..332412900de75bce74c1976be7a5a5390027a436 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 use abi::{ArgType, FnType, LayoutExt, Reg, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::Size;
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              ret: &mut ArgType<'tcx>,
                              offset: &mut Size) {
     if !ret.layout.is_aggregate() {
@@ -24,7 +24,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
+fn classify_arg_ty(ccx: &CodegenCx, arg: &mut ArgType, offset: &mut Size) {
     let dl = &ccx.tcx.data_layout;
     let size = arg.layout.size;
     let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align);
@@ -44,7 +44,7 @@ fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
     *offset = offset.abi_align(align) + size.abi_align(align);
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let mut offset = Size::from_bytes(0);
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret, &mut offset);
index 02e13479a2f96d84da260246210300e22bd11687..e8360544a3019f4518adc905ff01a06ab72e365c 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 use abi::{ArgType, FnType, LayoutExt, Reg, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::Size;
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              ret: &mut ArgType<'tcx>,
                              offset: &mut Size) {
     if !ret.layout.is_aggregate() {
@@ -24,7 +24,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
+fn classify_arg_ty(ccx: &CodegenCx, arg: &mut ArgType, offset: &mut Size) {
     let dl = &ccx.tcx.data_layout;
     let size = arg.layout.size;
     let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align);
@@ -44,7 +44,7 @@ fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
     *offset = offset.abi_align(align) + size.abi_align(align);
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let mut offset = Size::from_bytes(0);
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret, &mut offset);
index 2206a4fa00cc3af1ff41b49af4c9b142199604d5..8012017f8fd7d7e56b067cf3421cffd8cd932bc8 100644 (file)
@@ -13,7 +13,7 @@
 // need to be fixed when PowerPC vector support is added.
 
 use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 use rustc::ty::layout;
 
 #[derive(Debug, Clone, Copy, PartialEq)]
@@ -23,7 +23,7 @@ enum ABI {
 }
 use self::ABI::*;
 
-fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                       arg: &mut ArgType<'tcx>,
                                       abi: ABI)
                                      -> Option<Uniform> {
@@ -52,7 +52,7 @@ fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     })
 }
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>, abi: ABI) {
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>, abi: ABI) {
     if !ret.layout.is_aggregate() {
         ret.extend_integer_width_to(64);
         return;
@@ -92,7 +92,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc
     ret.make_indirect();
 }
 
-fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>, abi: ABI) {
+fn classify_arg_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>, abi: ABI) {
     if !arg.layout.is_aggregate() {
         arg.extend_integer_width_to(64);
         return;
@@ -128,7 +128,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc
     });
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let abi = match ccx.sess().target.target.target_endian.as_str() {
         "big" => ELFv1,
         "little" => ELFv2,
index 9fb460043ae81d55490f25a3edae5f0054f57d65..b9db1a9c0aa6e1e761260b1281d26e184f452ac2 100644 (file)
@@ -12,7 +12,7 @@
 // for a pre-z13 machine or using -mno-vx.
 
 use abi::{FnType, ArgType, LayoutExt, Reg};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::{self, TyLayout};
 
@@ -24,7 +24,7 @@ fn classify_ret_ty(ret: &mut ArgType) {
     }
 }
 
-fn is_single_fp_element<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn is_single_fp_element<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                   layout: TyLayout<'tcx>) -> bool {
     match layout.abi {
         layout::Abi::Scalar(ref scalar) => {
@@ -44,7 +44,7 @@ fn is_single_fp_element<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
+fn classify_arg_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
     if !arg.layout.is_aggregate() && arg.layout.size.bits() <= 64 {
         arg.extend_integer_width_to(64);
         return;
@@ -67,7 +67,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc
     }
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     if !fty.ret.is_ignore() {
         classify_ret_ty(&mut fty.ret);
     }
index 0ae737e52bf276a07c889eeb94933fffdb41867d..3cba9aeb7a85a17de32ecd4a3e286535ff428752 100644 (file)
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 use abi::{ArgType, FnType, LayoutExt, Reg, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::Size;
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              ret: &mut ArgType<'tcx>,
                              offset: &mut Size) {
     if !ret.layout.is_aggregate() {
@@ -24,7 +24,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
+fn classify_arg_ty(ccx: &CodegenCx, arg: &mut ArgType, offset: &mut Size) {
     let dl = &ccx.tcx.data_layout;
     let size = arg.layout.size;
     let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align);
@@ -44,7 +44,7 @@ fn classify_arg_ty(ccx: &CrateContext, arg: &mut ArgType, offset: &mut Size) {
     *offset = offset.abi_align(align) + size.abi_align(align);
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let mut offset = Size::from_bytes(0);
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret, &mut offset);
index 7c52e27fa67d1b2d2310e07f0090008ac0c82f61..c7bef67eba9c18917439ea51659eca155bcf9975 100644 (file)
@@ -11,9 +11,9 @@
 // FIXME: This needs an audit for correctness and completeness.
 
 use abi::{FnType, ArgType, LayoutExt, Reg, RegKind, Uniform};
-use context::CrateContext;
+use context::CodegenCx;
 
-fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>)
+fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>)
                                      -> Option<Uniform> {
     arg.layout.homogeneous_aggregate(ccx).and_then(|unit| {
         // Ensure we have at most eight uniquely addressable members.
@@ -38,7 +38,7 @@ fn is_homogeneous_aggregate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut Ar
     })
 }
 
-fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
+fn classify_ret_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
     if !ret.layout.is_aggregate() {
         ret.extend_integer_width_to(64);
         return;
@@ -72,7 +72,7 @@ fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tc
     ret.make_indirect();
 }
 
-fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
+fn classify_arg_ty<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
     if !arg.layout.is_aggregate() {
         arg.extend_integer_width_to(64);
         return;
@@ -90,7 +90,7 @@ fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tc
     });
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     if !fty.ret.is_ignore() {
         classify_ret_ty(ccx, &mut fty.ret);
     }
index 6fd0140c39901d7ce6ee4f7df3c0cb530e17a7d9..54131ecb5da63206f46d7b42b73d3df0ef21c092 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use abi::{ArgAttribute, FnType, LayoutExt, PassMode, Reg, RegKind};
-use common::CrateContext;
+use common::CodegenCx;
 
 use rustc::ty::layout::{self, TyLayout};
 
@@ -19,7 +19,7 @@ pub enum Flavor {
     Fastcall
 }
 
-fn is_single_fp_element<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn is_single_fp_element<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                   layout: TyLayout<'tcx>) -> bool {
     match layout.abi {
         layout::Abi::Scalar(ref scalar) => {
@@ -39,7 +39,7 @@ fn is_single_fp_element<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                   fty: &mut FnType<'tcx>,
                                   flavor: Flavor) {
     if !fty.ret.is_ignore() {
index 7c9f257469370d84ccba9cdb561a349aca189f5f..50fb37424639fbdc4655ef42dbdf1b5bde61f035 100644 (file)
@@ -12,7 +12,7 @@
 // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp
 
 use abi::{ArgType, CastTarget, FnType, LayoutExt, Reg, RegKind};
-use context::CrateContext;
+use context::CodegenCx;
 
 use rustc::ty::layout::{self, TyLayout, Size};
 
@@ -31,7 +31,7 @@ enum Class {
 const LARGEST_VECTOR_SIZE: usize = 512;
 const MAX_EIGHTBYTES: usize = LARGEST_VECTOR_SIZE / 64;
 
-fn classify_arg<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &ArgType<'tcx>)
+fn classify_arg<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, arg: &ArgType<'tcx>)
                           -> Result<[Class; MAX_EIGHTBYTES], Memory> {
     fn unify(cls: &mut [Class],
              off: Size,
@@ -52,7 +52,7 @@ fn unify(cls: &mut [Class],
         cls[i] = to_write;
     }
 
-    fn classify<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+    fn classify<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                           layout: TyLayout<'tcx>,
                           cls: &mut [Class],
                           off: Size)
@@ -189,7 +189,7 @@ fn cast_target(cls: &[Class], size: Size) -> CastTarget {
     target
 }
 
-pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
+pub fn compute_abi_info<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, fty: &mut FnType<'tcx>) {
     let mut int_regs = 6; // RDI, RSI, RDX, RCX, R8, R9
     let mut sse_regs = 8; // XMM0-7
 
index cbc766c842c6b2d2ef6cfba2fdd75694fe5be41e..ad2f69213e1899ceb7401d7aea68f4be43313dda 100644 (file)
@@ -15,7 +15,7 @@
 //! closure.
 
 use attributes;
-use common::{self, CrateContext};
+use common::{self, CodegenCx};
 use consts;
 use declare;
 use llvm::{self, ValueRef};
@@ -36,7 +36,7 @@
 ///
 /// - `ccx`: the crate context
 /// - `instance`: the instance to be instantiated
-pub fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn get_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                         instance: Instance<'tcx>)
                         -> ValueRef
 {
@@ -176,7 +176,7 @@ pub fn get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     llfn
 }
 
-pub fn resolve_and_get_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn resolve_and_get_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                     def_id: DefId,
                                     substs: &'tcx Substs<'tcx>)
                                     -> ValueRef
index de0d7913be4a1f693d3668f50f21d2c2852c68ee..8f294da860900ea9e0b47bac11928517187d998f 100644 (file)
@@ -38,7 +38,7 @@
 use syntax::symbol::InternedString;
 use syntax_pos::{Span, DUMMY_SP};
 
-pub use context::CrateContext;
+pub use context::CodegenCx;
 
 pub fn type_needs_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
     ty.needs_drop(tcx, ty::ParamEnv::empty(traits::Reveal::All))
@@ -152,23 +152,23 @@ pub fn C_uint_big(t: Type, u: u128) -> ValueRef {
     }
 }
 
-pub fn C_bool(ccx: &CrateContext, val: bool) -> ValueRef {
+pub fn C_bool(ccx: &CodegenCx, val: bool) -> ValueRef {
     C_uint(Type::i1(ccx), val as u64)
 }
 
-pub fn C_i32(ccx: &CrateContext, i: i32) -> ValueRef {
+pub fn C_i32(ccx: &CodegenCx, i: i32) -> ValueRef {
     C_int(Type::i32(ccx), i as i64)
 }
 
-pub fn C_u32(ccx: &CrateContext, i: u32) -> ValueRef {
+pub fn C_u32(ccx: &CodegenCx, i: u32) -> ValueRef {
     C_uint(Type::i32(ccx), i as u64)
 }
 
-pub fn C_u64(ccx: &CrateContext, i: u64) -> ValueRef {
+pub fn C_u64(ccx: &CodegenCx, i: u64) -> ValueRef {
     C_uint(Type::i64(ccx), i)
 }
 
-pub fn C_usize(ccx: &CrateContext, i: u64) -> ValueRef {
+pub fn C_usize(ccx: &CodegenCx, i: u64) -> ValueRef {
     let bit_size = ccx.data_layout().pointer_size.bits();
     if bit_size < 64 {
         // make sure it doesn't overflow
@@ -178,14 +178,14 @@ pub fn C_usize(ccx: &CrateContext, i: u64) -> ValueRef {
     C_uint(ccx.isize_ty, i)
 }
 
-pub fn C_u8(ccx: &CrateContext, i: u8) -> ValueRef {
+pub fn C_u8(ccx: &CodegenCx, i: u8) -> ValueRef {
     C_uint(Type::i8(ccx), i as u64)
 }
 
 
 // This is a 'c-like' raw string, which differs from
 // our boxed-and-length-annotated strings.
-pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> ValueRef {
+pub fn C_cstr(cx: &CodegenCx, s: InternedString, null_terminated: bool) -> ValueRef {
     unsafe {
         if let Some(&llval) = cx.const_cstr_cache.borrow().get(&s) {
             return llval;
@@ -210,20 +210,20 @@ pub fn C_cstr(cx: &CrateContext, s: InternedString, null_terminated: bool) -> Va
 
 // 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.
-pub fn C_str_slice(cx: &CrateContext, s: InternedString) -> ValueRef {
+pub fn C_str_slice(cx: &CodegenCx, s: InternedString) -> ValueRef {
     let len = s.len();
     let cs = consts::ptrcast(C_cstr(cx, s, false),
         cx.layout_of(cx.tcx.mk_str()).llvm_type(cx).ptr_to());
     C_fat_ptr(cx, cs, C_usize(cx, len as u64))
 }
 
-pub fn C_fat_ptr(cx: &CrateContext, ptr: ValueRef, meta: ValueRef) -> ValueRef {
+pub fn C_fat_ptr(cx: &CodegenCx, ptr: ValueRef, meta: ValueRef) -> ValueRef {
     assert_eq!(abi::FAT_PTR_ADDR, 0);
     assert_eq!(abi::FAT_PTR_EXTRA, 1);
     C_struct(cx, &[ptr, meta], false)
 }
 
-pub fn C_struct(cx: &CrateContext, elts: &[ValueRef], packed: bool) -> ValueRef {
+pub fn C_struct(cx: &CodegenCx, elts: &[ValueRef], packed: bool) -> ValueRef {
     C_struct_in_context(cx.llcx, elts, packed)
 }
 
@@ -247,7 +247,7 @@ pub fn C_vector(elts: &[ValueRef]) -> ValueRef {
     }
 }
 
-pub fn C_bytes(cx: &CrateContext, bytes: &[u8]) -> ValueRef {
+pub fn C_bytes(cx: &CodegenCx, bytes: &[u8]) -> ValueRef {
     C_bytes_in_context(cx.llcx, bytes)
 }
 
@@ -382,7 +382,7 @@ pub fn shift_mask_val<'a, 'tcx>(
     }
 }
 
-pub fn ty_fn_sig<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn ty_fn_sig<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                            ty: Ty<'tcx>)
                            -> ty::PolyFnSig<'tcx>
 {
index a7e947701b5dabb58a914bc25036ecc04dbabb49..d86f68c84b7b660f5380808a5c6c53a89774f230 100644 (file)
@@ -17,7 +17,7 @@
 use debuginfo;
 use base;
 use monomorphize::{MonoItem, MonoItemExt};
-use common::{CrateContext, val_ty};
+use common::{CodegenCx, val_ty};
 use declare;
 use monomorphize::Instance;
 use type_::Type;
@@ -43,7 +43,7 @@ pub fn bitcast(val: ValueRef, ty: Type) -> ValueRef {
     }
 }
 
-fn set_global_alignment(ccx: &CrateContext,
+fn set_global_alignment(ccx: &CodegenCx,
                         gv: ValueRef,
                         mut align: Align) {
     // The target may require greater alignment for globals than the type does.
@@ -62,7 +62,7 @@ fn set_global_alignment(ccx: &CrateContext,
     }
 }
 
-pub fn addr_of_mut(ccx: &CrateContext,
+pub fn addr_of_mut(ccx: &CodegenCx,
                    cv: ValueRef,
                    align: Align,
                    kind: &str)
@@ -80,7 +80,7 @@ pub fn addr_of_mut(ccx: &CrateContext,
     }
 }
 
-pub fn addr_of(ccx: &CrateContext,
+pub fn addr_of(ccx: &CodegenCx,
                cv: ValueRef,
                align: Align,
                kind: &str)
@@ -104,7 +104,7 @@ pub fn addr_of(ccx: &CrateContext,
     gv
 }
 
-pub fn get_static(ccx: &CrateContext, def_id: DefId) -> ValueRef {
+pub fn get_static(ccx: &CodegenCx, def_id: DefId) -> ValueRef {
     let instance = Instance::mono(ccx.tcx, def_id);
     if let Some(&g) = ccx.instances.borrow().get(&instance) {
         return g;
@@ -244,7 +244,7 @@ pub fn get_static(ccx: &CrateContext, def_id: DefId) -> ValueRef {
     g
 }
 
-pub fn trans_static<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn trans_static<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                               m: hir::Mutability,
                               id: ast::NodeId,
                               attrs: &[ast::Attribute])
index e1adf6e9adf32dafbdc24f2a478cf95652bdc424..2530ac3d231c84061a873002de13cf5ff67b29b4 100644 (file)
 use syntax::symbol::InternedString;
 use abi::Abi;
 
-/// There is one `CrateContext` per compilation unit. Each one has its own LLVM
+/// There is one `CodegenCx` per compilation unit. Each one has its own LLVM
 /// `ContextRef` so that several compilation units may be optimized in parallel.
-/// All other LLVM data structures in the `CrateContext` are tied to that `ContextRef`.
-pub struct CrateContext<'a, 'tcx: 'a> {
+/// All other LLVM data structures in the `CodegenCx` are tied to that `ContextRef`.
+pub struct CodegenCx<'a, 'tcx: 'a> {
     pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
     pub check_overflow: bool,
     pub use_dll_storage_attrs: bool,
@@ -107,7 +107,7 @@ pub struct CrateContext<'a, 'tcx: 'a> {
     local_gen_sym_counter: Cell<usize>,
 }
 
-impl<'a, 'tcx> DepGraphSafe for CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> DepGraphSafe for CodegenCx<'a, 'tcx> {
 }
 
 pub fn get_reloc_model(sess: &Session) -> llvm::RelocMode {
@@ -212,11 +212,11 @@ pub unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (Cont
     (llcx, llmod)
 }
 
-impl<'a, 'tcx> CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
     pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                codegen_unit: Arc<CodegenUnit<'tcx>>,
                llmod_id: &str)
-               -> CrateContext<'a, 'tcx> {
+               -> CodegenCx<'a, 'tcx> {
         // An interesting part of Windows which MSVC forces our hand on (and
         // apparently MinGW didn't) is the usage of `dllimport` and `dllexport`
         // attributes in LLVM IR as well as native dependencies (in C these
@@ -280,7 +280,7 @@ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 None
             };
 
-            let mut ccx = CrateContext {
+            let mut ccx = CodegenCx {
                 tcx,
                 check_overflow,
                 use_dll_storage_attrs,
@@ -318,7 +318,7 @@ pub fn into_stats(self) -> Stats {
     }
 }
 
-impl<'b, 'tcx> CrateContext<'b, 'tcx> {
+impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
     pub fn sess<'a>(&'a self) -> &'a Session {
         &self.tcx.sess
     }
@@ -448,19 +448,19 @@ pub fn type_has_metadata(&self, ty: Ty<'tcx>) -> bool {
     }
 }
 
-impl<'a, 'tcx> ty::layout::HasDataLayout for &'a CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> ty::layout::HasDataLayout for &'a CodegenCx<'a, 'tcx> {
     fn data_layout(&self) -> &ty::layout::TargetDataLayout {
         &self.tcx.data_layout
     }
 }
 
-impl<'a, 'tcx> ty::layout::HasTyCtxt<'tcx> for &'a CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> ty::layout::HasTyCtxt<'tcx> for &'a CodegenCx<'a, 'tcx> {
     fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> {
         self.tcx
     }
 }
 
-impl<'a, 'tcx> LayoutOf<Ty<'tcx>> for &'a CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> LayoutOf<Ty<'tcx>> for &'a CodegenCx<'a, 'tcx> {
     type TyLayout = TyLayout<'tcx>;
 
     fn layout_of(self, ty: Ty<'tcx>) -> Self::TyLayout {
@@ -474,7 +474,7 @@ fn layout_of(self, ty: Ty<'tcx>) -> Self::TyLayout {
 }
 
 /// Declare any llvm intrinsics that you might need
-fn declare_intrinsic(ccx: &CrateContext, key: &str) -> Option<ValueRef> {
+fn declare_intrinsic(ccx: &CodegenCx, key: &str) -> Option<ValueRef> {
     macro_rules! ifn {
         ($name:expr, fn() -> $ret:expr) => (
             if key == $name {
index 95f13ea87169f30233531f5cc65e5f6b7781a03d..36131d687aead48e35b0faf761eeb07c7394026e 100644 (file)
@@ -14,7 +14,7 @@
 
 use llvm;
 use llvm::debuginfo::DIScope;
-use common::CrateContext;
+use common::CodegenCx;
 use rustc::mir::{Mir, VisibilityScope};
 
 use libc::c_uint;
@@ -44,7 +44,7 @@ pub fn is_valid(&self) -> bool {
 
 /// Produce DIScope DIEs for each MIR Scope which has variables defined in it.
 /// If debuginfo is disabled, the returned vector is empty.
-pub fn create_mir_scopes(ccx: &CrateContext, mir: &Mir, debug_context: &FunctionDebugContext)
+pub fn create_mir_scopes(ccx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebugContext)
     -> IndexVec<VisibilityScope, MirDebugScope> {
     let null_scope = MirDebugScope {
         scope_metadata: ptr::null_mut(),
@@ -77,7 +77,7 @@ pub fn create_mir_scopes(ccx: &CrateContext, mir: &Mir, debug_context: &Function
     scopes
 }
 
-fn make_mir_scope(ccx: &CrateContext,
+fn make_mir_scope(ccx: &CodegenCx,
                   mir: &Mir,
                   has_variables: &BitVector,
                   debug_context: &FunctionDebugContextData,
index 93dca03e1ff8ee71a90239a574472d7f90bc8f4a..2dea6b9dabe10b7702dd3418145176c0ccd56fc3 100644 (file)
@@ -44,7 +44,7 @@
 //! that exact file path.
 //!
 //! All private state used by the module is stored within either the
-//! CrateDebugContext struct (owned by the CrateContext) or the
+//! CrateDebugContext struct (owned by the CodegenCx) or the
 //! FunctionDebugContext (owned by the MirContext).
 //!
 //! This file consists of three conceptual sections:
index f4f2e2571555306a0a2252c33c3ae1ae93cf74bb..53d9c638197c3cf8429cf74b9f827057c222597d 100644 (file)
@@ -12,7 +12,7 @@
 
 use llvm;
 
-use common::{C_bytes, CrateContext, C_i32};
+use common::{C_bytes, CodegenCx, C_i32};
 use builder::Builder;
 use declare;
 use type_::Type;
@@ -24,7 +24,7 @@
 
 /// Inserts a side-effect free instruction sequence that makes sure that the
 /// .debug_gdb_scripts global is referenced, so it isn't removed by the linker.
-pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CrateContext, builder: &Builder) {
+pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CodegenCx, builder: &Builder) {
     if needs_gdb_debug_scripts_section(ccx) {
         let gdb_debug_scripts_section_global = get_or_insert_gdb_debug_scripts_section_global(ccx);
         // Load just the first byte as that's all that's necessary to force
@@ -40,7 +40,7 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CrateContext,
 
 /// Allocates the global variable responsible for the .debug_gdb_scripts binary
 /// section.
-pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
+pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CodegenCx)
                                                   -> llvm::ValueRef {
     let c_section_var_name = "__rustc_debug_gdb_scripts_section__\0";
     let section_var_name = &c_section_var_name[..c_section_var_name.len()-1];
@@ -77,7 +77,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
     }
 }
 
-pub fn needs_gdb_debug_scripts_section(ccx: &CrateContext) -> bool {
+pub fn needs_gdb_debug_scripts_section(ccx: &CodegenCx) -> bool {
     let omit_gdb_pretty_printer_section =
         attr::contains_name(&ccx.tcx.hir.krate_attrs(),
                             "omit_gdb_pretty_printer_section");
index 486a947edd62b23d574dec0c508bd595338a65bd..e3e4e1414fc952c500b7f26531f77794d98212eb 100644 (file)
@@ -29,7 +29,7 @@
 use rustc::ty::util::TypeIdHasher;
 use rustc::ich::Fingerprint;
 use rustc::ty::Instance;
-use common::CrateContext;
+use common::CodegenCx;
 use rustc::ty::{self, AdtKind, Ty, TyCtxt};
 use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout};
 use rustc::session::config;
@@ -133,7 +133,7 @@ fn get_unique_type_id_as_string(&self, unique_type_id: UniqueTypeId) -> &str {
     // Get the UniqueTypeId for the given type. If the UniqueTypeId for the given
     // type has been requested before, this is just a table lookup. Otherwise an
     // ID will be generated and stored for later lookup.
-    fn get_unique_type_id_of_type<'a>(&mut self, cx: &CrateContext<'a, 'tcx>,
+    fn get_unique_type_id_of_type<'a>(&mut self, cx: &CodegenCx<'a, 'tcx>,
                                       type_: Ty<'tcx>) -> UniqueTypeId {
         // Let's see if we already have something in the cache
         match self.type_to_unique_id.get(&type_).cloned() {
@@ -157,7 +157,7 @@ fn get_unique_type_id_of_type<'a>(&mut self, cx: &CrateContext<'a, 'tcx>,
     // types of their own, so they need special handling. We still need a
     // UniqueTypeId for them, since to debuginfo they *are* real types.
     fn get_unique_type_id_of_enum_variant<'a>(&mut self,
-                                              cx: &CrateContext<'a, 'tcx>,
+                                              cx: &CodegenCx<'a, 'tcx>,
                                               enum_type: Ty<'tcx>,
                                               variant_name: &str)
                                               -> UniqueTypeId {
@@ -186,7 +186,7 @@ enum RecursiveTypeDescription<'tcx> {
 }
 
 fn create_and_register_recursive_type_forward_declaration<'a, 'tcx>(
-    cx: &CrateContext<'a, 'tcx>,
+    cx: &CodegenCx<'a, 'tcx>,
     unfinished_type: Ty<'tcx>,
     unique_type_id: UniqueTypeId,
     metadata_stub: DICompositeType,
@@ -210,7 +210,7 @@ impl<'tcx> RecursiveTypeDescription<'tcx> {
     // Finishes up the description of the type in question (mostly by providing
     // descriptions of the fields of the given type) and returns the final type
     // metadata.
-    fn finalize<'a>(&self, cx: &CrateContext<'a, 'tcx>) -> MetadataCreationResult {
+    fn finalize<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> MetadataCreationResult {
         match *self {
             FinalMetadata(metadata) => MetadataCreationResult::new(metadata, false),
             UnfinishedMetadata {
@@ -262,7 +262,7 @@ macro_rules! return_if_metadata_created_in_meantime {
     )
 }
 
-fn fixed_vec_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn fixed_vec_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                 unique_type_id: UniqueTypeId,
                                 array_or_slice_type: Ty<'tcx>,
                                 element_type: Ty<'tcx>,
@@ -298,7 +298,7 @@ fn fixed_vec_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     return MetadataCreationResult::new(metadata, false);
 }
 
-fn vec_slice_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn vec_slice_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                 slice_ptr_type: Ty<'tcx>,
                                 element_type: Ty<'tcx>,
                                 unique_type_id: UniqueTypeId,
@@ -347,7 +347,7 @@ fn vec_slice_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     MetadataCreationResult::new(metadata, false)
 }
 
-fn subroutine_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn subroutine_type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                       unique_type_id: UniqueTypeId,
                                       signature: ty::PolyFnSig<'tcx>,
                                       span: Span)
@@ -386,7 +386,7 @@ fn subroutine_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 // trait_type should be the actual trait (e.g., Trait). Where the trait is part
 // of a DST struct, there is no trait_object_type and the results of this
 // function will be a little bit weird.
-fn trait_pointer_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn trait_pointer_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                     trait_type: Ty<'tcx>,
                                     trait_object_type: Option<Ty<'tcx>>,
                                     unique_type_id: UniqueTypeId)
@@ -453,7 +453,7 @@ fn trait_pointer_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                             syntax_pos::DUMMY_SP)
 }
 
-pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+pub fn type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                t: Ty<'tcx>,
                                usage_site_span: Span)
                                -> DIType {
@@ -673,7 +673,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     metadata
 }
 
-pub fn file_metadata(cx: &CrateContext,
+pub fn file_metadata(cx: &CodegenCx,
                      file_name: &FileName,
                      defining_crate: CrateNum) -> DIFile {
     debug!("file_metadata: file_name: {}, defining_crate: {}",
@@ -691,11 +691,11 @@ pub fn file_metadata(cx: &CrateContext,
     file_metadata_raw(cx, &file_name.to_string(), &directory.to_string_lossy())
 }
 
-pub fn unknown_file_metadata(cx: &CrateContext) -> DIFile {
+pub fn unknown_file_metadata(cx: &CodegenCx) -> DIFile {
     file_metadata_raw(cx, "<unknown>", "")
 }
 
-fn file_metadata_raw(cx: &CrateContext,
+fn file_metadata_raw(cx: &CodegenCx,
                      file_name: &str,
                      directory: &str)
                      -> DIFile {
@@ -721,7 +721,7 @@ fn file_metadata_raw(cx: &CrateContext,
     file_metadata
 }
 
-fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn basic_type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                  t: Ty<'tcx>) -> DIType {
 
     debug!("basic_type_metadata: {:?}", t);
@@ -758,7 +758,7 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     return ty_metadata;
 }
 
-fn foreign_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn foreign_type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                    t: Ty<'tcx>,
                                    unique_type_id: UniqueTypeId) -> DIType {
     debug!("foreign_type_metadata: {:?}", t);
@@ -767,7 +767,7 @@ fn foreign_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     create_struct_stub(cx, t, &name, unique_type_id, NO_SCOPE_METADATA)
 }
 
-fn pointer_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn pointer_type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                    pointer_type: Ty<'tcx>,
                                    pointee_type_metadata: DIType)
                                    -> DIType {
@@ -901,7 +901,7 @@ enum MemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> MemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         match *self {
             StructMDF(ref this) => {
@@ -935,7 +935,7 @@ struct StructMemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> StructMemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         let layout = cx.layout_of(self.ty);
         self.variant.fields.iter().enumerate().map(|(i, f)| {
@@ -959,7 +959,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
 }
 
 
-fn prepare_struct_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn prepare_struct_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                      struct_type: Ty<'tcx>,
                                      unique_type_id: UniqueTypeId,
                                      span: Span)
@@ -1004,7 +1004,7 @@ struct TupleMemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> TupleMemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         let layout = cx.layout_of(self.ty);
         self.component_types.iter().enumerate().map(|(i, &component_type)| {
@@ -1021,7 +1021,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
     }
 }
 
-fn prepare_tuple_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn prepare_tuple_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                     tuple_type: Ty<'tcx>,
                                     component_types: &[Ty<'tcx>],
                                     unique_type_id: UniqueTypeId,
@@ -1057,7 +1057,7 @@ struct UnionMemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> UnionMemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         self.variant.fields.iter().enumerate().map(|(i, f)| {
             let field = self.layout.field(cx, i);
@@ -1074,7 +1074,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
     }
 }
 
-fn prepare_union_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn prepare_union_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                     union_type: Ty<'tcx>,
                                     unique_type_id: UniqueTypeId,
                                     span: Span)
@@ -1125,7 +1125,7 @@ struct EnumMemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> EnumMemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         let adt = &self.enum_type.ty_adt_def().unwrap();
         match self.layout.variants {
@@ -1210,7 +1210,7 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
                 // of discriminant instead of us having to recover its path.
                 // Right now it's not even going to work for `niche_start > 0`,
                 // and for multiple niche variants it only supports the first.
-                fn compute_field_path<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+                fn compute_field_path<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                                 name: &mut String,
                                                 layout: TyLayout<'tcx>,
                                                 offset: Size,
@@ -1260,7 +1260,7 @@ struct VariantMemberDescriptionFactory<'tcx> {
 }
 
 impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
-    fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, 'tcx>)
+    fn create_member_descriptions<'a>(&self, cx: &CodegenCx<'a, 'tcx>)
                                       -> Vec<MemberDescription> {
         self.args.iter().enumerate().map(|(i, &(ref name, ty))| {
             let (size, align) = cx.size_and_align_of(ty);
@@ -1290,7 +1290,7 @@ enum EnumDiscriminantInfo {
 // of the variant, and (3) a MemberDescriptionFactory for producing the
 // descriptions of the fields of the variant. This is a rudimentary version of a
 // full RecursiveTypeDescription.
-fn describe_enum_variant<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn describe_enum_variant<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                    layout: layout::TyLayout<'tcx>,
                                    variant: &'tcx ty::VariantDef,
                                    discriminant_info: EnumDiscriminantInfo,
@@ -1350,7 +1350,7 @@ fn describe_enum_variant<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     (metadata_stub, member_description_factory)
 }
 
-fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn prepare_enum_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                    enum_type: Ty<'tcx>,
                                    enum_def_id: DefId,
                                    unique_type_id: UniqueTypeId,
@@ -1470,7 +1470,7 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         }),
     );
 
-    fn get_enum_discriminant_name(cx: &CrateContext,
+    fn get_enum_discriminant_name(cx: &CodegenCx,
                                   def_id: DefId)
                                   -> InternedString {
         cx.tcx.item_name(def_id)
@@ -1481,7 +1481,7 @@ fn get_enum_discriminant_name(cx: &CrateContext,
 /// results in a LLVM struct.
 ///
 /// Examples of Rust types to use this are: structs, tuples, boxes, vecs, and enums.
-fn composite_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn composite_type_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                      composite_type: Ty<'tcx>,
                                      composite_type_name: &str,
                                      composite_type_unique_id: UniqueTypeId,
@@ -1507,7 +1507,7 @@ fn composite_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     return composite_type_metadata;
 }
 
-fn set_members_of_composite_type(cx: &CrateContext,
+fn set_members_of_composite_type(cx: &CodegenCx,
                                  composite_type_metadata: DICompositeType,
                                  member_descriptions: &[MemberDescription]) {
     // In some rare cases LLVM metadata uniquing would lead to an existing type
@@ -1558,7 +1558,7 @@ fn set_members_of_composite_type(cx: &CrateContext,
 // A convenience wrapper around LLVMRustDIBuilderCreateStructType(). Does not do
 // any caching, does not add any fields to the struct. This can be done later
 // with set_members_of_composite_type().
-fn create_struct_stub<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn create_struct_stub<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                 struct_type: Ty<'tcx>,
                                 struct_type_name: &str,
                                 unique_type_id: UniqueTypeId,
@@ -1595,7 +1595,7 @@ fn create_struct_stub<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     return metadata_stub;
 }
 
-fn create_union_stub<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+fn create_union_stub<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                union_type: Ty<'tcx>,
                                union_type_name: &str,
                                unique_type_id: UniqueTypeId,
@@ -1633,7 +1633,7 @@ fn create_union_stub<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 /// Creates debug information for the given global variable.
 ///
 /// Adds the created metadata nodes directly to the crate's IR.
-pub fn create_global_var_metadata(cx: &CrateContext,
+pub fn create_global_var_metadata(cx: &CodegenCx,
                                   node_id: ast::NodeId,
                                   global: ValueRef) {
     if cx.dbg_cx.is_none() {
@@ -1689,7 +1689,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
 }
 
 // Creates an "extension" of an existing DIScope into another file.
-pub fn extend_scope_to_file(ccx: &CrateContext,
+pub fn extend_scope_to_file(ccx: &CodegenCx,
                             scope_metadata: DIScope,
                             file: &syntax_pos::FileMap,
                             defining_crate: CrateNum)
@@ -1707,7 +1707,7 @@ pub fn extend_scope_to_file(ccx: &CrateContext,
 /// given type.
 ///
 /// Adds the created metadata nodes directly to the crate's IR.
-pub fn create_vtable_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+pub fn create_vtable_metadata<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                         ty: ty::Ty<'tcx>,
                                         vtable: ValueRef) {
     if cx.dbg_cx.is_none() {
index c3a95d446d28bbfc7c34a95adfcb8fe790d82f01..d1609b9bf38225609b972b24f42931b8df5a01aa 100644 (file)
@@ -27,7 +27,7 @@
 use rustc::ty::subst::Substs;
 
 use abi::Abi;
-use common::CrateContext;
+use common::CodegenCx;
 use builder::Builder;
 use monomorphize::Instance;
 use rustc::ty::{self, Ty};
@@ -150,7 +150,7 @@ pub enum VariableKind {
 }
 
 /// Create any deferred debug metadata nodes
-pub fn finalize(cx: &CrateContext) {
+pub fn finalize(cx: &CodegenCx) {
     if cx.dbg_cx.is_none() {
         return;
     }
@@ -201,7 +201,7 @@ pub fn finalize(cx: &CrateContext) {
 /// for debug info creation. The function may also return another variant of the
 /// FunctionDebugContext enum which indicates why no debuginfo should be created
 /// for the function.
-pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+pub fn create_function_debug_context<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                                instance: Instance<'tcx>,
                                                sig: ty::FnSig<'tcx>,
                                                llfn: ValueRef,
@@ -299,7 +299,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
     return FunctionDebugContext::RegularContext(fn_debug_context);
 
-    fn get_function_signature<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+    fn get_function_signature<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                         sig: ty::FnSig<'tcx>) -> DIArray {
         if cx.sess().opts.debuginfo == LimitedDebugInfo {
             return create_DIArray(DIB(cx), &[]);
@@ -358,7 +358,7 @@ fn get_function_signature<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         return create_DIArray(DIB(cx), &signature[..]);
     }
 
-    fn get_template_parameters<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+    fn get_template_parameters<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                          generics: &ty::Generics,
                                          substs: &Substs<'tcx>,
                                          file_metadata: DIFile,
@@ -409,7 +409,7 @@ fn get_template_parameters<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         return create_DIArray(DIB(cx), &template_params[..]);
     }
 
-    fn get_type_parameter_names(cx: &CrateContext, generics: &ty::Generics) -> Vec<ast::Name> {
+    fn get_type_parameter_names(cx: &CodegenCx, generics: &ty::Generics) -> Vec<ast::Name> {
         let mut names = generics.parent.map_or(vec![], |def_id| {
             get_type_parameter_names(cx, cx.tcx.generics_of(def_id))
         });
@@ -417,7 +417,7 @@ fn get_type_parameter_names(cx: &CrateContext, generics: &ty::Generics) -> Vec<a
         names
     }
 
-    fn get_containing_scope<'ccx, 'tcx>(cx: &CrateContext<'ccx, 'tcx>,
+    fn get_containing_scope<'ccx, 'tcx>(cx: &CodegenCx<'ccx, 'tcx>,
                                         instance: Instance<'tcx>)
                                         -> DIScope {
         // First, let's see if this is a method within an inherent impl. Because
index 1f1015e1ed20165e90a96ea685aa7abf011c0abe..5031ad66dd5bd5c7ccb3910ec07b22218d8ccdcd 100644 (file)
 use llvm::debuginfo::DIScope;
 use rustc::hir::def_id::DefId;
 use rustc::hir::map::DefPathData;
-use common::CrateContext;
+use common::CodegenCx;
 
 use std::ffi::CString;
 use std::ptr;
 
 pub fn mangled_name_of_instance<'a, 'tcx>(
-    ccx: &CrateContext<'a, 'tcx>,
+    ccx: &CodegenCx<'a, 'tcx>,
     instance: Instance<'tcx>,
 ) -> ty::SymbolName {
      let tcx = ccx.tcx;
@@ -34,7 +34,7 @@ pub fn mangled_name_of_instance<'a, 'tcx>(
 }
 
 pub fn mangled_name_of_item<'a, 'tcx>(
-    ccx: &CrateContext<'a, 'tcx>,
+    ccx: &CodegenCx<'a, 'tcx>,
     node_id: ast::NodeId,
 ) -> ty::SymbolName {
     let tcx = ccx.tcx;
@@ -43,7 +43,7 @@ pub fn mangled_name_of_item<'a, 'tcx>(
     tcx.symbol_name(instance)
 }
 
-pub fn item_namespace(ccx: &CrateContext, def_id: DefId) -> DIScope {
+pub fn item_namespace(ccx: &CodegenCx, def_id: DefId) -> DIScope {
     if let Some(&scope) = debug_context(ccx).namespace_map.borrow().get(&def_id) {
         return scope;
     }
index 039028c8883ca3574cd8390ea4d0d4f5e417e594..0aec92b0d66cf3b4c6b4ffbc2879056f4c9be818 100644 (file)
@@ -10,7 +10,7 @@
 
 // Type Names for Debug Info.
 
-use common::CrateContext;
+use common::CodegenCx;
 use rustc::hir::def_id::DefId;
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty};
@@ -21,7 +21,7 @@
 // any caching, i.e. calling the function twice with the same type will also do
 // the work twice. The `qualified` parameter only affects the first level of the
 // type name, further levels (i.e. type parameters) are always fully qualified.
-pub fn compute_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+pub fn compute_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                              t: Ty<'tcx>,
                                              qualified: bool)
                                              -> String {
@@ -32,7 +32,7 @@ pub fn compute_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
 
 // Pushes the name of the type as it should be stored in debuginfo on the
 // `output` String. See also compute_debuginfo_type_name().
-pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                           t: Ty<'tcx>,
                                           qualified: bool,
                                           output: &mut String) {
@@ -179,7 +179,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
         }
     }
 
-    fn push_item_name(cx: &CrateContext,
+    fn push_item_name(cx: &CodegenCx,
                       def_id: DefId,
                       qualified: bool,
                       output: &mut String) {
@@ -199,7 +199,7 @@ fn push_item_name(cx: &CrateContext,
     // reconstructed for items from non-local crates. For local crates, this
     // would be possible but with inlining and LTO we have to use the least
     // common denominator - otherwise we would run into conflicts.
-    fn push_type_params<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
+    fn push_type_params<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                   substs: &Substs<'tcx>,
                                   output: &mut String) {
         if substs.types().next().is_none() {
index 18dec45ea6379bf92989410317da9d4f58e9ba43..c571b84b8e9edd64c8268f5ec9f6be5490c3343f 100644 (file)
 
 use llvm;
 use llvm::debuginfo::{DIScope, DIBuilderRef, DIDescriptor, DIArray};
-use common::{CrateContext};
+use common::{CodegenCx};
 
 use syntax_pos::{self, Span};
 use syntax::ast;
 
-pub fn is_node_local_to_unit(cx: &CrateContext, node_id: ast::NodeId) -> bool
+pub fn is_node_local_to_unit(cx: &CodegenCx, node_id: ast::NodeId) -> bool
 {
     // The is_local_to_unit flag indicates whether a function is local to the
     // current compilation unit (i.e. if it is *static* in the C-sense). The
@@ -45,23 +45,23 @@ pub fn create_DIArray(builder: DIBuilderRef, arr: &[DIDescriptor]) -> DIArray {
 }
 
 /// Return syntax_pos::Loc corresponding to the beginning of the span
-pub fn span_start(cx: &CrateContext, span: Span) -> syntax_pos::Loc {
+pub fn span_start(cx: &CodegenCx, span: Span) -> syntax_pos::Loc {
     cx.sess().codemap().lookup_char_pos(span.lo())
 }
 
 #[inline]
-pub fn debug_context<'a, 'tcx>(cx: &'a CrateContext<'a, 'tcx>)
+pub fn debug_context<'a, 'tcx>(cx: &'a CodegenCx<'a, 'tcx>)
                            -> &'a CrateDebugContext<'tcx> {
     cx.dbg_cx.as_ref().unwrap()
 }
 
 #[inline]
 #[allow(non_snake_case)]
-pub fn DIB(cx: &CrateContext) -> DIBuilderRef {
+pub fn DIB(cx: &CodegenCx) -> DIBuilderRef {
     cx.dbg_cx.as_ref().unwrap().builder
 }
 
-pub fn get_namespace_for_item(cx: &CrateContext, def_id: DefId) -> DIScope {
+pub fn get_namespace_for_item(cx: &CodegenCx, def_id: DefId) -> DIScope {
     item_namespace(cx, cx.tcx.parent(def_id)
         .expect("get_namespace_for_item: missing parent?"))
 }
index c9da7c71207b80f8ac899759836f7b5cafe39397..e92670f0abb11b2c96936f0f48fbf3ef034d1d91 100644 (file)
@@ -27,7 +27,7 @@
 use rustc_back::PanicStrategy;
 use abi::{Abi, FnType};
 use attributes;
-use context::CrateContext;
+use context::CodegenCx;
 use common;
 use type_::Type;
 use value::Value;
@@ -39,7 +39,7 @@
 ///
 /// If there’s a value with the same name already declared, the function will
 /// return its ValueRef instead.
-pub fn declare_global(ccx: &CrateContext, name: &str, ty: Type) -> llvm::ValueRef {
+pub fn declare_global(ccx: &CodegenCx, name: &str, ty: Type) -> llvm::ValueRef {
     debug!("declare_global(name={:?})", name);
     let namebuf = CString::new(name).unwrap_or_else(|_|{
         bug!("name {:?} contains an interior null byte", name)
@@ -54,7 +54,7 @@ pub fn declare_global(ccx: &CrateContext, name: &str, ty: Type) -> llvm::ValueRe
 ///
 /// If there’s a value with the same name already declared, the function will
 /// update the declaration and return existing ValueRef instead.
-fn declare_raw_fn(ccx: &CrateContext, name: &str, callconv: llvm::CallConv, ty: Type) -> ValueRef {
+fn declare_raw_fn(ccx: &CodegenCx, name: &str, callconv: llvm::CallConv, ty: Type) -> ValueRef {
     debug!("declare_raw_fn(name={:?}, ty={:?})", name, ty);
     let namebuf = CString::new(name).unwrap_or_else(|_|{
         bug!("name {:?} contains an interior null byte", name)
@@ -114,7 +114,7 @@ fn declare_raw_fn(ccx: &CrateContext, name: &str, callconv: llvm::CallConv, ty:
 ///
 /// If there’s a value with the same name already declared, the function will
 /// update the declaration and return existing ValueRef instead.
-pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type) -> ValueRef {
+pub fn declare_cfn(ccx: &CodegenCx, name: &str, fn_type: Type) -> ValueRef {
     declare_raw_fn(ccx, name, llvm::CCallConv, fn_type)
 }
 
@@ -123,7 +123,7 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type) -> ValueRef {
 ///
 /// If there’s a value with the same name already declared, the function will
 /// update the declaration and return existing ValueRef instead.
-pub fn declare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
+pub fn declare_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>, name: &str,
                             fn_type: Ty<'tcx>) -> ValueRef {
     debug!("declare_rust_fn(name={:?}, fn_type={:?})", name, fn_type);
     let sig = common::ty_fn_sig(ccx, fn_type);
@@ -154,7 +154,7 @@ pub fn declare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str,
 /// return None if the name already has a definition associated with it. In that
 /// case an error should be reported to the user, because it usually happens due
 /// to user’s fault (e.g. misuse of #[no_mangle] or #[export_name] attributes).
-pub fn define_global(ccx: &CrateContext, name: &str, ty: Type) -> Option<ValueRef> {
+pub fn define_global(ccx: &CodegenCx, name: &str, ty: Type) -> Option<ValueRef> {
     if get_defined_value(ccx, name).is_some() {
         None
     } else {
@@ -167,7 +167,7 @@ pub fn define_global(ccx: &CrateContext, name: &str, ty: Type) -> Option<ValueRe
 /// Use this function when you intend to define a function. This function will
 /// return panic if the name already has a definition associated with it. This
 /// can happen with #[no_mangle] or #[export_name], for example.
-pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn define_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                            name: &str,
                            fn_type: Ty<'tcx>) -> ValueRef {
     if get_defined_value(ccx, name).is_some() {
@@ -182,7 +182,7 @@ pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 /// Use this function when you intend to define a function. This function will
 /// return panic if the name already has a definition associated with it. This
 /// can happen with #[no_mangle] or #[export_name], for example.
-pub fn define_internal_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn define_internal_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                     name: &str,
                                     fn_type: Ty<'tcx>) -> ValueRef {
     let llfn = define_fn(ccx, name, fn_type);
@@ -192,7 +192,7 @@ pub fn define_internal_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 
 
 /// Get declared value by name.
-pub fn get_declared_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
+pub fn get_declared_value(ccx: &CodegenCx, name: &str) -> Option<ValueRef> {
     debug!("get_declared_value(name={:?})", name);
     let namebuf = CString::new(name).unwrap_or_else(|_|{
         bug!("name {:?} contains an interior null byte", name)
@@ -209,7 +209,7 @@ pub fn get_declared_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
 
 /// Get defined or externally defined (AvailableExternally linkage) value by
 /// name.
-pub fn get_defined_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
+pub fn get_defined_value(ccx: &CodegenCx, name: &str) -> Option<ValueRef> {
     get_declared_value(ccx, name).and_then(|val|{
         let declaration = unsafe {
             llvm::LLVMIsDeclaration(val) != 0
index 42dd58c59c9ad7134449f00764671bb83eca85c5..fa8ed74493118f8ace7586718910ecbd571b0d75 100644 (file)
@@ -35,7 +35,7 @@
 use std::cmp::Ordering;
 use std::iter;
 
-fn get_simple_intrinsic(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
+fn get_simple_intrinsic(ccx: &CodegenCx, name: &str) -> Option<ValueRef> {
     let llvm_name = match name {
         "sqrtf32" => "llvm.sqrt.f32",
         "sqrtf64" => "llvm.sqrt.f64",
@@ -565,7 +565,7 @@ fn one<T>(x: Vec<T>) -> T {
                 assert_eq!(x.len(), 1);
                 x.into_iter().next().unwrap()
             }
-            fn ty_to_type(ccx: &CrateContext, t: &intrinsics::Type) -> Vec<Type> {
+            fn ty_to_type(ccx: &CodegenCx, t: &intrinsics::Type) -> Vec<Type> {
                 use intrinsics::Type::*;
                 match *t {
                     Void => vec![Type::void(ccx)],
@@ -750,7 +750,7 @@ fn memset_intrinsic<'a, 'tcx>(
 
 fn try_intrinsic<'a, 'tcx>(
     bcx: &Builder<'a, 'tcx>,
-    ccx: &CrateContext,
+    ccx: &CodegenCx,
     func: ValueRef,
     data: ValueRef,
     local_ptr: ValueRef,
@@ -775,7 +775,7 @@ fn try_intrinsic<'a, 'tcx>(
 // writing, however, LLVM does not recommend the usage of these new instructions
 // as the old ones are still more optimized.
 fn trans_msvc_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
-                            ccx: &CrateContext,
+                            ccx: &CodegenCx,
                             func: ValueRef,
                             data: ValueRef,
                             local_ptr: ValueRef,
@@ -883,7 +883,7 @@ fn trans_msvc_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
 // functions in play. By calling a shim we're guaranteed that our shim will have
 // the right personality function.
 fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
-                           ccx: &CrateContext,
+                           ccx: &CodegenCx,
                            func: ValueRef,
                            data: ValueRef,
                            local_ptr: ValueRef,
@@ -942,7 +942,7 @@ fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
 
 // Helper function to give a Block to a closure to translate a shim function.
 // This is currently primarily used for the `try` intrinsic functions above.
-fn gen_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn gen_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                     name: &str,
                     inputs: Vec<Ty<'tcx>>,
                     output: Ty<'tcx>,
@@ -965,7 +965,7 @@ fn gen_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 // catch exceptions.
 //
 // This function is only generated once and is then cached.
-fn get_rust_try_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn get_rust_try_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              trans: &mut for<'b> FnMut(Builder<'b, 'tcx>))
                              -> ValueRef {
     if let Some(llfn) = ccx.rust_try_fn.get() {
@@ -1243,7 +1243,7 @@ macro_rules! arith {
 // Returns None if the type is not an integer
 // FIXME: there’s multiple of this functions, investigate using some of the already existing
 // stuffs.
-fn int_type_width_signed(ty: Ty, ccx: &CrateContext) -> Option<(u64, bool)> {
+fn int_type_width_signed(ty: Ty, ccx: &CodegenCx) -> Option<(u64, bool)> {
     match ty.sty {
         ty::TyInt(t) => Some((match t {
             ast::IntTy::Isize => {
index 8154df1e537d81c0e68e689b77e1577f28c2ad2f..be6f035e08959d9efd35d604bd63f2685b0d080e 100644 (file)
@@ -69,7 +69,7 @@ pub fn get_usize(self, bcx: &Builder<'a, 'tcx>, llvtable: ValueRef) -> ValueRef
 /// The `trait_ref` encodes the erased self type. Hence if we are
 /// making an object `Foo<Trait>` from a value of type `Foo<T>`, then
 /// `trait_ref` would map `T:Trait`.
-pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+pub fn get_vtable<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                             ty: Ty<'tcx>,
                             trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>)
                             -> ValueRef
index 68e0855701cfb7e8f96bf0419bc855bc1af2244d..bce0cb868f5e04c588bb1d0ab931459e72d081b4 100644 (file)
@@ -27,7 +27,7 @@
 use abi::{self, Abi};
 use callee;
 use builder::Builder;
-use common::{self, CrateContext, const_get_elt, val_ty};
+use common::{self, CodegenCx, const_get_elt, val_ty};
 use common::{C_array, C_bool, C_bytes, C_int, C_uint, C_uint_big, C_u32, C_u64};
 use common::{C_null, C_struct, C_str_slice, C_undef, C_usize, C_vector, C_fat_ptr};
 use common::const_to_opt_u128;
@@ -62,7 +62,7 @@ pub fn new(llval: ValueRef, ty: Ty<'tcx>) -> Const<'tcx> {
         }
     }
 
-    pub fn from_constint(ccx: &CrateContext<'a, 'tcx>, ci: &ConstInt) -> Const<'tcx> {
+    pub fn from_constint(ccx: &CodegenCx<'a, 'tcx>, ci: &ConstInt) -> Const<'tcx> {
         let tcx = ccx.tcx;
         let (llval, ty) = match *ci {
             I8(v) => (C_int(Type::i8(ccx), v as i64), tcx.types.i8),
@@ -82,7 +82,7 @@ pub fn from_constint(ccx: &CrateContext<'a, 'tcx>, ci: &ConstInt) -> Const<'tcx>
     }
 
     /// Translate ConstVal into a LLVM constant value.
-    pub fn from_constval(ccx: &CrateContext<'a, 'tcx>,
+    pub fn from_constval(ccx: &CodegenCx<'a, 'tcx>,
                          cv: &ConstVal,
                          ty: Ty<'tcx>)
                          -> Const<'tcx> {
@@ -115,7 +115,7 @@ pub fn from_constval(ccx: &CrateContext<'a, 'tcx>,
         Const::new(val, ty)
     }
 
-    fn get_field(&self, ccx: &CrateContext<'a, 'tcx>, i: usize) -> ValueRef {
+    fn get_field(&self, ccx: &CodegenCx<'a, 'tcx>, i: usize) -> ValueRef {
         let layout = ccx.layout_of(self.ty);
         let field = layout.field(ccx, i);
         if field.is_zst() {
@@ -145,11 +145,11 @@ fn get_field(&self, ccx: &CrateContext<'a, 'tcx>, i: usize) -> ValueRef {
         }
     }
 
-    fn get_pair(&self, ccx: &CrateContext<'a, 'tcx>) -> (ValueRef, ValueRef) {
+    fn get_pair(&self, ccx: &CodegenCx<'a, 'tcx>) -> (ValueRef, ValueRef) {
         (self.get_field(ccx, 0), self.get_field(ccx, 1))
     }
 
-    fn get_fat_ptr(&self, ccx: &CrateContext<'a, 'tcx>) -> (ValueRef, ValueRef) {
+    fn get_fat_ptr(&self, ccx: &CodegenCx<'a, 'tcx>) -> (ValueRef, ValueRef) {
         assert_eq!(abi::FAT_PTR_ADDR, 0);
         assert_eq!(abi::FAT_PTR_EXTRA, 1);
         self.get_pair(ccx)
@@ -163,7 +163,7 @@ fn as_place(&self) -> ConstPlace<'tcx> {
         }
     }
 
-    pub fn to_operand(&self, ccx: &CrateContext<'a, 'tcx>) -> OperandRef<'tcx> {
+    pub fn to_operand(&self, ccx: &CodegenCx<'a, 'tcx>) -> OperandRef<'tcx> {
         let layout = ccx.layout_of(self.ty);
         let llty = layout.immediate_llvm_type(ccx);
         let llvalty = val_ty(self.llval);
@@ -232,7 +232,7 @@ fn to_const(&self, span: Span) -> Const<'tcx> {
         }
     }
 
-    pub fn len<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> ValueRef {
+    pub fn len<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> ValueRef {
         match self.ty.sty {
             ty::TyArray(_, n) => {
                 C_usize(ccx, n.val.to_const_int().unwrap().to_u64().unwrap())
@@ -249,7 +249,7 @@ pub fn len<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> ValueRef {
 /// Machinery for translating a constant's MIR to LLVM values.
 /// FIXME(eddyb) use miri and lower its allocations to LLVM.
 struct MirConstContext<'a, 'tcx: 'a> {
-    ccx: &'a CrateContext<'a, 'tcx>,
+    ccx: &'a CodegenCx<'a, 'tcx>,
     mir: &'a mir::Mir<'tcx>,
 
     /// Type parameters for const fn and associated constants.
@@ -270,7 +270,7 @@ fn add_err<'tcx, U, V>(failure: &mut Result<U, ConstEvalErr<'tcx>>,
 }
 
 impl<'a, 'tcx> MirConstContext<'a, 'tcx> {
-    fn new(ccx: &'a CrateContext<'a, 'tcx>,
+    fn new(ccx: &'a CodegenCx<'a, 'tcx>,
            mir: &'a mir::Mir<'tcx>,
            substs: &'tcx Substs<'tcx>,
            args: IndexVec<mir::Local, Result<Const<'tcx>, ConstEvalErr<'tcx>>>)
@@ -289,7 +289,7 @@ fn new(ccx: &'a CrateContext<'a, 'tcx>,
         context
     }
 
-    fn trans_def(ccx: &'a CrateContext<'a, 'tcx>,
+    fn trans_def(ccx: &'a CodegenCx<'a, 'tcx>,
                  def_id: DefId,
                  substs: &'tcx Substs<'tcx>,
                  args: IndexVec<mir::Local, Result<Const<'tcx>, ConstEvalErr<'tcx>>>)
@@ -1060,7 +1060,7 @@ pub fn const_scalar_checked_binop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 }
 
-unsafe fn cast_const_float_to_int(ccx: &CrateContext,
+unsafe fn cast_const_float_to_int(ccx: &CodegenCx,
                                   operand: &Const,
                                   signed: bool,
                                   int_ty: Type,
@@ -1095,7 +1095,7 @@ unsafe fn cast_const_float_to_int(ccx: &CrateContext,
     C_uint_big(int_ty, cast_result.value)
 }
 
-unsafe fn cast_const_int_to_float(ccx: &CrateContext,
+unsafe fn cast_const_int_to_float(ccx: &CodegenCx,
                                   llval: ValueRef,
                                   signed: bool,
                                   float_ty: Type) -> ValueRef {
@@ -1154,7 +1154,7 @@ pub fn trans_constant(&mut self,
 
 
 pub fn trans_static_initializer<'a, 'tcx>(
-    ccx: &CrateContext<'a, 'tcx>,
+    ccx: &CodegenCx<'a, 'tcx>,
     def_id: DefId)
     -> Result<ValueRef, ConstEvalErr<'tcx>>
 {
@@ -1182,7 +1182,7 @@ pub fn trans_static_initializer<'a, 'tcx>(
 /// this could be changed in the future to avoid allocating unnecessary
 /// space after values of shorter-than-maximum cases.
 fn trans_const_adt<'a, 'tcx>(
-    ccx: &CrateContext<'a, 'tcx>,
+    ccx: &CodegenCx<'a, 'tcx>,
     t: Ty<'tcx>,
     kind: &mir::AggregateKind,
     vals: &[Const<'tcx>]
@@ -1272,7 +1272,7 @@ fn trans_const_adt<'a, 'tcx>(
 /// initializer is 4-byte aligned then simply translating the tuple as
 /// a two-element struct will locate it at offset 4, and accesses to it
 /// will read the wrong memory.
-fn build_const_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn build_const_struct<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                 layout: layout::TyLayout<'tcx>,
                                 vals: &[Const<'tcx>],
                                 discr: Option<Const<'tcx>>)
@@ -1332,6 +1332,6 @@ fn build_const_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     Const::new(C_struct(ccx, &cfields, packed), layout.ty)
 }
 
-fn padding(ccx: &CrateContext, size: Size) -> ValueRef {
+fn padding(ccx: &CodegenCx, size: Size) -> ValueRef {
     C_undef(Type::array(&Type::i8(ccx), size.bytes()))
 }
index 2d23bf3e6993598ff113e77f43bfe7f753cda516..4b24f0cf671a14d5676755b3ff8c5b9613baf299 100644 (file)
@@ -19,7 +19,7 @@
 use rustc::session::config::FullDebugInfo;
 use base;
 use builder::Builder;
-use common::{CrateContext, Funclet};
+use common::{CodegenCx, Funclet};
 use debuginfo::{self, declare_local, VariableAccess, VariableKind, FunctionDebugContext};
 use monomorphize::Instance;
 use abi::{ArgAttribute, FnType, PassMode};
@@ -48,7 +48,7 @@ pub struct MirContext<'a, 'tcx:'a> {
 
     llfn: ValueRef,
 
-    ccx: &'a CrateContext<'a, 'tcx>,
+    ccx: &'a CodegenCx<'a, 'tcx>,
 
     fn_ty: FnType<'tcx>,
 
@@ -176,7 +176,7 @@ enum LocalRef<'tcx> {
 }
 
 impl<'a, 'tcx> LocalRef<'tcx> {
-    fn new_operand(ccx: &CrateContext<'a, 'tcx>, layout: TyLayout<'tcx>) -> LocalRef<'tcx> {
+    fn new_operand(ccx: &CodegenCx<'a, 'tcx>, layout: TyLayout<'tcx>) -> LocalRef<'tcx> {
         if layout.is_zst() {
             // Zero-size temporaries aren't always initialized, which
             // doesn't matter because they don't contain data, but
@@ -191,7 +191,7 @@ fn new_operand(ccx: &CrateContext<'a, 'tcx>, layout: TyLayout<'tcx>) -> LocalRef
 ///////////////////////////////////////////////////////////////////////////
 
 pub fn trans_mir<'a, 'tcx: 'a>(
-    ccx: &'a CrateContext<'a, 'tcx>,
+    ccx: &'a CodegenCx<'a, 'tcx>,
     llfn: ValueRef,
     mir: &'a Mir<'tcx>,
     instance: Instance<'tcx>,
index 05af48761a1679d87c54a0422b3a71e04980658c..daf2a36d7a2e0df656625d5886adeae2d3cd779a 100644 (file)
@@ -15,7 +15,7 @@
 use rustc_data_structures::indexed_vec::Idx;
 
 use base;
-use common::{self, CrateContext, C_undef, C_usize};
+use common::{self, CodegenCx, C_undef, C_usize};
 use builder::Builder;
 use value::Value;
 use type_of::LayoutLlvmExt;
@@ -81,7 +81,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl<'a, 'tcx> OperandRef<'tcx> {
-    pub fn new_zst(ccx: &CrateContext<'a, 'tcx>,
+    pub fn new_zst(ccx: &CodegenCx<'a, 'tcx>,
                    layout: TyLayout<'tcx>) -> OperandRef<'tcx> {
         assert!(layout.is_zst());
         OperandRef {
@@ -99,7 +99,7 @@ pub fn immediate(self) -> ValueRef {
         }
     }
 
-    pub fn deref(self, ccx: &CrateContext<'a, 'tcx>) -> PlaceRef<'tcx> {
+    pub fn deref(self, ccx: &CodegenCx<'a, 'tcx>) -> PlaceRef<'tcx> {
         let projected_ty = self.layout.ty.builtin_deref(true, ty::NoPreference)
             .unwrap_or_else(|| bug!("deref of non-pointer {:?}", self)).ty;
         let (llptr, llextra) = match self.val {
index e9569df60d591f89c31d4c19be351f9d8f20ee3e..748bea1fc7539a27bc7d5b2f9b1c109eada65737 100644 (file)
@@ -16,7 +16,7 @@
 use rustc_data_structures::indexed_vec::Idx;
 use base;
 use builder::Builder;
-use common::{CrateContext, C_usize, C_u8, C_u32, C_uint, C_int, C_null, C_uint_big};
+use common::{CodegenCx, C_usize, C_u8, C_u32, C_uint, C_int, C_null, C_uint_big};
 use consts;
 use type_of::LayoutLlvmExt;
 use type_::Type;
@@ -63,7 +63,7 @@ pub fn alloca(bcx: &Builder<'a, 'tcx>, layout: TyLayout<'tcx>, name: &str)
         Self::new_sized(tmp, layout, layout.align)
     }
 
-    pub fn len(&self, ccx: &CrateContext<'a, 'tcx>) -> ValueRef {
+    pub fn len(&self, ccx: &CodegenCx<'a, 'tcx>) -> ValueRef {
         if let layout::FieldPlacement::Array { count, .. } = self.layout.fields {
             if self.layout.is_unsized() {
                 assert!(self.has_extra());
index a01a786303c87fd94e70d7413493bf02bdbf9de5..eafc3d2fafba34c770eef59337825d30f40d7970 100644 (file)
@@ -18,7 +18,7 @@
 use attributes;
 use base;
 use consts;
-use context::CrateContext;
+use context::CodegenCx;
 use declare;
 use llvm;
 use monomorphize::Instance;
@@ -38,7 +38,7 @@
 pub use rustc_mir::monomorphize::item::MonoItemExt as BaseMonoItemExt;
 
 pub trait MonoItemExt<'a, 'tcx>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> {
-    fn define(&self, ccx: &CrateContext<'a, 'tcx>) {
+    fn define(&self, ccx: &CodegenCx<'a, 'tcx>) {
         debug!("BEGIN IMPLEMENTING '{} ({})' in cgu {}",
                self.to_string(ccx.tcx),
                self.to_raw_string(),
@@ -79,7 +79,7 @@ fn define(&self, ccx: &CrateContext<'a, 'tcx>) {
     }
 
     fn predefine(&self,
-                 ccx: &CrateContext<'a, 'tcx>,
+                 ccx: &CodegenCx<'a, 'tcx>,
                  linkage: Linkage,
                  visibility: Visibility) {
         debug!("BEGIN PREDEFINING '{} ({})' in cgu {}",
@@ -138,7 +138,7 @@ fn to_raw_string(&self) -> String {
 
 impl<'a, 'tcx> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {}
 
-fn predefine_static<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn predefine_static<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                               node_id: ast::NodeId,
                               linkage: Linkage,
                               visibility: Visibility,
@@ -162,7 +162,7 @@ fn predefine_static<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     ccx.statics.borrow_mut().insert(g, def_id);
 }
 
-fn predefine_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn predefine_fn<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                           instance: Instance<'tcx>,
                           linkage: Linkage,
                           visibility: Visibility,
index 5c826399e72f5e1b36ed070e6e9b4f0ad970fe8d..75145eb4416d03223fe17cc787e53f5c21480248 100644 (file)
@@ -14,7 +14,7 @@
 use llvm::{ContextRef, TypeRef, Bool, False, True, TypeKind};
 use llvm::{Float, Double, X86_FP80, PPC_FP128, FP128};
 
-use context::CrateContext;
+use context::CodegenCx;
 
 use syntax::ast;
 use rustc::ty::layout::{self, Align, Size};
@@ -62,19 +62,19 @@ pub fn to_ref_slice(slice: &[Type]) -> &[TypeRef] {
         unsafe { mem::transmute(slice) }
     }
 
-    pub fn void(ccx: &CrateContext) -> Type {
+    pub fn void(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMVoidTypeInContext(ccx.llcx))
     }
 
-    pub fn metadata(ccx: &CrateContext) -> Type {
+    pub fn metadata(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMRustMetadataTypeInContext(ccx.llcx))
     }
 
-    pub fn i1(ccx: &CrateContext) -> Type {
+    pub fn i1(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMInt1TypeInContext(ccx.llcx))
     }
 
-    pub fn i8(ccx: &CrateContext) -> Type {
+    pub fn i8(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMInt8TypeInContext(ccx.llcx))
     }
 
@@ -82,44 +82,44 @@ pub fn i8_llcx(llcx: ContextRef) -> Type {
         ty!(llvm::LLVMInt8TypeInContext(llcx))
     }
 
-    pub fn i16(ccx: &CrateContext) -> Type {
+    pub fn i16(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMInt16TypeInContext(ccx.llcx))
     }
 
-    pub fn i32(ccx: &CrateContext) -> Type {
+    pub fn i32(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMInt32TypeInContext(ccx.llcx))
     }
 
-    pub fn i64(ccx: &CrateContext) -> Type {
+    pub fn i64(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMInt64TypeInContext(ccx.llcx))
     }
 
-    pub fn i128(ccx: &CrateContext) -> Type {
+    pub fn i128(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMIntTypeInContext(ccx.llcx, 128))
     }
 
     // Creates an integer type with the given number of bits, e.g. i24
-    pub fn ix(ccx: &CrateContext, num_bits: u64) -> Type {
+    pub fn ix(ccx: &CodegenCx, num_bits: u64) -> Type {
         ty!(llvm::LLVMIntTypeInContext(ccx.llcx, num_bits as c_uint))
     }
 
-    pub fn f32(ccx: &CrateContext) -> Type {
+    pub fn f32(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMFloatTypeInContext(ccx.llcx))
     }
 
-    pub fn f64(ccx: &CrateContext) -> Type {
+    pub fn f64(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMDoubleTypeInContext(ccx.llcx))
     }
 
-    pub fn bool(ccx: &CrateContext) -> Type {
+    pub fn bool(ccx: &CodegenCx) -> Type {
         Type::i8(ccx)
     }
 
-    pub fn char(ccx: &CrateContext) -> Type {
+    pub fn char(ccx: &CodegenCx) -> Type {
         Type::i32(ccx)
     }
 
-    pub fn i8p(ccx: &CrateContext) -> Type {
+    pub fn i8p(ccx: &CodegenCx) -> Type {
         Type::i8(ccx).ptr_to()
     }
 
@@ -127,7 +127,7 @@ pub fn i8p_llcx(llcx: ContextRef) -> Type {
         Type::i8_llcx(llcx).ptr_to()
     }
 
-    pub fn isize(ccx: &CrateContext) -> Type {
+    pub fn isize(ccx: &CodegenCx) -> Type {
         match &ccx.tcx.sess.target.target.target_pointer_width[..] {
             "16" => Type::i16(ccx),
             "32" => Type::i32(ccx),
@@ -136,7 +136,7 @@ pub fn isize(ccx: &CrateContext) -> Type {
         }
     }
 
-    pub fn c_int(ccx: &CrateContext) -> Type {
+    pub fn c_int(ccx: &CodegenCx) -> Type {
         match &ccx.tcx.sess.target.target.target_c_int_width[..] {
             "16" => Type::i16(ccx),
             "32" => Type::i32(ccx),
@@ -145,7 +145,7 @@ pub fn c_int(ccx: &CrateContext) -> Type {
         }
     }
 
-    pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type {
+    pub fn int_from_ty(ccx: &CodegenCx, t: ast::IntTy) -> Type {
         match t {
             ast::IntTy::Isize => ccx.isize_ty,
             ast::IntTy::I8 => Type::i8(ccx),
@@ -156,7 +156,7 @@ pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type {
         }
     }
 
-    pub fn uint_from_ty(ccx: &CrateContext, t: ast::UintTy) -> Type {
+    pub fn uint_from_ty(ccx: &CodegenCx, t: ast::UintTy) -> Type {
         match t {
             ast::UintTy::Usize => ccx.isize_ty,
             ast::UintTy::U8 => Type::i8(ccx),
@@ -167,7 +167,7 @@ pub fn uint_from_ty(ccx: &CrateContext, t: ast::UintTy) -> Type {
         }
     }
 
-    pub fn float_from_ty(ccx: &CrateContext, t: ast::FloatTy) -> Type {
+    pub fn float_from_ty(ccx: &CodegenCx, t: ast::FloatTy) -> Type {
         match t {
             ast::FloatTy::F32 => Type::f32(ccx),
             ast::FloatTy::F64 => Type::f64(ccx),
@@ -186,14 +186,14 @@ pub fn variadic_func(args: &[Type], ret: &Type) -> Type {
                                    args.len() as c_uint, True))
     }
 
-    pub fn struct_(ccx: &CrateContext, els: &[Type], packed: bool) -> Type {
+    pub fn struct_(ccx: &CodegenCx, els: &[Type], packed: bool) -> Type {
         let els: &[TypeRef] = Type::to_ref_slice(els);
         ty!(llvm::LLVMStructTypeInContext(ccx.llcx, els.as_ptr(),
                                           els.len() as c_uint,
                                           packed as Bool))
     }
 
-    pub fn named_struct(ccx: &CrateContext, name: &str) -> Type {
+    pub fn named_struct(ccx: &CodegenCx, name: &str) -> Type {
         let name = CString::new(name).unwrap();
         ty!(llvm::LLVMStructCreateNamed(ccx.llcx, name.as_ptr()))
     }
@@ -265,7 +265,7 @@ pub fn int_width(&self) -> u64 {
         }
     }
 
-    pub fn from_integer(cx: &CrateContext, i: layout::Integer) -> Type {
+    pub fn from_integer(cx: &CodegenCx, i: layout::Integer) -> Type {
         use rustc::ty::layout::Integer::*;
         match i {
             I8 => Type::i8(cx),
@@ -278,7 +278,7 @@ pub fn from_integer(cx: &CrateContext, i: layout::Integer) -> Type {
 
     /// Return a LLVM type that has at most the required alignment,
     /// as a conservative approximation for unknown pointee types.
-    pub fn pointee_for_abi_align(ccx: &CrateContext, align: Align) -> Type {
+    pub fn pointee_for_abi_align(ccx: &CodegenCx, align: Align) -> Type {
         // FIXME(eddyb) We could find a better approximation if ity.align < align.
         let ity = layout::Integer::approximate_abi_align(ccx, align);
         Type::from_integer(ccx, ity)
@@ -286,7 +286,7 @@ pub fn pointee_for_abi_align(ccx: &CrateContext, align: Align) -> Type {
 
     /// Return a LLVM type that has at most the required alignment,
     /// and exactly the required size, as a best-effort padding array.
-    pub fn padding_filler(ccx: &CrateContext, size: Size, align: Align) -> Type {
+    pub fn padding_filler(ccx: &CodegenCx, size: Size, align: Align) -> Type {
         let unit = layout::Integer::approximate_abi_align(ccx, align);
         let size = size.bytes();
         let unit_size = unit.size().bytes();
@@ -294,7 +294,7 @@ pub fn padding_filler(ccx: &CrateContext, size: Size, align: Align) -> Type {
         Type::array(&Type::from_integer(ccx, unit), size / unit_size)
     }
 
-    pub fn x86_mmx(ccx: &CrateContext) -> Type {
+    pub fn x86_mmx(ccx: &CodegenCx) -> Type {
         ty!(llvm::LLVMX86MMXTypeInContext(ccx.llcx))
     }
 }
index 325e62e41735dcf7fb4f63342152c28d53dfc88f..47c9f5661df223abe7ef90f835244d982331c119 100644 (file)
@@ -19,7 +19,7 @@
 
 use std::fmt::Write;
 
-fn uncached_llvm_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn uncached_llvm_type<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                                 layout: TyLayout<'tcx>,
                                 defer: &mut Option<(Type, TyLayout<'tcx>)>)
                                 -> Type {
@@ -110,7 +110,7 @@ fn uncached_llvm_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     }
 }
 
-fn struct_llfields<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
+fn struct_llfields<'a, 'tcx>(ccx: &CodegenCx<'a, 'tcx>,
                              layout: TyLayout<'tcx>)
                              -> (Vec<Type>, bool) {
     debug!("struct_llfields: {:#?}", layout);
@@ -158,7 +158,7 @@ fn struct_llfields<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     (result, packed)
 }
 
-impl<'a, 'tcx> CrateContext<'a, 'tcx> {
+impl<'a, 'tcx> CodegenCx<'a, 'tcx> {
     pub fn align_of(&self, ty: Ty<'tcx>) -> Align {
         self.layout_of(ty).align
     }
@@ -197,14 +197,14 @@ pub struct PointeeInfo {
 pub trait LayoutLlvmExt<'tcx> {
     fn is_llvm_immediate(&self) -> bool;
     fn is_llvm_scalar_pair<'a>(&self) -> bool;
-    fn llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type;
-    fn immediate_llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type;
-    fn scalar_llvm_type_at<'a>(&self, ccx: &CrateContext<'a, 'tcx>,
+    fn llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type;
+    fn immediate_llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type;
+    fn scalar_llvm_type_at<'a>(&self, ccx: &CodegenCx<'a, 'tcx>,
                                scalar: &layout::Scalar, offset: Size) -> Type;
-    fn scalar_pair_element_llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>,
+    fn scalar_pair_element_llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>,
                                          index: usize) -> Type;
     fn llvm_field_index(&self, index: usize) -> u64;
-    fn pointee_info_at<'a>(&self, ccx: &CrateContext<'a, 'tcx>, offset: Size)
+    fn pointee_info_at<'a>(&self, ccx: &CodegenCx<'a, 'tcx>, offset: Size)
                            -> Option<PointeeInfo>;
 }
 
@@ -240,7 +240,7 @@ fn is_llvm_scalar_pair<'a>(&self) -> bool {
     /// with the inner-most trailing unsized field using the "minimal unit"
     /// of that field's type - this is useful for taking the address of
     /// that field and ensuring the struct has the right alignment.
-    fn llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
+    fn llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type {
         if let layout::Abi::Scalar(ref scalar) = self.abi {
             // Use a different cache for scalars because pointers to DSTs
             // can be either fat or thin (data pointers of fat pointers).
@@ -305,7 +305,7 @@ fn llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
         llty
     }
 
-    fn immediate_llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
+    fn immediate_llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>) -> Type {
         if let layout::Abi::Scalar(ref scalar) = self.abi {
             if scalar.is_bool() {
                 return Type::i1(ccx);
@@ -314,7 +314,7 @@ fn immediate_llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> Type {
         self.llvm_type(ccx)
     }
 
-    fn scalar_llvm_type_at<'a>(&self, ccx: &CrateContext<'a, 'tcx>,
+    fn scalar_llvm_type_at<'a>(&self, ccx: &CodegenCx<'a, 'tcx>,
                                scalar: &layout::Scalar, offset: Size) -> Type {
         match scalar.value {
             layout::Int(i, _) => Type::from_integer(ccx, i),
@@ -332,7 +332,7 @@ fn scalar_llvm_type_at<'a>(&self, ccx: &CrateContext<'a, 'tcx>,
         }
     }
 
-    fn scalar_pair_element_llvm_type<'a>(&self, ccx: &CrateContext<'a, 'tcx>,
+    fn scalar_pair_element_llvm_type<'a>(&self, ccx: &CodegenCx<'a, 'tcx>,
                                          index: usize) -> Type {
         // HACK(eddyb) special-case fat pointers until LLVM removes
         // pointee types, to avoid bitcasting every `OperandRef::deref`.
@@ -396,7 +396,7 @@ fn llvm_field_index(&self, index: usize) -> u64 {
         }
     }
 
-    fn pointee_info_at<'a>(&self, ccx: &CrateContext<'a, 'tcx>, offset: Size)
+    fn pointee_info_at<'a>(&self, ccx: &CodegenCx<'a, 'tcx>, offset: Size)
                            -> Option<PointeeInfo> {
         if let Some(&pointee) = ccx.pointee_infos.borrow().get(&(self.ty, offset)) {
             return pointee;