ast visiting for IR building

This commit is contained in:
Janis 2025-03-04 18:58:55 +01:00
parent 379769bc59
commit 1a20acd763
4 changed files with 1210 additions and 2 deletions

View file

@ -574,6 +574,17 @@ pub struct TypeInfo {
pub signed: bool,
}
impl TypeInfo {
/// byte size
pub fn size(&self) -> u32 {
self.bitsize.div_ceil(8)
}
/// byte align
pub fn align(&self) -> u32 {
self.bitalign.div_ceil(8)
}
}
impl InternPool {
pub fn peer_type(&mut self, lhs: Index, rhs: Index) -> Option<Index> {
if lhs == rhs {

File diff suppressed because it is too large Load diff

View file

@ -70,3 +70,5 @@ impl BitSize for &[u8] {
bits as u32
}
}
pub fn unit<T>(_: T) {}

View file

@ -759,8 +759,8 @@ impl<'tree, 'ir> IRBuilder<'tree, 'ir> {
}
pub struct IR {
nodes: Vec<Inst>,
data: Vec<Option<Data>>,
pub(crate) nodes: Vec<Inst>,
pub(crate) data: Vec<Option<Data>>,
// intern_pool: &'a mut InternPool,
}