Fix rebase fallout. Sorry.

This commit is contained in:
Brian Anderson 2014-07-11 17:57:45 -07:00
parent 3096d9bf94
commit a008fc84aa
5 changed files with 29 additions and 76 deletions

View File

@ -66,7 +66,6 @@ pub mod back {
pub mod lto;
}
>>>>>>> Extract librustc_back from librustc
pub mod middle {
pub mod def;

View File

@ -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")
};

View File

@ -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<String> = tys.iter().map(|t| self.type_to_str(*t)).collect();
let strs: Vec<String> = 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 {
}
}
}

View File

@ -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");

View File

@ -1869,52 +1869,6 @@ pub fn SetFunctionAttribute(fn_: ValueRef, attr: Attribute) {
}
}
/* Memory-managed object interface to type handles. */
pub struct TypeNames {
named_types: RefCell<HashMap<String, TypeRef>>,
}
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<Type> {
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<String> = 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 {