diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 99eed04b5589..92d1c176a1b9 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -66,7 +66,6 @@ pub mod back { pub mod lto; } ->>>>>>> Extract librustc_back from librustc pub mod middle { pub mod def; diff --git a/src/librustc/middle/trans/intrinsic.rs b/src/librustc/middle/trans/intrinsic.rs index af5cdf7a1be7..bb33a5e4f8d2 100644 --- a/src/librustc/middle/trans/intrinsic.rs +++ b/src/librustc/middle/trans/intrinsic.rs @@ -426,13 +426,13 @@ pub fn trans_intrinsic_call<'a>(mut bcx: &'a Block<'a>, node: ast::NodeId, assert!(split.len() >= 2, "Atomic intrinsic not correct format"); let order = if split.len() == 2 { - lib::llvm::SequentiallyConsistent + llvm::SequentiallyConsistent } else { match *split.get(2) { - "relaxed" => lib::llvm::Monotonic, - "acq" => lib::llvm::Acquire, - "rel" => lib::llvm::Release, - "acqrel" => lib::llvm::AcquireRelease, + "relaxed" => llvm::Monotonic, + "acq" => llvm::Acquire, + "rel" => llvm::Release, + "acqrel" => llvm::AcquireRelease, _ => ccx.sess().fatal("unknown ordering in atomic intrinsic") } }; @@ -443,23 +443,23 @@ pub fn trans_intrinsic_call<'a>(mut bcx: &'a Block<'a>, node: ast::NodeId, // of this, I assume that it's good enough for us to use for // now. let strongest_failure_ordering = match order { - lib::llvm::NotAtomic | lib::llvm::Unordered => + llvm::NotAtomic | llvm::Unordered => ccx.sess().fatal("cmpxchg must be atomic"), - lib::llvm::Monotonic | lib::llvm::Release => - lib::llvm::Monotonic, + llvm::Monotonic | llvm::Release => + llvm::Monotonic, - lib::llvm::Acquire | lib::llvm::AcquireRelease => - lib::llvm::Acquire, + llvm::Acquire | llvm::AcquireRelease => + llvm::Acquire, - lib::llvm::SequentiallyConsistent => - lib::llvm::SequentiallyConsistent + llvm::SequentiallyConsistent => + llvm::SequentiallyConsistent }; let res = AtomicCmpXchg(bcx, *llargs.get(0), *llargs.get(1), *llargs.get(2), order, strongest_failure_ordering); - if unsafe { lib::llvm::llvm::LLVMVersionMinor() >= 5 } { + if unsafe { llvm::LLVMVersionMinor() >= 5 } { ExtractValue(bcx, res, 0) } else { res @@ -482,17 +482,17 @@ pub fn trans_intrinsic_call<'a>(mut bcx: &'a Block<'a>, node: ast::NodeId, // These are all AtomicRMW ops op => { let atom_op = match op { - "xchg" => lib::llvm::Xchg, - "xadd" => lib::llvm::Add, - "xsub" => lib::llvm::Sub, - "and" => lib::llvm::And, - "nand" => lib::llvm::Nand, - "or" => lib::llvm::Or, - "xor" => lib::llvm::Xor, - "max" => lib::llvm::Max, - "min" => lib::llvm::Min, - "umax" => lib::llvm::UMax, - "umin" => lib::llvm::UMin, + "xchg" => llvm::Xchg, + "xadd" => llvm::Add, + "xsub" => llvm::Sub, + "and" => llvm::And, + "nand" => llvm::Nand, + "or" => llvm::Or, + "xor" => llvm::Xor, + "max" => llvm::Max, + "min" => llvm::Min, + "umax" => llvm::UMax, + "umin" => llvm::UMin, _ => ccx.sess().fatal("unknown atomic operation") }; diff --git a/src/librustc/middle/trans/type_.rs b/src/librustc/middle/trans/type_.rs index 10ee8f9ffc7e..573965108ad9 100644 --- a/src/librustc/middle/trans/type_.rs +++ b/src/librustc/middle/trans/type_.rs @@ -308,6 +308,7 @@ impl Type { } } + /* Memory-managed object interface to type handles. */ pub struct TypeNames { @@ -330,7 +331,7 @@ impl TypeNames { self.named_types.borrow().find_equiv(&s).map(|x| Type::from_ref(*x)) } - pub fn type_to_str(&self, ty: Type) -> String { + pub fn type_to_string(&self, ty: Type) -> String { unsafe { let s = llvm::LLVMTypeToString(ty.to_ref()); let ret = from_c_str(s); @@ -340,11 +341,11 @@ impl TypeNames { } pub fn types_to_str(&self, tys: &[Type]) -> String { - let strs: Vec = tys.iter().map(|t| self.type_to_str(*t)).collect(); + let strs: Vec = tys.iter().map(|t| self.type_to_string(*t)).collect(); format!("[{}]", strs.connect(",")) } - pub fn val_to_str(&self, val: ValueRef) -> String { + pub fn val_to_string(&self, val: ValueRef) -> String { unsafe { let s = llvm::LLVMValueToString(val); let ret = from_c_str(s); @@ -353,4 +354,3 @@ impl TypeNames { } } } - diff --git a/src/librustc_back/rpath.rs b/src/librustc_back/rpath.rs index 6a133d8619ab..e298e1dbfe94 100644 --- a/src/librustc_back/rpath.rs +++ b/src/librustc_back/rpath.rs @@ -230,7 +230,7 @@ mod test { used_crates: Vec::new(), out_filename: Path::new("bin/rustc"), get_install_prefix_lib_path: || fail!(), - realpath: |p| p.clone() + realpath: |p| Ok(p.clone()) }; let res = get_rpath_relative_to_output(config, &Path::new("lib/libstd.so")); assert_eq!(res.as_slice(), "@loader_path/../lib"); diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 3d0c5a821709..9ee8fa98c749 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -1869,52 +1869,6 @@ pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) { } } -/* Memory-managed object interface to type handles. */ - -pub struct TypeNames { - named_types: RefCell>, -} - -impl TypeNames { - pub fn new() -> TypeNames { - TypeNames { - named_types: RefCell::new(HashMap::new()) - } - } - - pub fn associate_type(&self, s: &str, t: &Type) { - assert!(self.named_types.borrow_mut().insert(s.to_string(), - t.to_ref())); - } - - pub fn find_type(&self, s: &str) -> Option { - self.named_types.borrow().find_equiv(&s).map(|x| Type::from_ref(*x)) - } - - pub fn type_to_string(&self, ty: Type) -> String { - unsafe { - let s = llvm::LLVMTypeToString(ty.to_ref()); - let ret = from_c_str(s); - free(s as *mut c_void); - ret.to_string() - } - } - - pub fn types_to_str(&self, tys: &[Type]) -> String { - let strs: Vec = tys.iter().map(|t| self.type_to_string(*t)).collect(); - format!("[{}]", strs.connect(",")) - } - - pub fn val_to_string(&self, val: ValueRef) -> String { - unsafe { - let s = llvm::LLVMValueToString(val); - let ret = from_c_str(s); - free(s as *mut c_void); - ret.to_string() - } - } -} - /* Memory-managed interface to target data. */ pub struct TargetData {