From 16334be18e50be2a66675a860e4d600c288ff34c Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 17 Nov 2018 15:02:57 +0100 Subject: [PATCH] Remove a workaround for icmp.i8/i16 not having an encoding --- example/mini_core.rs | 4 ++-- src/base.rs | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/example/mini_core.rs b/example/mini_core.rs index b8504a14771..83dd4f10f5e 100644 --- a/example/mini_core.rs +++ b/example/mini_core.rs @@ -1,4 +1,4 @@ -#![feature(no_core, lang_items, intrinsics, unboxed_closures)] +#![feature(no_core, lang_items, intrinsics, unboxed_closures, type_ascription)] #![no_core] #![allow(dead_code)] @@ -246,7 +246,7 @@ pub struct Box(*mut T); impl, U: ?Sized> CoerceUnsized> for Box {} -static mut MY_TINY_HEAP: [u8; 16] = [0; 16]; +static mut MY_TINY_HEAP: [u8; 16] = [0xff; 16]; #[lang = "exchange_malloc"] unsafe fn allocate(size: usize, _align: usize) -> *mut u8 { diff --git a/src/base.rs b/src/base.rs index 1be7942c84b..a4645ea7e01 100644 --- a/src/base.rs +++ b/src/base.rs @@ -18,7 +18,9 @@ pub fn trans_mono_item<'a, 'tcx: 'a>( ) { match mono_item { MonoItem::Fn(inst) => { - let _inst_guard = PrintOnPanic(|| format!("{:?}", inst)); + let _inst_guard = PrintOnPanic(|| { + format!("{:?} {}", inst, tcx.symbol_name(inst).as_str()) + }); let _mir_guard = PrintOnPanic(|| { match inst.def { InstanceDef::Item(_) @@ -761,14 +763,7 @@ macro_rules! binop_match { assert_eq!($fx.tcx.types.bool, $ret_ty); let ret_layout = $fx.layout_of($ret_ty); - // TODO HACK no encoding for icmp.i8 - use crate::common::clif_intcast; - let (lhs, rhs) = ( - clif_intcast($fx, $lhs, types::I64, $signed), - clif_intcast($fx, $rhs, types::I64, $signed), - ); - let b = $fx.bcx.ins().icmp(IntCC::$cc, lhs, rhs); - + let b = $fx.bcx.ins().icmp(IntCC::$cc, $lhs, $rhs); CValue::ByVal($fx.bcx.ins().bint(types::I8, b), ret_layout) }}; (@single $fx:expr, $bug_fmt:expr, $var:expr, $signed:expr, $lhs:expr, $rhs:expr, $ret_ty:expr, fcmp($cc:ident)) => {{