rvsdg 0.2.0

Type-safe standalone implementation of the RVSDG IR with automatic Phi transformation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use cranelift_entity::{EntityList, EntityRef, ListPool, packed_option::ReservedValue};

pub struct EntityIter<T: EntityRef + ReservedValue> {
    i: usize,
    entities: EntityList<T>,
}

impl<T: EntityRef + ReservedValue> EntityIter<T> {
    pub fn from(entities: EntityList<T>) -> Self {
        Self { i: 0, entities }
    }

    pub fn next(&mut self, pool: &ListPool<T>) -> Option<T> {
        let v = self.entities.get(self.i, pool);
        self.i += 1;
        v
    }
}