mod.rs 925 Bytes
Newer Older
1
pub mod mem;
qinsoon's avatar
qinsoon committed
2 3
pub mod thread;

4 5 6 7
pub use runtime::mem::common::Address;
pub use runtime::mem::common::ObjectReference;


8 9 10 11
use ast::ir::*;
use compiler::backend::Word;
use compiler::backend::RegGroup;

12
#[derive(Clone, Debug)]
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
pub enum ValueLocation {
    Register(RegGroup, MuID),
    Direct(RegGroup, Address),
    Indirect(RegGroup, Address),
    Constant(RegGroup, Word),
    
    Relocatable(RegGroup, MuName)
}

impl ValueLocation {
    pub fn load_value(&self) -> (RegGroup, Word) {
        match self {
            &ValueLocation::Register(_, _)
            | &ValueLocation::Direct(_, _)
            | &ValueLocation::Indirect(_, _)
            | &ValueLocation::Constant(_, _) => unimplemented!(),
            &ValueLocation::Relocatable(_, _) => panic!("expect a runtime value")
        }
    }
qinsoon's avatar
qinsoon committed
32
    
33
    #[allow(unused_variables)]
qinsoon's avatar
qinsoon committed
34 35 36
    pub fn from_constant(c: Constant) -> ValueLocation {
        unimplemented!()
    }
qinsoon's avatar
qinsoon committed
37
}