GitLab will be upgraded on 30 Jan 2023 from 2.00 pm (AEDT) to 3.00 pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

mod.rs 801 Bytes
Newer Older
1
2
3
4
use compiler::CompilerPass;
use ast::ir::*;
use vm::context::VMContext;

5
6
mod liveness;

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub struct RegisterAllocation {
    name: &'static str
}

impl RegisterAllocation {
    pub fn new() -> RegisterAllocation {
        RegisterAllocation {
            name: "Register Allcoation"
        }
    }
}

impl CompilerPass for RegisterAllocation {
    fn name(&self) -> &'static str {
        self.name
    }
    
    #[allow(unused_variables)]
    fn visit_function(&mut self, vm_context: &VMContext, func: &mut MuFunction) {
26
27
28
29
        let mut compiled_funcs = vm_context.compiled_funcs().read().unwrap();
        let mut cf = compiled_funcs.get(func.fn_name).unwrap().borrow_mut();
        
        cf.mc.print();
30
        
31
32
        let liveness = liveness::build(&mut cf);
        liveness.print();
33
34
    }
}