morphic stuff can happen in the LLVM backend alone

This commit is contained in:
Folkert 2021-06-02 21:38:31 +02:00
parent ab8abb8f11
commit 07e16469e4
2 changed files with 26 additions and 29 deletions

View file

@ -3035,6 +3035,18 @@ pub fn build_procedures_return_main<'a, 'ctx, 'env>(
.unwrap() .unwrap()
} }
// Coming soon
// pub enum AliasAnalysisSolutions {
// NotAvailable,
// Available(morphic_lib::Solutions),
// }
//
// impl std::fmt::Debug for AliasAnalysisSolutions {
// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// write!(f, "AliasAnalysisSolutions {{}}")
// }
// }
fn build_procedures_help<'a, 'ctx, 'env>( fn build_procedures_help<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>, env: &Env<'a, 'ctx, 'env>,
opt_level: OptLevel, opt_level: OptLevel,
@ -3044,6 +3056,20 @@ fn build_procedures_help<'a, 'ctx, 'env>(
let mut layout_ids = roc_mono::layout::LayoutIds::default(); let mut layout_ids = roc_mono::layout::LayoutIds::default();
let mut scope = Scope::default(); let mut scope = Scope::default();
// Coming Soon
//
// if false {
// let it = state.procedures.iter().map(|x| x.1);
//
// match roc_mono::alias_analysis::spec_program(it) {
// Err(e) => panic!("Error in alias analysis: {:?}", e),
// Ok(solutions) => {
// state.alias_analysis_solutions =
// AliasAnalysisSolutions::Available(solutions)
// }
// }
// }
// Add all the Proc headers to the module. // Add all the Proc headers to the module.
// We have to do this in a separate pass first, // We have to do this in a separate pass first,
// because their bodies may reference each other. // because their bodies may reference each other.

View file

@ -706,7 +706,6 @@ pub struct MonomorphizedModule<'a> {
pub type_problems: MutMap<ModuleId, Vec<solve::TypeError>>, pub type_problems: MutMap<ModuleId, Vec<solve::TypeError>>,
pub mono_problems: MutMap<ModuleId, Vec<roc_mono::ir::MonoProblem>>, pub mono_problems: MutMap<ModuleId, Vec<roc_mono::ir::MonoProblem>>,
pub procedures: MutMap<(Symbol, TopLevelFunctionLayout<'a>), Proc<'a>>, pub procedures: MutMap<(Symbol, TopLevelFunctionLayout<'a>), Proc<'a>>,
pub alias_analysis_solutions: AliasAnalysisSolutions,
pub exposed_to_host: MutMap<Symbol, Variable>, pub exposed_to_host: MutMap<Symbol, Variable>,
pub header_sources: MutMap<ModuleId, (PathBuf, Box<str>)>, pub header_sources: MutMap<ModuleId, (PathBuf, Box<str>)>,
pub sources: MutMap<ModuleId, (PathBuf, Box<str>)>, pub sources: MutMap<ModuleId, (PathBuf, Box<str>)>,
@ -864,19 +863,6 @@ struct State<'a> {
pub layout_caches: std::vec::Vec<LayoutCache<'a>>, pub layout_caches: std::vec::Vec<LayoutCache<'a>>,
pub procs: Procs<'a>, pub procs: Procs<'a>,
pub alias_analysis_solutions: AliasAnalysisSolutions,
}
pub enum AliasAnalysisSolutions {
NotAvailable,
Available(morphic_lib::Solutions),
}
impl std::fmt::Debug for AliasAnalysisSolutions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "AliasAnalysisSolutions {{}}")
}
} }
#[derive(Debug)] #[derive(Debug)]
@ -1486,7 +1472,6 @@ where
specializations_in_flight: 0, specializations_in_flight: 0,
layout_caches: std::vec::Vec::with_capacity(num_cpus::get()), layout_caches: std::vec::Vec::with_capacity(num_cpus::get()),
procs: Procs::new_in(arena), procs: Procs::new_in(arena),
alias_analysis_solutions: AliasAnalysisSolutions::NotAvailable,
}; };
// We've now distributed one worker queue to each thread. // We've now distributed one worker queue to each thread.
@ -2085,18 +2070,6 @@ fn update<'a>(
&mut state.procedures, &mut state.procedures,
); );
if false {
let it = state.procedures.iter().map(|x| x.1);
match roc_mono::alias_analysis::spec_program(it) {
Err(e) => panic!("Error in alias analysis: {:?}", e),
Ok(solutions) => {
state.alias_analysis_solutions =
AliasAnalysisSolutions::Available(solutions)
}
}
}
state.constrained_ident_ids.insert(module_id, ident_ids); state.constrained_ident_ids.insert(module_id, ident_ids);
for (module_id, requested) in external_specializations_requested { for (module_id, requested) in external_specializations_requested {
@ -2176,7 +2149,6 @@ fn finish_specialization(
let State { let State {
procedures, procedures,
alias_analysis_solutions,
module_cache, module_cache,
output_path, output_path,
platform_path, platform_path,
@ -2238,7 +2210,6 @@ fn finish_specialization(
subs, subs,
interns, interns,
procedures, procedures,
alias_analysis_solutions,
sources, sources,
header_sources, header_sources,
timings: state.timings, timings: state.timings,