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.7% of users enabled 2FA.

test_instsel.rs 1011 Bytes
Newer Older
1
2
3
4
5
6
7
extern crate mu;
extern crate log;
extern crate simple_logger;

use test_ir::test_ir::factorial;
use self::mu::compiler::*;

8
9
use std::sync::Arc;

10
11
12
13
#[test]
fn test_instsel_fac() {
    simple_logger::init_with_level(log::LogLevel::Trace).ok();
    
14
15
    let vm_context = Arc::new(factorial());
    
16
17
18
19
20
21
    let compiler = Compiler::new(CompilerPolicy::new(vec![
            Box::new(passes::DefUse::new()),
            Box::new(passes::TreeGen::new()),
            Box::new(passes::ControlFlowAnalysis::new()),
            Box::new(passes::TraceGen::new()),
            Box::new(backend::inst_sel::InstructionSelection::new())
22
    ]), vm_context.clone());
23
    
qinsoon's avatar
qinsoon committed
24
    let funcs = vm_context.funcs().read().unwrap();
25
26
27
    let factorial_func = funcs.get("fac").unwrap().borrow();
    let func_vers = vm_context.func_vers().read().unwrap();
    let mut factorial_func_ver = func_vers.get(&(factorial_func.fn_name, factorial_func.cur_ver.unwrap())).unwrap().borrow_mut();
28
    
29
    compiler.compile(&mut factorial_func_ver); 
30
}