Commit 10e13ff2 authored by qinsoon's avatar qinsoon

REFCAST/PTRCAST, implemented as mov

parent 50b5f20f
......@@ -4,7 +4,6 @@ use inst::*;
use op::*;
use utils::vec_utils;
use utils::Address;
use std::collections::HashMap;
use std::fmt;
......
......@@ -43,8 +43,6 @@
use std::sync::Arc;
use ir::MuEntity;
pub type P<T> = Arc<T>;
//pub struct P<T: MuEntity> {
// ptr: Arc<T>
......
......@@ -466,7 +466,8 @@ pub fn get_referent_ty(ty: &MuType) -> Option<P<MuType>> {
match ty.v {
MuType_::Ref(ref referent)
| MuType_::IRef(ref referent)
| MuType_::WeakRef(ref referent) => Some(referent.clone()),
| MuType_::WeakRef(ref referent)
| MuType_::UPtr(ref referent) => Some(referent.clone()),
_ => None
}
}
......
......@@ -748,6 +748,17 @@ impl <'a> InstructionSelection {
panic!("unexpected op (expect ireg): {}", op)
}
}
op::ConvOp::REFCAST | op::ConvOp::PTRCAST => {
// just a mov (and hopefully reg alloc will coalesce it)
let tmp_res = self.get_result_value(node);
if self.match_ireg(op) {
let tmp_op = self.emit_ireg(op, f_content, f_context, vm);
self.backend.emit_mov_r64_r64(&tmp_res, &tmp_op);
} else {
panic!("unexpected op (expect ireg): {}", op)
}
}
_ => unimplemented!()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment