Remove tag_name from ResetReuse

This commit is contained in:
Ayaz Hafiz 2022-07-03 15:10:00 -04:00
parent 09c3c4030d
commit 2d169bf518
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 10 additions and 27 deletions

View file

@ -1226,7 +1226,6 @@ fn expr_spec<'a>(
Call(call) => call_spec(builder, env, block, layout, call),
Reuse {
tag_layout,
tag_name: _,
tag_id,
arguments,
..

View file

@ -14,9 +14,7 @@ use roc_mono::ir::{
BranchInfo, CallType, Expr, JoinPointId, ListLiteralElement, Literal, Param, Proc, ProcLayout,
SelfRecursive, Stmt,
};
use roc_mono::layout::{
Builtin, Layout, LayoutId, LayoutIds, TagIdIntType, TagOrClosure, UnionLayout,
};
use roc_mono::layout::{Builtin, Layout, LayoutId, LayoutIds, TagIdIntType, UnionLayout};
mod generic64;
mod object_builder;
@ -915,18 +913,9 @@ trait Backend<'a> {
}
}
Expr::Reuse {
symbol,
arguments,
tag_name,
..
symbol, arguments, ..
} => {
self.set_last_seen(*symbol, stmt);
match tag_name {
TagOrClosure::Closure(sym) => {
self.set_last_seen(*sym, stmt);
}
TagOrClosure::Tag(_) => {}
}
for sym in *arguments {
self.set_last_seen(*sym, stmt);
}

View file

@ -53,14 +53,14 @@ pub fn pretty_print_ir_symbols() -> bool {
// if it went up, maybe check that the change is really required
roc_error_macros::assert_sizeof_wasm!(Literal, 24);
roc_error_macros::assert_sizeof_wasm!(Expr, 48);
roc_error_macros::assert_sizeof_wasm!(Expr, 40);
roc_error_macros::assert_sizeof_wasm!(Stmt, 120);
roc_error_macros::assert_sizeof_wasm!(ProcLayout, 40);
roc_error_macros::assert_sizeof_wasm!(Call, 44);
roc_error_macros::assert_sizeof_wasm!(CallType, 36);
roc_error_macros::assert_sizeof_non_wasm!(Literal, 3 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Expr, 10 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Expr, 9 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Stmt, 19 * 8);
roc_error_macros::assert_sizeof_non_wasm!(ProcLayout, 8 * 8);
roc_error_macros::assert_sizeof_non_wasm!(Call, 9 * 8);
@ -1757,7 +1757,6 @@ pub enum Expr<'a> {
update_mode: UpdateModeId,
// normal Tag fields
tag_layout: UnionLayout<'a>,
tag_name: TagOrClosure,
tag_id: TagIdIntType,
arguments: &'a [Symbol],
},
@ -1860,18 +1859,15 @@ impl<'a> Expr<'a> {
}
Reuse {
symbol,
tag_name,
tag_id,
arguments,
update_mode,
..
} => {
let doc_tag = match tag_name {
TagOrClosure::Tag(TagName(s)) => alloc.text(s.as_str()),
TagOrClosure::Closure(s) => alloc
.text("ClosureTag(")
.append(symbol_to_doc(alloc, *s))
.append(")"),
};
let doc_tag = alloc
.text("TagId(")
.append(alloc.text(tag_id.to_string()))
.append(")");
let it = arguments.iter().map(|s| symbol_to_doc(alloc, *s));

View file

@ -97,7 +97,7 @@ fn function_s<'a, 'i>(
Expr::Tag {
tag_layout,
tag_id,
tag_name,
tag_name: _,
arguments,
} if may_reuse(*tag_layout, *tag_id, c) => {
// for now, always overwrite the tag ID just to be sure
@ -109,7 +109,6 @@ fn function_s<'a, 'i>(
update_tag_id,
tag_layout: *tag_layout,
tag_id: *tag_id,
tag_name: tag_name.clone(),
arguments,
};
let new_stmt = Let(*symbol, new_expr, *layout, continuation);