Fixed asm parsing issue. Use of pointer as argument.

This commit is contained in:
Christoffer Lerno
2023-09-15 08:18:14 +02:00
parent 4a232b7935
commit 6be61aa19c
4 changed files with 9 additions and 4 deletions

View File

@@ -1139,7 +1139,7 @@ static inline void llvm_emit_asm_block_stmt(GenContext *c, Ast *ast)
result_types[result_count++] = llvm_get_type(c, decl->type);
FOREACH_END();
FOREACH_BEGIN(ExprAsmArg * val, block->input)
FOREACH_BEGIN(ExprAsmArg *val, block->input)
BEValue value;
codegen_new_constraint(&clobber_list);
pointer_type[param_count] = NULL;

View File

@@ -228,7 +228,12 @@ static inline bool parse_asm_addr(ParseContext *c, ExprAsmArg *asm_arg)
if (type == TOKEN_MINUS) asm_arg->neg_offset = true;
// If it's an integer, then it's [foo + 123] or [foo - 213]
if (tok_is(c, TOKEN_INTEGER)) return parse_asm_offset(c, asm_arg);
if (tok_is(c, TOKEN_INTEGER))
{
if (!parse_asm_offset(c, asm_arg)) return false;
CONSUME_OR_RET(TOKEN_RBRACKET, false);
return true;
}
// Otherwise we expect the index.
ASSIGN_EXPRID_OR_RET(asm_arg->idx, parse_asm_expr(c), false);

View File

@@ -434,7 +434,7 @@ static inline bool sema_check_asm_arg_value(SemaContext *context, AsmInlineBlock
return false;
}
Type *type = type_flatten(inner->type);
if (type_is_pointer(type)) type = type_uptr;
if (type_is_pointer(type)) type = type_uptr->canonical;
if (type_is_integer(type))
{
if (!sema_reg_int_suported_type(arg_type, type))

View File

@@ -1 +1 @@
#define COMPILER_VERSION "0.4.644"
#define COMPILER_VERSION "0.4.645"