more toplevel

This commit is contained in:
Folkert 2021-06-18 22:25:31 +02:00
parent fe81eabbfa
commit 4256c22004
4 changed files with 90 additions and 87 deletions

View file

@ -9,8 +9,7 @@ use object::{
};
use roc_collections::all::MutMap;
use roc_module::symbol;
use roc_mono::ir::Proc;
use roc_mono::layout::Layout;
use roc_mono::ir::{Proc, TopLevelFunctionLayout};
use target_lexicon::{Architecture as TargetArch, BinaryFormat as TargetBF, Triple};
// This is used by some code below which is currently commented out.
@ -22,7 +21,7 @@ use target_lexicon::{Architecture as TargetArch, BinaryFormat as TargetBF, Tripl
pub fn build_module<'a>(
env: &'a Env,
target: &Triple,
procedures: MutMap<(symbol::Symbol, Layout<'a>), Proc<'a>>,
procedures: MutMap<(symbol::Symbol, TopLevelFunctionLayout<'a>), Proc<'a>>,
) -> Result<Object, String> {
match target {
Triple {
@ -145,7 +144,7 @@ fn generate_wrapper<'a, B: Backend<'a>>(
fn build_object<'a, B: Backend<'a>>(
env: &'a Env,
procedures: MutMap<(symbol::Symbol, Layout<'a>), Proc<'a>>,
procedures: MutMap<(symbol::Symbol, TopLevelFunctionLayout<'a>), Proc<'a>>,
mut backend: B,
mut output: Object,
) -> Result<Object, String> {
@ -187,7 +186,7 @@ fn build_object<'a, B: Backend<'a>>(
let mut procs = Vec::with_capacity_in(procedures.len(), env.arena);
for ((sym, layout), proc) in procedures {
let fn_name = layout_ids
.get(sym, &layout)
.get_toplevel(sym, &layout)
.to_symbol_string(sym, &env.interns);
let section_id = output.add_section(