[qfcc] Cast functions to ints for comparison

Yet more (non-)wasted instructions.
This commit is contained in:
Bill Currie 2022-01-29 18:59:38 +09:00
parent 61727941fd
commit 5ba6bf02e8
1 changed files with 18 additions and 2 deletions

View File

@ -48,6 +48,7 @@ typedef struct {
static expr_t *pointer_arithmetic (int op, expr_t *e1, expr_t *e2);
static expr_t *pointer_compare (int op, expr_t *e1, expr_t *e2);
static expr_t *func_compare (int op, expr_t *e1, expr_t *e2);
static expr_t *inverse_multiply (int op, expr_t *e1, expr_t *e2);
static expr_t *double_compare (int op, expr_t *e1, expr_t *e2);
@ -172,8 +173,8 @@ static expr_type_t field_field[] = {
};
static expr_type_t func_func[] = {
{EQ, &type_int},
{NE, &type_int},
{EQ, 0, 0, 0, func_compare},
{NE, 0, 0, 0, func_compare},
{0, 0}
};
@ -696,6 +697,21 @@ pointer_compare (int op, expr_t *e1, expr_t *e2)
return e;
}
static expr_t *
func_compare (int op, expr_t *e1, expr_t *e2)
{
expr_t *e;
if (options.code.progsversion < PROG_VERSION) {
e = new_binary_expr (op, e1, e2);
} else {
e = new_binary_expr (op, new_alias_expr (&type_int, e1),
new_alias_expr (&type_int, e2));
}
e->e.expr.type = &type_int;
return e;
}
static expr_t *
inverse_multiply (int op, expr_t *e1, expr_t *e2)
{