Remove remainders from when booleans were i8
This commit is contained in:
parent
b8ef5cf131
commit
d2a22f520c
@ -618,7 +618,7 @@ pub fn trans_case<'a>(bcx: &'a Block<'a>, r: &Repr, discr: Disr)
|
||||
RawNullablePointer { .. } |
|
||||
StructWrappedNullablePointer { .. } => {
|
||||
assert!(discr == 0 || discr == 1);
|
||||
_match::single_result(Result::new(bcx, C_i1(bcx.ccx(), discr != 0)))
|
||||
_match::single_result(Result::new(bcx, C_bool(bcx.ccx(), discr != 0)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -539,8 +539,8 @@ pub fn compare_scalar_values<'a>(
|
||||
// We don't need to do actual comparisons for nil.
|
||||
// () == () holds but () < () does not.
|
||||
match op {
|
||||
ast::BiEq | ast::BiLe | ast::BiGe => return C_i1(cx.ccx(), true),
|
||||
ast::BiNe | ast::BiLt | ast::BiGt => return C_i1(cx.ccx(), false),
|
||||
ast::BiEq | ast::BiLe | ast::BiGe => return C_bool(cx.ccx(), true),
|
||||
ast::BiNe | ast::BiLt | ast::BiGt => return C_bool(cx.ccx(), false),
|
||||
// refinements would be nice
|
||||
_ => die(cx)
|
||||
}
|
||||
@ -1014,7 +1014,7 @@ pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef,
|
||||
let dst_ptr = PointerCast(cx, dst, Type::i8p(ccx));
|
||||
let size = IntCast(cx, n_bytes, ccx.int_type);
|
||||
let align = C_i32(ccx, align as i32);
|
||||
let volatile = C_i1(ccx, false);
|
||||
let volatile = C_bool(ccx, false);
|
||||
Call(cx, memcpy, [dst_ptr, src_ptr, size, align, volatile], []);
|
||||
}
|
||||
|
||||
@ -1059,7 +1059,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: Type) {
|
||||
let llzeroval = C_u8(ccx, 0);
|
||||
let size = machine::llsize_of(ccx, ty);
|
||||
let align = C_i32(ccx, llalign_of_min(ccx, ty) as i32);
|
||||
let volatile = C_i1(ccx, false);
|
||||
let volatile = C_bool(ccx, false);
|
||||
b.call(llintrinsicfn, [llptr, llzeroval, size, align, volatile], []);
|
||||
}
|
||||
|
||||
|
@ -526,10 +526,6 @@ pub fn C_nil(ccx: &CrateContext) -> ValueRef {
|
||||
}
|
||||
|
||||
pub fn C_bool(ccx: &CrateContext, val: bool) -> ValueRef {
|
||||
C_integral(Type::bool(ccx), val as u64, false)
|
||||
}
|
||||
|
||||
pub fn C_i1(ccx: &CrateContext, val: bool) -> ValueRef {
|
||||
C_integral(Type::i1(ccx), val as u64, false)
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,7 @@ fn trans_index<'a>(bcx: &'a Block<'a>,
|
||||
|
||||
let bounds_check = ICmp(bcx, lib::llvm::IntUGE, ix_val, len);
|
||||
let expect = ccx.get_intrinsic(&("llvm.expect.i1"));
|
||||
let expected = Call(bcx, expect, [bounds_check, C_i1(ccx, false)], []);
|
||||
let expected = Call(bcx, expect, [bounds_check, C_bool(ccx, false)], []);
|
||||
let bcx = with_cond(bcx, expected, |bcx| {
|
||||
controlflow::trans_fail_bounds_check(bcx, index_expr.span, ix_val, len)
|
||||
});
|
||||
@ -1149,13 +1149,7 @@ fn trans_unary<'a>(bcx: &'a Block<'a>,
|
||||
match op {
|
||||
ast::UnNot => {
|
||||
let datum = unpack_datum!(bcx, trans(bcx, sub_expr));
|
||||
let llresult = if ty::type_is_bool(un_ty) {
|
||||
let val = datum.to_llscalarish(bcx);
|
||||
Xor(bcx, val, C_bool(ccx, true))
|
||||
} else {
|
||||
// Note: `Not` is bitwise, not suitable for logical not.
|
||||
Not(bcx, datum.to_llscalarish(bcx))
|
||||
};
|
||||
let llresult = Not(bcx, datum.to_llscalarish(bcx));
|
||||
immediate_rvalue_bcx(bcx, llresult, un_ty).to_expr_datumblock()
|
||||
}
|
||||
ast::UnNeg => {
|
||||
|
@ -234,7 +234,7 @@ fn trans_struct_drop_flag<'a>(bcx: &'a Block<'a>,
|
||||
-> &'a Block<'a> {
|
||||
let repr = adt::represent_type(bcx.ccx(), t);
|
||||
let drop_flag = adt::trans_drop_flag_ptr(bcx, &*repr, v0);
|
||||
with_cond(bcx, IsNotNull(bcx, Load(bcx, drop_flag)), |cx| {
|
||||
with_cond(bcx, Load(bcx, drop_flag), |cx| {
|
||||
trans_struct_drop(cx, t, v0, dtor_did, class_did, substs)
|
||||
})
|
||||
}
|
||||
|
@ -150,7 +150,8 @@ pub fn trans_intrinsic(ccx: &CrateContext,
|
||||
let src_ptr = PointerCast(bcx, get_param(decl, first_real_arg + 1), Type::i8p(ccx));
|
||||
let count = get_param(decl, first_real_arg + 2);
|
||||
let llfn = ccx.get_intrinsic(&name);
|
||||
Call(bcx, llfn, [dst_ptr, src_ptr, Mul(bcx, size, count), align, C_i1(ccx, volatile)], []);
|
||||
Call(bcx, llfn,
|
||||
[dst_ptr, src_ptr, Mul(bcx, size, count), align, C_bool(ccx, volatile)], []);
|
||||
RetVoid(bcx);
|
||||
}
|
||||
|
||||
@ -171,13 +172,13 @@ pub fn trans_intrinsic(ccx: &CrateContext,
|
||||
let val = get_param(decl, first_real_arg + 1);
|
||||
let count = get_param(decl, first_real_arg + 2);
|
||||
let llfn = ccx.get_intrinsic(&name);
|
||||
Call(bcx, llfn, [dst_ptr, val, Mul(bcx, size, count), align, C_i1(ccx, volatile)], []);
|
||||
Call(bcx, llfn, [dst_ptr, val, Mul(bcx, size, count), align, C_bool(ccx, volatile)], []);
|
||||
RetVoid(bcx);
|
||||
}
|
||||
|
||||
fn count_zeros_intrinsic(bcx: &Block, name: &'static str) {
|
||||
let x = get_param(bcx.fcx.llfn, bcx.fcx.arg_pos(0u));
|
||||
let y = C_i1(bcx.ccx(), false);
|
||||
let y = C_bool(bcx.ccx(), false);
|
||||
let llfn = bcx.ccx().get_intrinsic(&name);
|
||||
let llcall = Call(bcx, llfn, [x, y], []);
|
||||
Ret(bcx, llcall);
|
||||
|
Loading…
x
Reference in New Issue
Block a user