mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
Drop unnecessary arg_basic_types
This commit is contained in:
parent
59e6ee0f67
commit
608c4eebd9
4 changed files with 26 additions and 29 deletions
|
@ -294,21 +294,20 @@ pub fn gen(src: &[u8], target: Triple, opt_level: OptLevel) -> Result<(String, S
|
||||||
panic!("A specialization was still marked InProgress after monomorphization had completed: {:?} with layout {:?}", symbol, layout);
|
panic!("A specialization was still marked InProgress after monomorphization had completed: {:?} with layout {:?}", symbol, layout);
|
||||||
}
|
}
|
||||||
Done(proc) => {
|
Done(proc) => {
|
||||||
let (fn_val, arg_basic_types) =
|
let fn_val = build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
|
||||||
|
|
||||||
headers.push((proc, fn_val, arg_basic_types));
|
headers.push((proc, fn_val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build each proc using its header info.
|
// Build each proc using its header info.
|
||||||
for (proc, fn_val, arg_basic_types) in headers {
|
for (proc, fn_val) in headers {
|
||||||
// NOTE: This is here to be uncommented in case verification fails.
|
// NOTE: This is here to be uncommented in case verification fails.
|
||||||
// (This approach means we don't have to defensively clone name here.)
|
// (This approach means we don't have to defensively clone name here.)
|
||||||
//
|
//
|
||||||
// println!("\n\nBuilding and then verifying function {}\n\n", name);
|
// println!("\n\nBuilding and then verifying function {}\n\n", name);
|
||||||
build_proc(&env, &mut layout_ids, proc, fn_val, arg_basic_types);
|
build_proc(&env, &mut layout_ids, proc, fn_val);
|
||||||
|
|
||||||
if fn_val.verify(true) {
|
if fn_val.verify(true) {
|
||||||
fpm.run_on(&fn_val);
|
fpm.run_on(&fn_val);
|
||||||
|
|
|
@ -250,19 +250,18 @@ pub fn gen(
|
||||||
// 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.
|
||||||
for ((symbol, layout), proc) in procs.get_specialized_procs(arena) {
|
for ((symbol, layout), proc) in procs.get_specialized_procs(arena) {
|
||||||
let (fn_val, arg_basic_types) =
|
let fn_val = build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
|
||||||
|
|
||||||
headers.push((proc, fn_val, arg_basic_types));
|
headers.push((proc, fn_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build each proc using its header info.
|
// Build each proc using its header info.
|
||||||
for (proc, fn_val, arg_basic_types) in headers {
|
for (proc, fn_val) in headers {
|
||||||
// NOTE: This is here to be uncommented in case verification fails.
|
// NOTE: This is here to be uncommented in case verification fails.
|
||||||
// (This approach means we don't have to defensively clone name here.)
|
// (This approach means we don't have to defensively clone name here.)
|
||||||
//
|
//
|
||||||
// println!("\n\nBuilding and then verifying function {:?}\n\n", proc);
|
// println!("\n\nBuilding and then verifying function {:?}\n\n", proc);
|
||||||
build_proc(&env, &mut layout_ids, proc, fn_val, arg_basic_types);
|
build_proc(&env, &mut layout_ids, proc, fn_val);
|
||||||
|
|
||||||
if fn_val.verify(true) {
|
if fn_val.verify(true) {
|
||||||
fpm.run_on(&fn_val);
|
fpm.run_on(&fn_val);
|
||||||
|
|
|
@ -1373,7 +1373,7 @@ pub fn build_proc_header<'a, 'ctx, 'env>(
|
||||||
symbol: Symbol,
|
symbol: Symbol,
|
||||||
layout: &Layout<'a>,
|
layout: &Layout<'a>,
|
||||||
proc: &roc_mono::ir::Proc<'a>,
|
proc: &roc_mono::ir::Proc<'a>,
|
||||||
) -> (FunctionValue<'ctx>, Vec<'a, BasicTypeEnum<'ctx>>) {
|
) -> FunctionValue<'ctx> {
|
||||||
let args = proc.args;
|
let args = proc.args;
|
||||||
let arena = env.arena;
|
let arena = env.arena;
|
||||||
let context = &env.context;
|
let context = &env.context;
|
||||||
|
@ -1407,15 +1407,14 @@ pub fn build_proc_header<'a, 'ctx, 'env>(
|
||||||
fn_val.set_call_conventions(FAST_CALL_CONV);
|
fn_val.set_call_conventions(FAST_CALL_CONV);
|
||||||
}
|
}
|
||||||
|
|
||||||
(fn_val, arg_basic_types)
|
fn_val
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_proc<'a, 'ctx, 'env>(
|
pub fn build_proc<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &'a Env<'a, 'ctx, 'env>,
|
||||||
layout_ids: &mut LayoutIds<'a>,
|
layout_ids: &mut LayoutIds<'a>,
|
||||||
proc: roc_mono::ir::Proc<'a>,
|
proc: roc_mono::ir::Proc<'a>,
|
||||||
fn_val: FunctionValue<'ctx>,
|
fn_val: FunctionValue<'ctx>,
|
||||||
arg_basic_types: Vec<'a, BasicTypeEnum<'ctx>>,
|
|
||||||
) {
|
) {
|
||||||
let args = proc.args;
|
let args = proc.args;
|
||||||
let context = &env.context;
|
let context = &env.context;
|
||||||
|
@ -1429,13 +1428,15 @@ pub fn build_proc<'a, 'ctx, 'env>(
|
||||||
let mut scope = Scope::default();
|
let mut scope = Scope::default();
|
||||||
|
|
||||||
// Add args to scope
|
// Add args to scope
|
||||||
for ((arg_val, arg_type), (layout, arg_symbol)) in
|
for (arg_val, (layout, arg_symbol)) in fn_val.get_param_iter().zip(args) {
|
||||||
fn_val.get_param_iter().zip(arg_basic_types).zip(args)
|
|
||||||
{
|
|
||||||
set_name(arg_val, arg_symbol.ident_string(&env.interns));
|
set_name(arg_val, arg_symbol.ident_string(&env.interns));
|
||||||
|
|
||||||
let alloca =
|
let alloca = create_entry_block_alloca(
|
||||||
create_entry_block_alloca(env, fn_val, arg_type, arg_symbol.ident_string(&env.interns));
|
env,
|
||||||
|
fn_val,
|
||||||
|
arg_val.get_type(),
|
||||||
|
arg_symbol.ident_string(&env.interns),
|
||||||
|
);
|
||||||
|
|
||||||
builder.build_store(alloca, arg_val);
|
builder.build_store(alloca, arg_val);
|
||||||
|
|
||||||
|
|
|
@ -135,15 +135,14 @@ pub fn helper_without_uniqueness<'a>(
|
||||||
// because their bodies may reference each other.
|
// because their bodies may reference each other.
|
||||||
|
|
||||||
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
||||||
let (fn_val, arg_basic_types) =
|
let fn_val = build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
|
||||||
|
|
||||||
headers.push((proc, fn_val, arg_basic_types));
|
headers.push((proc, fn_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build each proc using its header info.
|
// Build each proc using its header info.
|
||||||
for (proc, fn_val, arg_basic_types) in headers {
|
for (proc, fn_val) in headers {
|
||||||
build_proc(&env, &mut layout_ids, proc, fn_val, arg_basic_types);
|
build_proc(&env, &mut layout_ids, proc, fn_val);
|
||||||
|
|
||||||
if fn_val.verify(true) {
|
if fn_val.verify(true) {
|
||||||
function_pass.run_on(&fn_val);
|
function_pass.run_on(&fn_val);
|
||||||
|
@ -324,15 +323,14 @@ pub fn helper_with_uniqueness<'a>(
|
||||||
// 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.
|
||||||
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
for ((symbol, layout), proc) in procs.get_specialized_procs(env.arena).drain() {
|
||||||
let (fn_val, arg_basic_types) =
|
let fn_val = build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
||||||
build_proc_header(&env, &mut layout_ids, symbol, &layout, &proc);
|
|
||||||
|
|
||||||
headers.push((proc, fn_val, arg_basic_types));
|
headers.push((proc, fn_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build each proc using its header info.
|
// Build each proc using its header info.
|
||||||
for (proc, fn_val, arg_basic_types) in headers {
|
for (proc, fn_val) in headers {
|
||||||
build_proc(&env, &mut layout_ids, proc, fn_val, arg_basic_types);
|
build_proc(&env, &mut layout_ids, proc, fn_val);
|
||||||
|
|
||||||
if fn_val.verify(true) {
|
if fn_val.verify(true) {
|
||||||
fpm.run_on(&fn_val);
|
fpm.run_on(&fn_val);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue