asm: implement import and instruction parsing

This commit is contained in:
2024-12-14 20:26:04 +00:00
parent 724f40f19f
commit 462f67c6aa
11 changed files with 805 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ static enum ivy_status init_scope(struct ivy_assembler *as, struct assembler_sco
{
struct ivy_bin_class header = {0};
header.c_ident = b_i32_htob(attrib[IVY_ASM_ATTRIB_IDENT]);
header.c_ident = b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_IDENT]);
assembler_write_data(as, &header, sizeof header);
@@ -23,14 +23,19 @@ static enum ivy_status put_xval(
switch (type) {
case IVY_ASM_XVAL_PROPERTY:
entry.e_type = b_i32_htob(IVY_CLASS_TABLE_PROP);
entry.e_property.p_ident = b_i32_htob(attrib[IVY_ASM_ATTRIB_IDENT]);
entry.e_property.p_get = b_i32_htob(attrib[IVY_ASM_ATTRIB_GET]);
entry.e_property.p_set = b_i32_htob(attrib[IVY_ASM_ATTRIB_SET]);
entry.e_property.p_ident
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_IDENT]);
entry.e_property.p_get
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_GET]);
entry.e_property.p_set
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_SET]);
break;
case IVY_ASM_XVAL_MEMBER_VAR:
entry.e_type = b_i32_htob(IVY_CLASS_TABLE_MVAR);
entry.e_mvar.m_ident = b_i32_htob(attrib[IVY_ASM_ATTRIB_IDENT]);
entry.e_mvar.m_index = b_i32_htob(attrib[IVY_ASM_ATTRIB_INDEX]);
entry.e_mvar.m_ident
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_IDENT]);
entry.e_mvar.m_index
= b_i32_htob((uint32_t)attrib[IVY_ASM_ATTRIB_INDEX]);
break;
default:
return IVY_ERR_NOT_SUPPORTED;