use ast::ir::*; use std::ops; use std::collections::HashMap; pub struct CompiledFunction { pub fn_name: MuTag, pub temps: HashMap, // assumes one temperary maps to one register pub mc: Box } pub trait MachineCode { fn trace_mc(&self); fn trace_inst(&self, index: usize); fn emit(&self) -> Vec; fn number_of_insts(&self) -> usize; fn is_move(&self, index: usize) -> bool; fn get_succs(&self, index: usize) -> &Vec; fn get_preds(&self, index: usize) -> &Vec; fn get_inst_reg_uses(&self, index: usize) -> &Vec; fn get_inst_reg_defines(&self, index: usize) -> &Vec; fn get_ir_block_livein(&self, block: MuTag) -> Option<&Vec>; fn get_ir_block_liveout(&self, block: MuTag) -> Option<&Vec>; fn get_all_blocks(&self) -> &Vec; fn get_block_range(&self, block: MuTag) -> Option>; fn replace_reg(&mut self, from: MuID, to: MuID); fn set_inst_nop(&mut self, index: usize); }