mod write_asm; use crate::ir; use core::convert::TryFrom; #[derive(Debug, Clone, PartialEq)] pub struct TODO {} /// TODO #[derive(Debug, Clone, PartialEq)] pub struct Asm { pub unit: TranslationUnit, } #[derive(Debug, Clone, PartialEq)] pub struct TranslationUnit { pub functions: Vec>, pub variables: Vec>, } #[derive(Debug, Clone, PartialEq)] pub struct Section { /// Section Headers provice size, offset, type, alignment and flags of the sections /// https://github.com/rv8-io/rv8-io.github.io/blob/master/asm.md#section-header 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. /// https://github.com/rv8-io/rv8-io.github.io/blob/master/asm.md#sections impl Section { pub fn new(header: Vec, body: T) -> Self { Self { header, body } } } #[derive(Debug, Clone, PartialEq)] pub struct Function { pub blocks: Vec, } impl Function { pub fn new(blocks: Vec) -> Self { Self { blocks } } } #[derive(Debug, Clone, PartialEq)] 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)] pub struct Block { pub label: Option