Commit 76504d0b authored by qinsoon's avatar qinsoon

[wip] working on api

parent 84e5d475
...@@ -346,7 +346,7 @@ impl ResumptionData { ...@@ -346,7 +346,7 @@ impl ResumptionData {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Destination { pub struct Destination {
pub target: MuTag, pub target: MuName,
pub args: Vec<DestArg> pub args: Vec<DestArg>
} }
......
...@@ -12,21 +12,21 @@ use std::cell::Cell; ...@@ -12,21 +12,21 @@ use std::cell::Cell;
pub type WPID = usize; pub type WPID = usize;
pub type MuID = usize; pub type MuID = usize;
pub type MuTag = &'static str; pub type MuName = &'static str;
pub type Address = usize; // TODO: replace this with Address(usize) pub type Address = usize; // TODO: replace this with Address(usize)
pub type OpIndex = usize; pub type OpIndex = usize;
#[derive(Debug)] #[derive(Debug)]
pub struct MuFunction { pub struct MuFunction {
pub fn_name: MuTag, pub fn_name: MuName,
pub sig: P<MuFuncSig>, pub sig: P<MuFuncSig>,
pub cur_ver: Option<MuTag>, pub cur_ver: Option<MuName>,
pub all_vers: Vec<MuTag> pub all_vers: Vec<MuName>
} }
impl MuFunction { impl MuFunction {
pub fn new(fn_name: MuTag, sig: P<MuFuncSig>) -> MuFunction { pub fn new(fn_name: MuName, sig: P<MuFuncSig>) -> MuFunction {
MuFunction { MuFunction {
fn_name: fn_name, fn_name: fn_name,
sig: sig, sig: sig,
...@@ -38,20 +38,20 @@ impl MuFunction { ...@@ -38,20 +38,20 @@ impl MuFunction {
#[derive(Debug)] #[derive(Debug)]
pub struct MuFunctionVersion { pub struct MuFunctionVersion {
pub fn_name: MuTag, pub fn_name: MuName,
pub version: MuTag, pub version: MuName,
pub sig: P<MuFuncSig>, pub sig: P<MuFuncSig>,
pub content: Option<FunctionContent>, pub content: Option<FunctionContent>,
pub context: FunctionContext, pub context: FunctionContext,
pub block_trace: Option<Vec<MuTag>> // only available after Trace Generation Pass pub block_trace: Option<Vec<MuName>> // only available after Trace Generation Pass
} }
pub const RESERVED_NODE_IDS_FOR_MACHINE : usize = 100; pub const RESERVED_NODE_IDS_FOR_MACHINE : usize = 100;
impl MuFunctionVersion { impl MuFunctionVersion {
pub fn new(fn_name: MuTag, ver: MuTag, sig: P<MuFuncSig>) -> MuFunctionVersion { pub fn new(fn_name: MuName, ver: MuName, sig: P<MuFuncSig>) -> MuFunctionVersion {
MuFunctionVersion{ MuFunctionVersion{
fn_name: fn_name, fn_name: fn_name,
version: ver, version: ver,
...@@ -65,7 +65,7 @@ impl MuFunctionVersion { ...@@ -65,7 +65,7 @@ impl MuFunctionVersion {
self.content = Some(content) self.content = Some(content)
} }
pub fn new_ssa(&mut self, id: MuID, tag: MuTag, ty: P<MuType>) -> P<TreeNode> { pub fn new_ssa(&mut self, id: MuID, tag: MuName, ty: P<MuType>) -> P<TreeNode> {
self.context.value_tags.insert(tag, id); self.context.value_tags.insert(tag, id);
self.context.values.insert(id, SSAVarEntry{id: id, tag: tag, ty: ty.clone(), use_count: Cell::new(0), expr: None}); self.context.values.insert(id, SSAVarEntry{id: id, tag: tag, ty: ty.clone(), use_count: Cell::new(0), expr: None});
...@@ -107,8 +107,8 @@ impl MuFunctionVersion { ...@@ -107,8 +107,8 @@ impl MuFunctionVersion {
#[derive(Debug)] #[derive(Debug)]
pub struct FunctionContent { pub struct FunctionContent {
pub entry: MuTag, pub entry: MuName,
pub blocks: HashMap<MuTag, Block> pub blocks: HashMap<MuName, Block>
} }
impl FunctionContent { impl FunctionContent {
...@@ -121,7 +121,7 @@ impl FunctionContent { ...@@ -121,7 +121,7 @@ impl FunctionContent {
self.get_block_mut(entry) self.get_block_mut(entry)
} }
pub fn get_block(&self, tag: MuTag) -> &Block { pub fn get_block(&self, tag: MuName) -> &Block {
let ret = self.blocks.get(tag); let ret = self.blocks.get(tag);
match ret { match ret {
Some(b) => b, Some(b) => b,
...@@ -129,7 +129,7 @@ impl FunctionContent { ...@@ -129,7 +129,7 @@ impl FunctionContent {
} }
} }
pub fn get_block_mut(&mut self, tag: MuTag) -> &mut Block { pub fn get_block_mut(&mut self, tag: MuName) -> &mut Block {
let ret = self.blocks.get_mut(tag); let ret = self.blocks.get_mut(tag);
match ret { match ret {
Some(b) => b, Some(b) => b,
...@@ -140,7 +140,7 @@ impl FunctionContent { ...@@ -140,7 +140,7 @@ impl FunctionContent {
#[derive(Debug)] #[derive(Debug)]
pub struct FunctionContext { pub struct FunctionContext {
pub value_tags: HashMap<MuTag, MuID>, pub value_tags: HashMap<MuName, MuID>,
pub values: HashMap<MuID, SSAVarEntry> pub values: HashMap<MuID, SSAVarEntry>
} }
...@@ -152,14 +152,14 @@ impl FunctionContext { ...@@ -152,14 +152,14 @@ impl FunctionContext {
} }
} }
pub fn get_value_by_tag(&self, tag: MuTag) -> Option<&SSAVarEntry> { pub fn get_value_by_tag(&self, tag: MuName) -> Option<&SSAVarEntry> {
match self.value_tags.get(tag) { match self.value_tags.get(tag) {
Some(id) => self.get_value(*id), Some(id) => self.get_value(*id),
None => None None => None
} }
} }
pub fn get_value_mut_by_tag(&mut self, tag: MuTag) -> Option<&mut SSAVarEntry> { pub fn get_value_mut_by_tag(&mut self, tag: MuName) -> Option<&mut SSAVarEntry> {
let id : MuID = match self.value_tags.get(tag) { let id : MuID = match self.value_tags.get(tag) {
Some(id) => *id, Some(id) => *id,
None => return None None => return None
...@@ -179,25 +179,25 @@ impl FunctionContext { ...@@ -179,25 +179,25 @@ impl FunctionContext {
#[derive(Debug)] #[derive(Debug)]
pub struct Block { pub struct Block {
pub label: MuTag, pub label: MuName,
pub content: Option<BlockContent>, pub content: Option<BlockContent>,
pub control_flow: ControlFlow pub control_flow: ControlFlow
} }
impl Block { impl Block {
pub fn new(label: MuTag) -> Block { pub fn new(label: MuName) -> Block {
Block{label: label, content: None, control_flow: ControlFlow::default()} Block{label: label, content: None, control_flow: ControlFlow::default()}
} }
} }
#[derive(Debug)] #[derive(Debug)]
pub struct ControlFlow { pub struct ControlFlow {
pub preds : Vec<MuTag>, pub preds : Vec<MuName>,
pub succs : Vec<BlockEdge> pub succs : Vec<BlockEdge>
} }
impl ControlFlow { impl ControlFlow {
pub fn get_hottest_succ(&self) -> Option<MuTag> { pub fn get_hottest_succ(&self) -> Option<MuName> {
if self.succs.len() == 0 { if self.succs.len() == 0 {
None None
} else { } else {
...@@ -231,7 +231,7 @@ impl default::Default for ControlFlow { ...@@ -231,7 +231,7 @@ impl default::Default for ControlFlow {
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct BlockEdge { pub struct BlockEdge {
pub target: MuTag, pub target: MuName,
pub kind: EdgeKind, pub kind: EdgeKind,
pub is_exception: bool, pub is_exception: bool,
pub probability: f32 pub probability: f32
...@@ -414,7 +414,7 @@ pub enum TreeNode_ { ...@@ -414,7 +414,7 @@ pub enum TreeNode_ {
/// always use with P<Value> /// always use with P<Value>
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct Value { pub struct Value {
pub tag: MuTag, pub tag: MuName,
pub ty: P<MuType>, pub ty: P<MuType>,
pub v: Value_ pub v: Value_
} }
...@@ -497,7 +497,7 @@ pub enum Value_ { ...@@ -497,7 +497,7 @@ pub enum Value_ {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct SSAVarEntry { pub struct SSAVarEntry {
pub id: MuID, pub id: MuID,
pub tag: MuTag, pub tag: MuName,
pub ty: P<MuType>, pub ty: P<MuType>,
// how many times this entry is used // how many times this entry is used
...@@ -526,8 +526,8 @@ pub enum Constant { ...@@ -526,8 +526,8 @@ pub enum Constant {
Float(f32), Float(f32),
Double(f64), Double(f64),
IRef(Address), IRef(Address),
FuncRef(MuTag), FuncRef(MuName),
UFuncRef(MuTag), UFuncRef(MuName),
Vector(Vec<Constant>), Vector(Vec<Constant>),
} }
...@@ -564,7 +564,7 @@ pub enum MemoryLocation { ...@@ -564,7 +564,7 @@ pub enum MemoryLocation {
}, },
Symbolic{ Symbolic{
base: Option<P<Value>>, base: Option<P<Value>>,
label: MuTag label: MuName
} }
} }
...@@ -587,7 +587,7 @@ impl fmt::Display for MemoryLocation { ...@@ -587,7 +587,7 @@ impl fmt::Display for MemoryLocation {
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub struct GlobalCell { pub struct GlobalCell {
pub tag: MuTag, pub tag: MuName,
pub ty: P<MuType> pub ty: P<MuType>
} }
......
...@@ -28,7 +28,7 @@ pub enum MuType_ { ...@@ -28,7 +28,7 @@ pub enum MuType_ {
UPtr (P<MuType>), UPtr (P<MuType>),
/// struct<T1 T2 ...> /// struct<T1 T2 ...>
Struct (MuTag), Struct (MuName),
/// array<T length> /// array<T length>
Array (P<MuType>, usize), Array (P<MuType>, usize),
...@@ -82,8 +82,8 @@ impl fmt::Display for MuType_ { ...@@ -82,8 +82,8 @@ impl fmt::Display for MuType_ {
} }
lazy_static! { lazy_static! {
/// storing a map from MuTag to StructType_ /// storing a map from MuName to StructType_
pub static ref STRUCT_TAG_MAP : RwLock<HashMap<MuTag, StructType_>> = RwLock::new(HashMap::new()); pub static ref STRUCT_TAG_MAP : RwLock<HashMap<MuName, StructType_>> = RwLock::new(HashMap::new());
} }
#[derive(Clone, PartialEq, Eq, Debug)] #[derive(Clone, PartialEq, Eq, Debug)]
...@@ -141,13 +141,13 @@ impl MuType_ { ...@@ -141,13 +141,13 @@ impl MuType_ {
pub fn uptr(referent: P<MuType_>) -> MuType_ { pub fn uptr(referent: P<MuType_>) -> MuType_ {
MuType_::UPtr(referent) MuType_::UPtr(referent)
} }
pub fn mustruct_empty(tag: MuTag) -> MuType_ { pub fn mustruct_empty(tag: MuName) -> MuType_ {
let struct_ty_ = StructType_{tys: vec![]}; let struct_ty_ = StructType_{tys: vec![]};
STRUCT_TAG_MAP.write().unwrap().insert(tag, struct_ty_); STRUCT_TAG_MAP.write().unwrap().insert(tag, struct_ty_);
MuType_::Struct(tag) MuType_::Struct(tag)
} }
pub fn mustruct(tag: MuTag, list: Vec<P<MuType_>>) -> MuType_ { pub fn mustruct(tag: MuName, list: Vec<P<MuType_>>) -> MuType_ {
let struct_ty_ = StructType_{tys: list}; let struct_ty_ = StructType_{tys: list};
// if there is an attempt to use a same tag for different struct, // if there is an attempt to use a same tag for different struct,
......
use ast::ir::*; use ast::ir::*;
use ast::inst::Instruction_::*; use ast::inst::Instruction_::*;
use vm::context::VMContext; use vm::context::VM;
use compiler::CompilerPass; use compiler::CompilerPass;
...@@ -20,7 +20,7 @@ impl CompilerPass for InstructionSelection { ...@@ -20,7 +20,7 @@ impl CompilerPass for InstructionSelection {
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn start_function(&mut self, vm_context: &VMContext, func: &mut MuFunctionVersion) { fn start_function(&mut self, vm: &VM, func: &mut MuFunctionVersion) {
println!("{}", self.name()); println!("{}", self.name());
} }
} }
...@@ -5,7 +5,7 @@ use utils::ByteSize; ...@@ -5,7 +5,7 @@ use utils::ByteSize;
use compiler::backend::x86_64; use compiler::backend::x86_64;
use compiler::backend::x86_64::CodeGenerator; use compiler::backend::x86_64::CodeGenerator;
use vm::MachineCode; use vm::MachineCode;
use vm::VMContext; use vm::VM;
use utils::string_utils; use utils::string_utils;
...@@ -20,7 +20,7 @@ use std::slice::Iter; ...@@ -20,7 +20,7 @@ use std::slice::Iter;
use std::ops; use std::ops;
struct ASMCode { struct ASMCode {
name: MuTag, name: MuName,
code: Vec<ASM>, code: Vec<ASM>,
reg_defines: HashMap<MuID, Vec<ASMLocation>>, reg_defines: HashMap<MuID, Vec<ASMLocation>>,
reg_uses: HashMap<MuID, Vec<ASMLocation>>, reg_uses: HashMap<MuID, Vec<ASMLocation>>,
...@@ -30,17 +30,17 @@ struct ASMCode { ...@@ -30,17 +30,17 @@ struct ASMCode {
preds: Vec<Vec<usize>>, preds: Vec<Vec<usize>>,
succs: Vec<Vec<usize>>, succs: Vec<Vec<usize>>,
idx_to_blk: HashMap<usize, MuTag>, idx_to_blk: HashMap<usize, MuName>,
blk_to_idx: HashMap<MuTag, usize>, blk_to_idx: HashMap<MuName, usize>,
cond_branches: HashMap<usize, MuTag>, cond_branches: HashMap<usize, MuName>,
branches: HashMap<usize, MuTag>, branches: HashMap<usize, MuName>,
blocks: Vec<MuTag>, blocks: Vec<MuName>,
block_start: HashMap<MuTag, usize>, block_start: HashMap<MuName, usize>,
block_range: HashMap<MuTag, ops::Range<usize>>, block_range: HashMap<MuName, ops::Range<usize>>,
block_livein: HashMap<MuTag, Vec<MuID>>, block_livein: HashMap<MuName, Vec<MuID>>,
block_liveout: HashMap<MuTag, Vec<MuID>> block_liveout: HashMap<MuName, Vec<MuID>>
} }
impl MachineCode for ASMCode { impl MachineCode for ASMCode {
...@@ -77,7 +77,7 @@ impl MachineCode for ASMCode { ...@@ -77,7 +77,7 @@ impl MachineCode for ASMCode {
} }
fn replace_reg(&mut self, from: MuID, to: MuID) { fn replace_reg(&mut self, from: MuID, to: MuID) {
let to_reg_tag : MuTag = backend::all_regs()[to].tag; let to_reg_tag : MuName = backend::all_regs()[to].tag;
let to_reg_string = "%".to_string() + to_reg_tag; let to_reg_string = "%".to_string() + to_reg_tag;
match self.reg_defines.get(&from) { match self.reg_defines.get(&from) {
...@@ -140,19 +140,19 @@ impl MachineCode for ASMCode { ...@@ -140,19 +140,19 @@ impl MachineCode for ASMCode {
self.preds[i], self.succs[i]); self.preds[i], self.succs[i]);
} }
fn get_ir_block_livein(&self, block: MuTag) -> Option<&Vec<MuID>> { fn get_ir_block_livein(&self, block: MuName) -> Option<&Vec<MuID>> {
self.block_livein.get(&block) self.block_livein.get(&block)
} }
fn get_ir_block_liveout(&self, block: MuTag) -> Option<&Vec<MuID>> { fn get_ir_block_liveout(&self, block: MuName) -> Option<&Vec<MuID>> {
self.block_liveout.get(&block) self.block_liveout.get(&block)
} }
fn get_all_blocks(&self) -> &Vec<MuTag> { fn get_all_blocks(&self) -> &Vec<MuName> {
&self.blocks &self.blocks
} }
fn get_block_range(&self, block: MuTag) -> Option<ops::Range<usize>> { fn get_block_range(&self, block: MuName) -> Option<ops::Range<usize>> {
match self.block_range.get(&block) { match self.block_range.get(&block) {
Some(r) => Some(r.clone()), Some(r) => Some(r.clone()),
None => None None => None
...@@ -505,7 +505,7 @@ impl ASMCodeGen { ...@@ -505,7 +505,7 @@ impl ASMCodeGen {
} }
} }
fn asm_block_label(&self, label: MuTag) -> String { fn asm_block_label(&self, label: MuName) -> String {
symbol(&format!("{}_{}", self.cur().name, label)) symbol(&format!("{}_{}", self.cur().name, label))
} }
...@@ -575,7 +575,7 @@ impl ASMCodeGen { ...@@ -575,7 +575,7 @@ impl ASMCodeGen {
} }
impl CodeGenerator for ASMCodeGen { impl CodeGenerator for ASMCodeGen {
fn start_code(&mut self, func_name: MuTag) { fn start_code(&mut self, func_name: MuName) {
self.cur = Some(Box::new(ASMCode { self.cur = Some(Box::new(ASMCode {
name: func_name, name: func_name,
code: vec![], code: vec![],
...@@ -629,7 +629,7 @@ impl CodeGenerator for ASMCodeGen { ...@@ -629,7 +629,7 @@ impl CodeGenerator for ASMCodeGen {
println!(""); println!("");
} }
fn start_block(&mut self, block_name: MuTag) { fn start_block(&mut self, block_name: MuName) {
let label = format!("{}:", self.asm_block_label(block_name)); let label = format!("{}:", self.asm_block_label(block_name));
self.add_asm_block_label(label, block_name); self.add_asm_block_label(label, block_name);
self.cur_mut().blocks.push(block_name); self.cur_mut().blocks.push(block_name);
...@@ -638,14 +638,14 @@ impl CodeGenerator for ASMCodeGen { ...@@ -638,14 +638,14 @@ impl CodeGenerator for ASMCodeGen {
self.cur_mut().block_start.insert(block_name, start); self.cur_mut().block_start.insert(block_name, start);
} }
fn end_block(&mut self, block_name: MuTag) { fn end_block(&mut self, block_name: MuName) {
let start : usize = *self.cur().block_start.get(&block_name).unwrap(); let start : usize = *self.cur().block_start.get(&block_name).unwrap();
let end : usize = self.line(); let end : usize = self.line();
self.cur_mut().block_range.insert(block_name, (start..end)); self.cur_mut().block_range.insert(block_name, (start..end));
} }
fn set_block_livein(&mut self, block_name: MuTag, live_in: &Vec<P<Value>>) { fn set_block_livein(&mut self, block_name: MuName, live_in: &Vec<P<Value>>) {
let cur = self.cur_mut(); let cur = self.cur_mut();
let mut res = { let mut res = {
...@@ -663,7 +663,7 @@ impl CodeGenerator for ASMCodeGen { ...@@ -663,7 +663,7 @@ impl CodeGenerator for ASMCodeGen {
} }
} }
fn set_block_liveout(&mut self, block_name: MuTag, live_out: &Vec<P<Value>>) { fn set_block_liveout(&mut self, block_name: MuName, live_out: &Vec<P<Value>>) {
let cur = self.cur_mut(); let cur = self.cur_mut();
let mut res = { let mut res = {
...@@ -998,7 +998,7 @@ impl CodeGenerator for ASMCodeGen { ...@@ -998,7 +998,7 @@ impl CodeGenerator for ASMCodeGen {
self.add_asm_branch2(asm, dest.target); self.add_asm_branch2(asm, dest.target);
} }
fn emit_call_near_rel32(&mut self, func: MuTag) { fn emit_call_near_rel32(&mut self, func: MuName) {
trace!("emit: call {}", func); trace!("emit: call {}", func);
let asm = format!("call {}", symbol(func)); let asm = format!("call {}", symbol(func));
...@@ -1071,7 +1071,7 @@ fn create_emit_directory() { ...@@ -1071,7 +1071,7 @@ fn create_emit_directory() {
} }
} }
pub fn emit_code(func: &mut MuFunctionVersion, vm: &VMContext) { pub fn emit_code(func: &mut MuFunctionVersion, vm: &VM) {
use std::io::prelude::*; use std::io::prelude::*;
use std::fs::File; use std::fs::File;
use std::path; use std::path;
...@@ -1099,7 +1099,7 @@ pub fn emit_code(func: &mut MuFunctionVersion, vm: &VMContext) { ...@@ -1099,7 +1099,7 @@ pub fn emit_code(func: &mut MuFunctionVersion, vm: &VMContext) {
} }
const CONTEXT_FILE : &'static str = "context.s"; const CONTEXT_FILE : &'static str = "context.s";
pub fn emit_context(vm: &VMContext) { pub fn emit_context(vm: &VM) {
use std::path; use std::path;
use std::fs::File; use std::fs::File;
use std::io::prelude::*; use std::io::prelude::*;
...@@ -1150,4 +1150,4 @@ fn symbol(name: &str) -> String { ...@@ -1150,4 +1150,4 @@ fn symbol(name: &str) -> String {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
fn symbol(name: &str) -> String { fn symbol(name: &str) -> String {
format!("_{}", name) format!("_{}", name)
} }
\ No newline at end of file
...@@ -5,15 +5,15 @@ use ast::inst::*; ...@@ -5,15 +5,15 @@ use ast::inst::*;
use vm::MachineCode; use vm::MachineCode;
pub trait CodeGenerator { pub trait CodeGenerator {
fn start_code(&mut self, func_name: MuTag); fn start_code(&mut self, func_name: MuName);
fn finish_code(&mut self) -> Box<MachineCode>; fn finish_code(&mut self) -> Box<MachineCode>;
fn print_cur_code(&self); fn print_cur_code(&self);
fn start_block(&mut self, block_name: MuTag); fn start_block(&mut self, block_name: MuName);
fn set_block_livein(&mut self, block_name: MuTag, live_in: &Vec<P<Value>>); fn set_block_livein(&mut self, block_name: MuName, live_in: &Vec<P<Value>>);
fn set_block_liveout(&mut self, block_name: MuTag, live_out: &Vec<P<Value>>); fn set_block_liveout(&mut self, block_name: MuName, live_out: &Vec<P<Value>>);
fn end_block(&mut self, block_name: MuTag); fn end_block(&mut self, block_name: MuName);
fn emit_cmp_r64_r64(&mut self, op1: &P<Value>, op2: &P<Value>); fn emit_cmp_r64_r64(&mut self, op1: &P<Value>, op2: &P<Value>);
fn emit_cmp_r64_imm32(&mut self, op1: &P<Value>, op2: u32); fn emit_cmp_r64_imm32(&mut self, op1: &P<Value>, op2: u32);
...@@ -48,7 +48,7 @@ pub trait CodeGenerator { ...@@ -48,7 +48,7 @@ pub trait CodeGenerator {
fn emit_jl(&mut self, dest: &Destination); fn emit_jl(&mut self, dest: &Destination);
fn emit_jle(&mut self, dest: &Destination); fn emit_jle(&mut self, dest: &Destination);
fn emit_call_near_rel32(&mut self, func: MuTag); fn emit_call_near_rel32(&mut self, func: MuName);
fn emit_call_near_r64(&mut self, func: &P<Value>); fn emit_call_near_r64(&mut self, func: &P<Value>);
fn emit_call_near_mem64(&mut self, func: &P<Value>); fn emit_call_near_mem64(&mut self, func: &P<Value>);
......
...@@ -8,7 +8,7 @@ use ast::inst::MemoryOrder; ...@@ -8,7 +8,7 @@ use ast::inst::MemoryOrder;
use ast::op; use ast::op;
use ast::types; use ast::types;
use ast::types::MuType_; use ast::types::MuType_;
use vm::VMContext; use vm::VM;
use vm::CompiledFunction; use vm::CompiledFunction;
use compiler::CompilerPass; use compiler::CompilerPass;
...@@ -38,7 +38,7 @@ impl <'a> InstructionSelection { ...@@ -38,7 +38,7 @@ impl <'a> InstructionSelection {
// 3. we need to backup/restore all the callee-saved registers // 3. we need to backup/restore all the callee-saved registers
// if any of these assumption breaks, we will need to re-emit the code // if any of these assumption breaks, we will need to re-emit the code
#[allow(unused_variables)] #[allow(unused_variables)]
fn instruction_select(&mut self, node: &'a P<TreeNode>, cur_func: &MuFunctionVersion, vm: &VMContext) { fn instruction_select(&mut self, node: &'a P<TreeNode>, cur_func: &MuFunctionVersion, vm: &VM) {
trace!("instsel on node {}", node); trace!("instsel on node {}", node);
match node.v { match node.v {
...@@ -412,7 +412,7 @@ impl <'a> InstructionSelection { ...@@ -412,7 +412,7 @@ impl <'a> InstructionSelection {
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn process_dest(&mut self, ops: &Vec<P<TreeNode>>, dest: &Destination, cur_func: &MuFunctionVersion, vm: &VMContext) { fn process_dest(&mut self, ops: &Vec<P<TreeNode>>, dest: &Destination, cur_func: &MuFunctionVersion, vm: &VM) {
for i in 0..dest.args.len() { for i in 0..dest.args.len() {
let ref dest_arg = dest.args[i]; let ref dest_arg = dest.args[i];
match dest_arg { match dest_arg {
...@@ -489,7 +489,7 @@ impl <'a> InstructionSelection { ...@@ -489,7 +489,7 @@ impl <'a> InstructionSelection {
self.backend.end_block(block_name); self.backend.end_block(block_name);
} }