Skip to content

Commit

Permalink
WIP: better generics
Browse files Browse the repository at this point in the history
This fixes #502.

Changelog: changed
  • Loading branch information
yorickpeterse committed Sep 16, 2023
1 parent 58fc4ef commit bc8fa2b
Show file tree
Hide file tree
Showing 43 changed files with 1,979 additions and 530 deletions.
17 changes: 10 additions & 7 deletions compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use crate::config::{Config, SOURCE, SOURCE_EXT, TESTS};
use crate::hir;
use crate::linker::link;
use crate::llvm;
use crate::mir::passes as mir;
use crate::mir::printer::to_dot;
use crate::mir::{passes as mir, Mir};
use crate::mir::specialize::Specialize;
use crate::mir::Mir;
use crate::modules_parser::{ModulesParser, ParsedModule};
use crate::state::State;
use crate::type_check::define_types::{
Expand Down Expand Up @@ -131,12 +133,12 @@ impl Compiler {
}

let mut mir = Mir::new();
let state = &mut self.state;

mir::check_global_limits(&mut self.state)
.map_err(CompileError::Internal)?;
mir::check_global_limits(state).map_err(CompileError::Internal)?;

if mir::DefineConstants::run_all(&mut self.state, &mut mir, &modules)
&& mir::LowerToMir::run_all(&mut self.state, &mut mir, modules)
if mir::DefineConstants::run_all(state, &mut mir, &modules)
&& mir::LowerToMir::run_all(state, &mut mir, modules)
{
Ok(mir)
} else {
Expand Down Expand Up @@ -185,8 +187,9 @@ impl Compiler {
}

fn optimise_mir(&mut self, mir: &mut Mir) {
mir::ExpandDrop::run_all(&self.state.db, mir);
mir::ExpandReference::run_all(&self.state.db, mir);
Specialize::run_all(&mut self.state, mir);
mir::ExpandDrop::run_all(&self.state.db, mir); // TODO: remove in favour of specialization
mir::ExpandReference::run_all(&self.state.db, mir); // TODO: remove in favour of specialization
mir::clean_up_basic_blocks(mir);
}

Expand Down
Loading

0 comments on commit bc8fa2b

Please sign in to comment.