Commit fad24db1 authored by Yi Lin's avatar Yi Lin

Merge branch 'isaac_working' into 'develop'

Isaac working

See merge request !29
parents 3ef34581 51cbaf3b
......@@ -9,6 +9,7 @@ before_script:
- export ZEBU_BUILD=release
- export CARGO_HOME=.cargo
- export CC=clang
- export LD_LIBRARY_PATH=$MU_ZEBU/target/$ZEBU_BUILD:$LD_LIBRARY_PATH
- source /home/gitlab-runner/ci/bin/activate
build:
......@@ -121,7 +122,7 @@ testjit:rpython:
- git checkout mu-rewrite
- git apply pypy.patch
- cd $CI_PROJECT_DIR/tests/test_jit
- MU_LOG_LEVEL=info LD_LIBRARY_PATH=./emit RUST_BACKTRACE=1 PYTHONPATH=mu-client-pypy pytest test_rpython*.py -v --color=yes
- MU_LOG_LEVEL=info LD_LIBRARY_PATH=./emit:$LD_LIBRARY_PATH RUST_BACKTRACE=1 PYTHONPATH=mu-client-pypy pytest test_rpython*.py -v --color=yes
testjit:som:
stage: test
......@@ -135,7 +136,7 @@ testjit:som:
- git checkout mu-rewrite
- git apply pypy.patch
- cd $CI_PROJECT_DIR/tests/test_jit
- MU_LOG_LEVEL=info LD_LIBRARY_PATH=./emit RUST_BACKTRACE=1 PYTHONPATH=mu-client-pypy:RPySOM/src RPYSOM=RPySOM pytest test_som.py -v --color=yes
- MU_LOG_LEVEL=info LD_LIBRARY_PATH=./emit:$LD_LIBRARY_PATH RUST_BACKTRACE=1 PYTHONPATH=mu-client-pypy:RPySOM/src RPYSOM=RPySOM pytest test_som.py -v --color=yes
mubench:
stage: mubench
......
......@@ -37,8 +37,8 @@ gcc = "*"
mu_ast = {path = "src/ast"}
mu_utils = {path = "src/utils"}
#mu_gc = {path = "src/gc"}
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", version = ">= 0.0.5" }
#rodal = { path = "../rodal_test/rodal", version = ">= 0.0.5" }
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "new", version = "^0.1.13" }
#rodal = { path = "./rodal", version = "*" }
libc="*"
field-offset = "*"
......
......@@ -25,6 +25,6 @@ mu_utils = {path = "../utils"}
lazy_static = "*"
log = "*"
simple_logger = "*"
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", version = ">= 0.0.5" }
regex = "*"
#rodal = { path = "../../../rodal_test/rodal", version = ">= 0.0.5" }
rodal = { git = "https://gitlab.anu.edu.au/mu/rodal", branch = "new", version = "^0.1.13" }
#rodal = { path = "../../rodal", version = "*" }
......@@ -22,21 +22,22 @@ use utils::LinkedHashSet;
use std;
use std::fmt;
pub use std::sync::Arc;
use std::default;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
pub type WPID = usize;
pub type MuID = usize;
pub type MuName = String;
pub type MuName = Arc<String>;
pub type CName = MuName;
#[allow(non_snake_case)]
pub fn Mu(str: &'static str) -> MuName {
str.to_string()
Arc::new(str.to_string())
}
#[allow(non_snake_case)]
pub fn C(str: &'static str) -> CName {
str.to_string()
Arc::new(str.to_string())
}
pub type OpIndex = usize;
......@@ -134,6 +135,7 @@ impl fmt::Display for MuFunction {
// FIXME: currently part of compilation information is also stored in this data structure
// we should move them (see Issue #18)
rodal_named!(MuFunctionVersion);
pub struct MuFunctionVersion {
pub hdr: MuEntityHeader,
......@@ -460,7 +462,7 @@ impl FunctionContent {
}
}
pub fn get_block_by_name(&self, name: String) -> &Block {
pub fn get_block_by_name(&self, name: MuName) -> &Block {
for block in self.blocks.values() {
if block.name() == name {
return block;
......@@ -1466,7 +1468,7 @@ pub fn is_valid_c_identifier(name: &MuName) -> bool {
/// changes name to mangled name
/// This will always return a valid C identifier
pub fn mangle_name(name: MuName) -> MuName {
pub fn mangle_name(name: MuName) -> String {
let name = name.replace('@', "");
if name.starts_with("__mu_") {
// TODO: Get rid of this, since it will be triggered if a client provides a name
......@@ -1488,7 +1490,7 @@ pub fn mangle_name(name: MuName) -> MuName {
/// demangles a Mu name
// WARNING: This only reverses mangle_name above when no warning is issued)
pub fn demangle_name(mut name: MuName) -> MuName {
pub fn demangle_name(mut name: String) -> MuName {
let name = if cfg!(target_os = "macos") && name.starts_with("___mu_") {
name.split_off(1)
} else {
......@@ -1507,13 +1509,13 @@ pub fn demangle_name(mut name: MuName) -> MuName {
.replace("Zh", "-")
.replace("Zd", ".")
.replace("ZZ", "Z");
name
Arc::new(name)
}
extern crate regex;
/// identifies mu names and demangles them
pub fn demangle_text(text: String) -> String {
pub fn demangle_text(text: &String) -> String {
use self::regex::Regex;
lazy_static!{
......@@ -1539,14 +1541,14 @@ impl MuEntityHeader {
pub fn unnamed(id: MuID) -> MuEntityHeader {
MuEntityHeader {
id: id,
name: format!("#{}", id)
name: Arc::new(format!("#{}", id))
}
}
pub fn named(id: MuID, name: MuName) -> MuEntityHeader {
MuEntityHeader {
id: id,
name: name.replace('@', "")
name: Arc::new(name.replace('@', ""))
}
}
......@@ -1559,7 +1561,7 @@ impl MuEntityHeader {
}
/// an abbreviate (easy reading) version of the name
fn abbreviate_name(&self) -> MuName {
fn abbreviate_name(&self) -> String {
let split: Vec<&str> = self.name.split('.').collect();
let mut ret = "".to_string();
......@@ -1580,7 +1582,7 @@ impl MuEntityHeader {
pub fn clone_with_id(&self, new_id: MuID) -> MuEntityHeader {
let mut clone = self.clone();
clone.id = new_id;
clone.name = format!("{}-#{}", clone.name, clone.id);
clone.name = Arc::new(format!("{}-#{}", clone.name, clone.id));
clone
}
}
......
......@@ -105,7 +105,7 @@ impl ASMCode {
false
}
fn get_block_by_inst(&self, inst: usize) -> (&String, &ASMBlock) {
fn get_block_by_inst(&self, inst: usize) -> (&MuName, &ASMBlock) {
for (name, block) in self.blocks.iter() {
if inst >= block.start_inst && inst < block.end_inst {
return (name, block);
......@@ -693,7 +693,7 @@ impl MachineCode for ASMCode {
let asm = &mut self.code[inst];
let inst = String::from(asm.code.split_whitespace().next().unwrap());
asm.code = format!("{} {}", inst, mangle_name(String::from(new_dest)));
asm.code = format!("{} {}", inst, mangle_name(Arc::new(new_dest.to_string())));
asm.succs.clear();
asm.succs.push(succ);
}
......@@ -816,7 +816,7 @@ impl MachineCode for ASMCode {
trace!(
"#{}\t{:30}\t\tdefine: {:?}\tuses: {:?}\tpred: {:?}\tsucc: {:?}",
i,
demangle_text(self.code[i].code.clone()),
demangle_text(&self.code[i].code),
self.get_inst_reg_defines(i),
self.get_inst_reg_uses(i),
self.code[i].preds,
......@@ -825,26 +825,26 @@ impl MachineCode for ASMCode {
}
fn get_ir_block_livein(&self, block: &str) -> Option<&Vec<MuID>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(&block.livein),
None => None
}
}
fn get_ir_block_liveout(&self, block: &str) -> Option<&Vec<MuID>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(&block.liveout),
None => None
}
}
fn set_ir_block_livein(&mut self, block: &str, set: Vec<MuID>) {
let block = self.blocks.get_mut(block).unwrap();
let block = self.blocks.get_mut(&block.to_string()).unwrap();
block.livein = set;
}
fn set_ir_block_liveout(&mut self, block: &str, set: Vec<MuID>) {
let block = self.blocks.get_mut(block).unwrap();
let block = self.blocks.get_mut(&block.to_string()).unwrap();
block.liveout = set;
}
......@@ -857,7 +857,7 @@ impl MachineCode for ASMCode {
}
fn get_block_range(&self, block: &str) -> Option<ops::Range<usize>> {
match self.blocks.get(block) {
match self.blocks.get(&block.to_string()) {
Some(ref block) => Some(block.start_inst..block.end_inst),
None => None
}
......@@ -1000,10 +1000,10 @@ pub struct ASMCodeGen {
const REG_PLACEHOLDER_LEN: usize = 5;
lazy_static! {
pub static ref REG_PLACEHOLDER : String = {
pub static ref REG_PLACEHOLDER : MuName = {
let blank_spaces = [' ' as u8; REG_PLACEHOLDER_LEN];
format!("{}", str::from_utf8(&blank_spaces).unwrap())
Arc::new(format!("{}", str::from_utf8(&blank_spaces).unwrap()))
};
}
......@@ -1033,7 +1033,7 @@ impl ASMCodeGen {
}
fn add_asm_symbolic(&mut self, code: String) {
trace_emit!("{}", demangle_text(code.clone()));
trace_emit!("{}", demangle_text(&code));
self.cur_mut().code.push(ASMInst::symbolic(code));
}
......@@ -1098,7 +1098,7 @@ impl ASMCodeGen {
target: ASMBranchTarget,
spill_info: Option<SpillMemInfo>
) {
trace!("asm: {}", demangle_text(code.clone()));
trace!("asm: {}", demangle_text(&code));
trace!(" defines: {:?}", defines);
trace!(" uses: {:?}", uses);
trace!(" target: {:?}", target);
......@@ -1274,7 +1274,7 @@ impl ASMCodeGen {
format!("{}", op.name())
} else {
// virtual register, use place holder
REG_PLACEHOLDER.clone()
(**REG_PLACEHOLDER).clone()
}
}
......@@ -2119,7 +2119,7 @@ impl ASMCodeGen {
fn internal_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
code: String,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2192,8 +2192,8 @@ impl CodeGenerator for ASMCodeGen {
self.add_asm_symbolic(format!(".type {}, @function", func_symbol.clone()));
self.add_asm_symbolic(format!("{}:", func_symbol.clone()));
if is_valid_c_identifier(&func_name) {
self.add_asm_symbolic(directive_globl(func_name.clone()));
self.add_asm_symbolic(directive_equiv(func_name.clone(), func_symbol.clone()));
self.add_asm_symbolic(directive_globl((*func_name).clone()));
self.add_asm_symbolic(directive_equiv((*func_name).clone(), func_symbol.clone()));
}
ValueLocation::Relocatable(RegGroup::GPR, func_name)
......@@ -2204,9 +2204,9 @@ impl CodeGenerator for ASMCodeGen {
func_name: MuName
) -> (Box<MachineCode + Sync + Send>, ValueLocation) {
let func_end = {
let mut symbol = func_name.clone();
let mut symbol = (*func_name).clone();
symbol.push_str(":end");
symbol
Arc::new(symbol)
};
let func_symbol = mangle_name(func_name.clone());
let func_end_sym = mangle_name(func_end.clone());
......@@ -2229,8 +2229,8 @@ impl CodeGenerator for ASMCodeGen {
fn start_code_sequence(&mut self) {
self.cur = Some(Box::new(ASMCode {
name: "snippet".to_string(),
entry: "none".to_string(),
name: Arc::new("snippet".to_string()),
entry: Arc::new("none".to_string()),
code: vec![],
blocks: linked_hashmap!{},
frame_size_patchpoints: vec![]
......@@ -2401,7 +2401,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_bl(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2428,7 +2428,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_blr(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2461,7 +2461,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_b_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -2516,7 +2516,7 @@ impl CodeGenerator for ASMCodeGen {
fn emit_br_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -3444,7 +3444,7 @@ pub fn emit_code(fv: &mut MuFunctionVersion, vm: &VM) {
{
let mut demangled_path = path::PathBuf::new();
demangled_path.push(&vm.vm_options.flag_aot_emit_dir);
demangled_path.push(func.name() + ".demangled.S");
demangled_path.push((*func.name()).clone() + ".demangled.S");
let mut demangled_file = match File::create(demangled_path.as_path()) {
Err(why) => {
......@@ -3468,7 +3468,7 @@ pub fn emit_code(fv: &mut MuFunctionVersion, vm: &VM) {
};
let mut f = String::new();
mangled_file.read_to_string(&mut f).unwrap();
let d = demangle_text(f);
let d = demangle_text(&f);
match demangled_file.write_all(d.as_bytes()) {
Err(why) => {
panic!(
......@@ -3577,8 +3577,8 @@ use std::collections::HashMap;
pub fn emit_context_with_reloc(
vm: &VM,
symbols: HashMap<Address, String>,
fields: HashMap<Address, String>
symbols: HashMap<Address, MuName>,
fields: HashMap<Address, MuName>
) {
use std::path;
use std::io::prelude::*;
......@@ -3655,6 +3655,7 @@ pub fn emit_context_with_reloc(
writeln!(file, "{}:", global_cell_name.clone()).unwrap();
if is_valid_c_identifier(&demangled_name) {
let demangled_name = (*demangled_name).clone();
writeln!(file, "\t{}", directive_globl(demangled_name.clone())).unwrap();
writeln!(
file,
......
......@@ -120,7 +120,7 @@ pub trait CodeGenerator {
// Calls
fn emit_bl(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -129,7 +129,7 @@ pub trait CodeGenerator {
) -> Option<ValueLocation>;
fn emit_blr(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -141,7 +141,7 @@ pub trait CodeGenerator {
fn emit_br(&mut self, dest_address: Reg);
fn emit_b_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: MuName,
pe: Option<MuName>,
args: Vec<P<Value>>,
......@@ -151,7 +151,7 @@ pub trait CodeGenerator {
) -> Option<ValueLocation>;
fn emit_br_call(
&mut self,
callsite: Option<String>,
callsite: Option<MuName>,
func: Reg,
pe: Option<MuName>,
args: Vec<P<Value>>,
......
......@@ -88,7 +88,7 @@ impl<'a> InstructionSelection {
combined_return_types: HashMap::new(),
current_return_type: None,
current_fv_id: 0,
current_fv_name: String::new(),
current_fv_name: Arc::new(String::new()),
current_callsite_id: 0,
current_frame: None,
current_block: None,
......@@ -1807,7 +1807,7 @@ impl<'a> InstructionSelection {
// Call muentry_throw_exception
let callsite = self.backend.emit_bl(
Some(callsite_label),
"muentry_throw_exception".to_string(),
entrypoints::THROW_EXCEPTION.aot.to_relocatable(),
None,
vec![X0.clone()],
CALLER_SAVED_REGS.to_vec(),
......@@ -3807,7 +3807,7 @@ impl<'a> InstructionSelection {
} else {
//declare_type(&self, entity: MuEntityHeader, ty: MuType_)
let id = new_internal_id();
let name = format!("return_type:#{}", id);
let name = Arc::new(format!("return_type:#{}", id));
let header = MuEntityHeader::named(new_internal_id(), name.clone());
vm.declare_type(header, MuType_::mustruct(name, sig.ret_tys.to_vec()))
},
......@@ -4899,7 +4899,7 @@ impl<'a> InstructionSelection {
) {
trace!("ISAAC: sig[{}] args ({:?})", sig, args);
let prologue_block = format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME);
let prologue_block = Arc::new(format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME));
self.start_block(prologue_block);
// Push the frame pointer and link register onto the stack
......@@ -5933,7 +5933,7 @@ impl<'a> InstructionSelection {
layout[index] as i64
}
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> String {
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> MuName {
let ret = {
if cur_node.is_some() {
make_block_name(
......@@ -5941,11 +5941,11 @@ impl<'a> InstructionSelection {
format!("callsite_{}", self.current_callsite_id).as_str()
)
} else {
format!(
Arc::new(format!(
"{}:callsite_{}",
self.current_fv_name,
self.current_callsite_id
)
))
}
};
self.current_callsite_id += 1;
......@@ -5957,7 +5957,7 @@ impl<'a> InstructionSelection {
self.backend.end_block(cur_block.clone());
}
fn start_block(&mut self, block: String) {
fn start_block(&mut self, block: MuName) {
self.current_block = Some(block.clone());
self.backend.start_block(block.clone());
}
......
......@@ -59,7 +59,7 @@ macro_rules! REGISTER {
($id:expr, $name: expr, $ty: ident) => {
{
P(Value {
hdr: MuEntityHeader::named($id, $name.to_string()),
hdr: MuEntityHeader::named($id, Arc::new($name.to_string())),
ty: $ty.clone(),
v: Value_::SSAVar($id)
})
......@@ -2392,9 +2392,9 @@ pub fn emit_addr_sym(backend: &mut CodeGenerator, dest: &P<Value>, src: &P<Value
hdr: MuEntityHeader::unnamed(vm.next_id()),
ty: UINT64_TYPE.clone(),
v: Value_::Constant(Constant::ExternSym(if is_native {
format!("/*C*/:got_lo12:{}", label)
Arc::new(format!("/*C*/:got_lo12:{}", label))
} else {
format!(":got_lo12:{}", mangle_name(label.clone()))
Arc::new(format!(":got_lo12:{}", mangle_name(label.clone())))
}))
});
......
......@@ -226,7 +226,7 @@ pub trait CodeGenerator {
// call
fn emit_call_near_rel32(
&mut self,
callsite: String,
callsite: MuName,
func: MuName,
pe: Option<MuName>,
uses: Vec<P<Value>>,
......@@ -235,7 +235,7 @@ pub trait CodeGenerator {
) -> ValueLocation;
fn emit_call_near_r64(
&mut self,
callsite: String,
callsite: MuName,
func: &P<Value>,
pe: Option<MuName>,
uses: Vec<P<Value>>,
......@@ -243,7 +243,7 @@ pub trait CodeGenerator {
) -> ValueLocation;
fn emit_call_near_mem64(
&mut self,
callsite: String,
callsite: MuName,
func: &P<Value>,
pe: Option<MuName>,
uses: Vec<P<Value>>,
......@@ -253,7 +253,7 @@ pub trait CodeGenerator {
// sometimes we use jmp as a call (but without pushing return address)
fn emit_call_jmp(
&mut self,
callsite: String,
callsite: MuName,
func: MuName,
pe: Option<MuName>,
uses: Vec<P<Value>>,
......@@ -262,7 +262,7 @@ pub trait CodeGenerator {
) -> ValueLocation;
fn emit_call_jmp_indirect(
&mut self,
callsite: String,
callsite: MuName,
func: &P<Value>,
pe: Option<MuName>,
uses: Vec<P<Value>>,
......
......@@ -46,7 +46,7 @@ use utils::{BitSize, ByteSize};
use std::collections::HashMap;
use std::collections::LinkedList;
use std::sync::Arc;
use std::any::Any;
lazy_static! {
......@@ -176,7 +176,7 @@ impl<'a> InstructionSelection {
backend: Box::new(ASMCodeGen::new()),
current_fv_id: 0,
current_fv_name: String::new(),
current_fv_name: Arc::new(String::new()),
current_sig: None,
current_callsite_id: 0,
current_frame: None,
......@@ -4850,7 +4850,7 @@ impl<'a> InstructionSelection {
f_context: &mut FunctionContext,
vm: &VM
) {
let block_name = format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME);
let block_name = Arc::new(format!("{}:{}", self.current_fv_name, PROLOGUE_BLOCK_NAME));
self.backend.start_block(block_name.clone());
// push rbp
......@@ -6367,7 +6367,7 @@ impl<'a> InstructionSelection {
}
/// creates a callsite label that is globally unique
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> String {
fn new_callsite_label(&mut self, cur_node: Option<&TreeNode>) -> MuName {
let ret = {
if cur_node.is_some() {
make_block_name(
......@@ -6375,11 +6375,11 @@ impl<'a> InstructionSelection {
format!("callsite_{}", self.current_callsite_id).as_str()
)
} else {
format!(
Arc::new(format!(
"{}:callsite_{}",
self.current_fv_name,
self.current_callsite_id
)
))
}
};
self.current_callsite_id += 1;
......@@ -6510,7 +6510,7 @@ impl<'a> InstructionSelection {
}
/// starts a new block
fn start_block(&mut self, block: String) {
fn start_block(&mut self, block: MuName) {
self.current_block = Some(block.clone());
self.backend.start_block(block);
}
......
......@@ -46,6 +46,7 @@ use ast::ir::*;
use ast::types::*;
use compiler::backend::RegGroup;
use vm::VM;
use std::sync::Arc;
use utils::LinkedHashMap;
use std::collections::HashMap;
......@@ -96,7 +97,7 @@ macro_rules! GPR {
($id:expr, $name: expr, $ty: ident) => {
{
P(Value {
hdr: MuEntityHeader::named($id, $name.to_string()),
hdr: MuEntityHeader::named($id, Arc::new($name.to_string())),
ty: $ty.clone(),
v: Value_::SSAVar($id)
})
......@@ -109,7 +110,7 @@ macro_rules! FPR {
($id:expr, $name: expr) => {
{
P(Value {
hdr: MuEntityHeader::named($id, $name.to_string()),
hdr: MuEntityHeader::named($id, Arc::new($name.to_string())),
ty: DOUBLE_TYPE.clone(),
v: Value_::SSAVar($id)
})
......
......@@ -146,7 +146,7 @@ fn emit_mc_dot(func: &MuFunctionVersion, vm: &VM) {
// create emit directory/file
create_emit_directory(vm);
let mut file = create_emit_file(func_name.clone() + ".mc.dot", &vm);
let mut file = create_emit_file((*func_name).clone() + ".mc.dot", &vm);
// diagraph func {
writeln!(file, "digraph {} {{", mangle_name(func_name)).unwrap();
......
......@@ -541,5 +541,5 @@ impl RegGroup {
}
fn make_block_name(inst: &MuName, label: &str) -> MuName {
format!("{}:{}", inst, label)
Arc::new(format!("{}:{}", inst, label))
}
......@@ -494,7 +494,7 @@ fn build_global_liveness(cf: &mut CompiledFunction, func: &MuFunctionVersion) {
/// CFGBlockNode represents a basic block as a whole for global liveness analysis
#[derive(Clone, Debug)]
struct CFGBlockNode {
block: String,
block: MuName,
pred: Vec<String>,
succ: Vec<String>,
uses: Vec<MuID>,
......@@ -507,7 +507,7 @@ struct CFGBlockNode {
/// * successors
/// * uses
/// * defs
fn build_cfg_nodes(cf: &mut CompiledFunction) -> LinkedHashMap<String, CFGBlockNode> {
fn build_cfg_nodes(cf: &mut CompiledFunction) -> LinkedHashMap<MuName, CFGBlockNode> {
info!("---local liveness analysis---");
let mc = cf.mc();
let mut ret = LinkedHashMap::new();
......@@ -634,7 +634,7 @@ fn build_cfg_nodes(cf: &mut CompiledFunction) -> LinkedHashMap<String, CFGBlockN
/// global analysis, the iterative algorithm to compute livenss until livein/out reaches a fix point
fn global_liveness_analysis(
blocks: LinkedHashMap<String, CFGBlockNode>,
blocks: LinkedHashMap<MuName, CFGBlockNode>,
cf: &mut CompiledFunction,
func: &MuFunctionVersion
) {
......@@ -642,14 +642,14 @@ fn global_liveness_analysis(
info!("{} blocks", blocks.len());
// init live in and live out
let mut livein: LinkedHashMap<String, LinkedHashSet<MuID>> = {
let mut livein: LinkedHashMap<MuName, LinkedHashSet<MuID>> = {
let mut ret = LinkedHashMap::new();
for name in blocks.keys() {
ret.insert(name.clone(), LinkedHashSet::new());
}
ret
};
let mut liveout: LinkedHashMap<String, LinkedHashSet<MuID>> = {
let mut liveout: LinkedHashMap<MuName, LinkedHashSet<MuID>> = {
let mut ret = LinkedHashMap::new();
for name in blocks.keys() {
ret.insert(name.clone(), LinkedHashSet::new());
......