mod write_asm; use crate::ir; use core::convert::TryFrom; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Todo {} /// TODO #[derive(Debug, Clone, PartialEq, Eq)] pub struct Asm { pub unit: TranslationUnit, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct TranslationUnit { pub functions: Vec>, pub variables: Vec>, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Section { /// Section Headers provice size, offset, type, alignment and flags of the sections /// /// For more details: pub header: Vec, pub body: T, } /// An object file is made up of multiple sections, with each section corresponding to /// distinct types of executable code or data. /// /// For more details: impl Section { pub fn new(header: Vec, body: T) -> Self { Self { header, body } } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Function { pub blocks: Vec, } impl Function { pub fn new(blocks: Vec) -> Self { Self { blocks } } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Variable { pub label: Label, pub directives: Vec, } impl Variable { pub fn new(label: Label, directives: Vec) -> Self { Self { label, directives } } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Block { pub label: Option