Some misc changes
This commit is contained in:
parent
40176e03fd
commit
ece497cc84
3 changed files with 10 additions and 1 deletions
|
@ -137,3 +137,8 @@ unsafe fn transmute(c: char) -> u32 {
|
||||||
unsafe fn call_uninit() -> u8 {
|
unsafe fn call_uninit() -> u8 {
|
||||||
intrinsics::uninit()
|
intrinsics::uninit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: enable when fat pointers are supported
|
||||||
|
/*unsafe fn deref_str_ptr(s: *const str) -> &'static str {
|
||||||
|
&*s
|
||||||
|
}*/
|
||||||
|
|
|
@ -330,7 +330,7 @@ pub fn codegen_call<'a, 'tcx: 'a>(
|
||||||
|
|
||||||
let nil_ty = fx.tcx.mk_nil();
|
let nil_ty = fx.tcx.mk_nil();
|
||||||
let usize_layout = fx.layout_of(fx.tcx.types.usize);
|
let usize_layout = fx.layout_of(fx.tcx.types.usize);
|
||||||
let ret = return_place.unwrap();
|
let ret = return_place.expect("return place");
|
||||||
match intrinsic {
|
match intrinsic {
|
||||||
"abort" => {
|
"abort" => {
|
||||||
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
|
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
|
||||||
|
|
|
@ -354,6 +354,10 @@ fn trans_stmt<'a, 'tcx: 'a>(
|
||||||
let res = match un_op {
|
let res = match un_op {
|
||||||
UnOp::Not => fx.bcx.ins().bnot(val),
|
UnOp::Not => fx.bcx.ins().bnot(val),
|
||||||
UnOp::Neg => match ty.sty {
|
UnOp::Neg => match ty.sty {
|
||||||
|
TypeVariants::TyInt(_) => {
|
||||||
|
let zero = fx.bcx.ins().iconst(types::I64, 0);
|
||||||
|
fx.bcx.ins().isub(zero, val)
|
||||||
|
},
|
||||||
TypeVariants::TyFloat(_) => fx.bcx.ins().fneg(val),
|
TypeVariants::TyFloat(_) => fx.bcx.ins().fneg(val),
|
||||||
_ => unimplemented!("un op Neg for {:?}", ty),
|
_ => unimplemented!("un op Neg for {:?}", ty),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue