31 lines
738 B
Rust
31 lines
738 B
Rust
use crate::ir::ir_variable::IrVariableId;
|
|
use crate::ir::register_allocation::VrUser;
|
|
use std::collections::HashSet;
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
pub struct IrReadField {
|
|
field_ref_variable: IrVariableId,
|
|
}
|
|
|
|
impl IrReadField {
|
|
pub fn new(field_ref_variable: IrVariableId) -> Self {
|
|
Self { field_ref_variable }
|
|
}
|
|
|
|
pub fn field_ref_variable(&self) -> IrVariableId {
|
|
self.field_ref_variable
|
|
}
|
|
}
|
|
|
|
impl VrUser for IrReadField {
|
|
fn vr_uses(&self) -> HashSet<IrVariableId> {
|
|
HashSet::from([self.field_ref_variable])
|
|
}
|
|
}
|
|
|
|
impl Display for IrReadField {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "IrReadField({})", self.field_ref_variable)
|
|
}
|
|
}
|