mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Use LayoutRepr directly when possible
This commit is contained in:
parent
7b2d149deb
commit
6714a6fd92
3 changed files with 9 additions and 22 deletions
|
@ -19,8 +19,7 @@ use inkwell::{AddressSpace, IntPredicate};
|
|||
use roc_module::symbol::Interns;
|
||||
use roc_module::symbol::Symbol;
|
||||
use roc_mono::layout::{
|
||||
Builtin, InLayout, Layout, LayoutIds, LayoutInterner, LayoutRepr, STLayoutInterner,
|
||||
SemanticRepr, UnionLayout,
|
||||
Builtin, InLayout, Layout, LayoutIds, LayoutInterner, LayoutRepr, STLayoutInterner, UnionLayout,
|
||||
};
|
||||
|
||||
use super::build::{cast_if_necessary_for_opaque_recursive_pointers, load_roc_value, FunctionSpec};
|
||||
|
@ -805,11 +804,7 @@ fn modify_refcount_str_help<'a, 'ctx>(
|
|||
let parent = fn_val;
|
||||
|
||||
let str_type = zig_str_type(env);
|
||||
// TODO(deref-layout)
|
||||
let str_wrapper = if (Layout {
|
||||
repr: LayoutRepr::Builtin(Builtin::Str),
|
||||
semantic: SemanticRepr::None,
|
||||
})
|
||||
let str_wrapper = if LayoutRepr::Builtin(Builtin::Str)
|
||||
.is_passed_by_reference(layout_interner, env.target_info)
|
||||
{
|
||||
env.builder
|
||||
|
|
|
@ -404,11 +404,7 @@ impl<'a> LowLevelCall<'a> {
|
|||
if l2.repr == backend.layout_interner.get(list_elem).repr =>
|
||||
{
|
||||
let list_offset = 0;
|
||||
// TODO(deref-layout)
|
||||
let elem_offset = Layout {
|
||||
repr: LayoutRepr::Builtin(Builtin::List(list_elem)),
|
||||
semantic: SemanticRepr::None,
|
||||
}
|
||||
let elem_offset = LayoutRepr::Builtin(Builtin::List(list_elem))
|
||||
.stack_size(backend.layout_interner, TARGET_INFO);
|
||||
(list_offset, elem_offset, f2)
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ use crate::ir::{
|
|||
BranchInfo, Call, CallType, Expr, JoinPointId, Literal, ModifyRc, Param, Stmt, UpdateModeId,
|
||||
};
|
||||
use crate::layout::{
|
||||
Builtin, InLayout, Layout, LayoutInterner, LayoutRepr, STLayoutInterner, SemanticRepr,
|
||||
TagIdIntType, UnionLayout,
|
||||
Builtin, InLayout, Layout, LayoutInterner, LayoutRepr, STLayoutInterner, TagIdIntType,
|
||||
UnionLayout,
|
||||
};
|
||||
|
||||
use super::{CodeGenHelp, Context, HelperOp};
|
||||
|
@ -1483,11 +1483,7 @@ fn refcount_union_rec<'a>(
|
|||
};
|
||||
|
||||
let rc_structure_stmt = {
|
||||
// TODO(deref-layout)
|
||||
let alignment = Layout {
|
||||
repr: LayoutRepr::Union(union_layout),
|
||||
semantic: SemanticRepr::None,
|
||||
}
|
||||
let alignment = LayoutRepr::Union(union_layout)
|
||||
.allocation_alignment_bytes(layout_interner, root.target_info);
|
||||
let ret_stmt = rc_return_stmt(root, ident_ids, ctx);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue