Propagate multiple entrypoints to alias analysis

This commit is contained in:
Richard Feldman 2022-12-06 16:09:34 -05:00
parent 236cebacc1
commit 8b463686bc
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
10 changed files with 282 additions and 352 deletions

View file

@ -11,7 +11,7 @@ use roc_module::symbol::Symbol;
use roc_mono::ir::{
Call, CallType, Expr, HigherOrderLowLevel, HostExposedLayouts, ListLiteralElement, Literal,
ModifyRc, OptLevel, Proc, Stmt,
ModifyRc, OptLevel, Proc, ProcLayout, Stmt,
};
use roc_mono::layout::{
Builtin, CapturesNiche, Layout, RawFunctionLayout, STLayoutInterner, UnionLayout,
@ -136,12 +136,15 @@ pub fn spec_program<'a, I>(
arena: &'a Bump,
interner: &STLayoutInterner<'a>,
opt_level: OptLevel,
opt_entry_point: Option<roc_mono::ir::EntryPoint<'a>>,
entry_points: &'a [(Symbol, ProcLayout<'a>)],
procs: I,
) -> Result<morphic_lib::Solutions>
where
I: Iterator<Item = &'a Proc<'a>>,
{
// TODO support multiple entry points here!
let opt_entry_point = entry_points.first();
let main_module = {
let mut m = ModDefBuilder::new();
@ -226,13 +229,13 @@ where
m.add_func(func_name, spec)?;
}
if let Some(entry_point) = opt_entry_point {
if let Some((symbol, proc_layout)) = opt_entry_point {
// the entry point wrapper
let roc_main_bytes = func_name_bytes_help(
entry_point.symbol,
entry_point.layout.arguments.iter().copied(),
*symbol,
proc_layout.arguments.iter().copied(),
CapturesNiche::no_niche(),
&entry_point.layout.result,
&proc_layout.result,
);
let roc_main = FuncName(&roc_main_bytes);
@ -241,7 +244,7 @@ where
let entry_point_function = build_entry_point(
&mut env,
interner,
entry_point.layout,
*proc_layout,
roc_main,
&host_exposed_functions,
)?;