WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.6% of users enabled 2FA.

machine_code.rs 1.3 KB
Newer Older
1
use ast::ir::*;
qinsoon's avatar
qinsoon committed
2
use compiler::frame::*;
3
use std::ops;
4
use std::collections::HashMap;
5 6

pub struct CompiledFunction {
qinsoon's avatar
qinsoon committed
7
    pub func_id: MuID,
qinsoon's avatar
qinsoon committed
8
    pub func_ver_id: MuID,
9
    pub temps: HashMap<MuID, MuID>, // assumes one temperary maps to one register
qinsoon's avatar
qinsoon committed
10 11 12
    pub mc: Box<MachineCode>,
    
    pub frame: Frame
13 14 15
}

pub trait MachineCode {
16 17 18
    fn trace_mc(&self);
    fn trace_inst(&self, index: usize);
    
19
    fn emit(&self) -> Vec<u8>;
20 21
    
    fn number_of_insts(&self) -> usize;
qinsoon's avatar
qinsoon committed
22
    
23
    fn is_move(&self, index: usize) -> bool;
qinsoon's avatar
qinsoon committed
24 25
    fn is_using_mem_op(&self, index: usize) -> bool;
    
qinsoon's avatar
qinsoon committed
26 27
    fn get_succs(&self, index: usize) -> &Vec<usize>;
    fn get_preds(&self, index: usize) -> &Vec<usize>;
28 29 30
    
    fn get_inst_reg_uses(&self, index: usize) -> &Vec<MuID>;
    fn get_inst_reg_defines(&self, index: usize) -> &Vec<MuID>;
31
    
32 33
    fn get_ir_block_livein(&self, block: &str) -> Option<&Vec<MuID>>;
    fn get_ir_block_liveout(&self, block: &str) -> Option<&Vec<MuID>>;
34 35
    fn set_ir_block_livein(&mut self, block: &str, set: Vec<MuID>);
    fn set_ir_block_liveout(&mut self, block: &str, set: Vec<MuID>);
36
    
qinsoon's avatar
qinsoon committed
37
    fn get_all_blocks(&self) -> &Vec<MuName>;
38
    fn get_block_range(&self, block: &str) -> Option<ops::Range<usize>>;
39 40 41
    
    fn replace_reg(&mut self, from: MuID, to: MuID);
    fn set_inst_nop(&mut self, index: usize);
42
}