mod.rs 803 Bytes
Newer Older
qinsoon's avatar
qinsoon committed
1 2 3 4 5 6 7
pub extern crate immix_rust as gc;

pub use gc::common::Address;
pub use gc::common::ObjectReference;

pub mod thread;

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
}