diff --git a/README.md b/README.md index 9ad0d7f..c3eb8c1 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Currently missing relevant features (TODOs) are: - ~~Extern functions~~ (DONE) - ~~Strings~~ (DONE) - Loops +- Debug Information ### Why "Reid" diff --git a/reid-llvm-lib/src/builder.rs b/reid-llvm-lib/src/builder.rs index 3e78fde..7ec0f5b 100644 --- a/reid-llvm-lib/src/builder.rs +++ b/reid-llvm-lib/src/builder.rs @@ -5,12 +5,15 @@ use std::{cell::RefCell, rc::Rc}; use crate::{ BlockData, ConstValue, FunctionData, Instr, InstructionData, ModuleData, TerminatorKind, Type, - util::match_types, + TypeData, util::match_types, }; #[derive(Clone, Hash, Copy, PartialEq, Eq)] pub struct ModuleValue(pub(crate) usize); +#[derive(Clone, Hash, Copy, PartialEq, Eq)] +pub struct TypeValue(pub(crate) ModuleValue, pub(crate) usize); + #[derive(Clone, Hash, Copy, PartialEq, Eq)] pub struct FunctionValue(pub(crate) ModuleValue, pub(crate) usize); @@ -25,6 +28,13 @@ pub struct ModuleHolder { pub(crate) value: ModuleValue, pub(crate) data: ModuleData, pub(crate) functions: Vec, + pub(crate) types: Vec, +} + +#[derive(Clone)] +pub struct TypeHolder { + pub(crate) value: TypeValue, + pub(crate) data: TypeData, } #[derive(Clone)] @@ -65,6 +75,7 @@ impl Builder { value, data, functions: Vec::new(), + types: Vec::new(), }); value } diff --git a/reid-llvm-lib/src/compile.rs b/reid-llvm-lib/src/compile.rs index 18e312d..418734d 100644 --- a/reid-llvm-lib/src/compile.rs +++ b/reid-llvm-lib/src/compile.rs @@ -196,6 +196,10 @@ impl ModuleHolder { context.context_ref, ); + for _ty in &self.types { + todo!("Do something with types!"); + } + // Compile the contents let mut functions = HashMap::new(); diff --git a/reid-llvm-lib/src/lib.rs b/reid-llvm-lib/src/lib.rs index 75f703f..f57a23f 100644 --- a/reid-llvm-lib/src/lib.rs +++ b/reid-llvm-lib/src/lib.rs @@ -263,3 +263,14 @@ pub enum TerminatorKind { Br(BlockValue), CondBr(InstructionValue, BlockValue, BlockValue), } + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub struct TypeData { + name: String, + kind: CustomTypeKind, +} + +#[derive(Debug, PartialEq, Eq, Clone, Hash)] +pub enum CustomTypeKind { + Struct(Vec), +}