53 lines
1.4 KiB
Rust
53 lines
1.4 KiB
Rust
use crate::ir::ir_variable::{IrVariable, IrVariableDescriptor, IrVrVariableDescriptor};
|
|
use crate::ir::register_allocation::{OffsetCounter, VrUser};
|
|
use std::cell::RefCell;
|
|
use std::collections::{HashMap, HashSet};
|
|
use std::fmt::{Display, Formatter};
|
|
use std::rc::Rc;
|
|
|
|
pub struct IrReadField {
|
|
field_ref_variable: Rc<RefCell<IrVariable>>,
|
|
}
|
|
|
|
impl IrReadField {
|
|
pub fn new(field_ref_variable: Rc<RefCell<IrVariable>>) -> Self {
|
|
Self { field_ref_variable }
|
|
}
|
|
|
|
pub fn field_ref_variable(&self) -> &Rc<RefCell<IrVariable>> {
|
|
&self.field_ref_variable
|
|
}
|
|
}
|
|
|
|
impl Display for IrReadField {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}", self.field_ref_variable.borrow(),)
|
|
}
|
|
}
|
|
|
|
impl VrUser for IrReadField {
|
|
fn vr_definitions(&self) -> HashSet<IrVrVariableDescriptor> {
|
|
HashSet::new()
|
|
}
|
|
|
|
fn vr_uses(&self) -> HashSet<IrVrVariableDescriptor> {
|
|
let mut set = HashSet::new();
|
|
if let IrVariableDescriptor::VirtualRegister(vr_variable) =
|
|
self.field_ref_variable.borrow().descriptor()
|
|
{
|
|
set.insert(vr_variable.clone());
|
|
}
|
|
set
|
|
}
|
|
|
|
fn propagate_spills(&mut self, spills: &HashSet<IrVrVariableDescriptor>) {}
|
|
|
|
fn propagate_register_assignments(
|
|
&mut self,
|
|
assignments: &HashMap<IrVrVariableDescriptor, usize>,
|
|
) {
|
|
}
|
|
|
|
fn propagate_stack_offsets(&mut self, counter: &mut OffsetCounter) {}
|
|
}
|