mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 05:01:24 +00:00
[qfcc] Put unary expressions into the dag
Missed optimization opportunities.
This commit is contained in:
parent
495a1c7994
commit
d10da51a1f
1 changed files with 7 additions and 5 deletions
|
@ -126,7 +126,7 @@ pointer_deref (const expr_t *e)
|
||||||
scoped_src_loc (e);
|
scoped_src_loc (e);
|
||||||
auto new = new_unary_expr ('.', e);
|
auto new = new_unary_expr ('.', e);
|
||||||
new->expr.type = get_type (e)->fldptr.type;
|
new->expr.type = get_type (e)->fldptr.type;
|
||||||
return new;
|
return edag_add_expr (fold_constants (new));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const expr_t *
|
static const expr_t *
|
||||||
|
@ -512,16 +512,18 @@ unary_expr (int op, const expr_t *e)
|
||||||
*neg = *e;
|
*neg = *e;
|
||||||
neg->expr.e1 = e->expr.e2;
|
neg->expr.e1 = e->expr.e2;
|
||||||
neg->expr.e2 = e->expr.e1;
|
neg->expr.e2 = e->expr.e1;
|
||||||
return neg;
|
return edag_add_expr (neg);
|
||||||
}
|
}
|
||||||
if (unary_type->process) {
|
if (unary_type->process) {
|
||||||
return unary_type->process (e);
|
e = unary_type->process (e);
|
||||||
|
e = fold_constants (e);
|
||||||
|
return edag_add_expr (e);
|
||||||
}
|
}
|
||||||
if (is_constant (e) && !unary_type->constant) {
|
if (is_constant (e) && !unary_type->constant) {
|
||||||
internal_error (e, "unexpected expression type");
|
internal_error (e, "unexpected expression type");
|
||||||
}
|
}
|
||||||
if (is_constant (e) && unary_type->constant) {
|
if (is_constant (e) && unary_type->constant) {
|
||||||
return unary_type->constant (e);
|
return edag_add_expr (unary_type->constant (e));
|
||||||
}
|
}
|
||||||
auto result_type = t;
|
auto result_type = t;
|
||||||
if (unary_type->result_type) {
|
if (unary_type->result_type) {
|
||||||
|
@ -533,5 +535,5 @@ unary_expr (int op, const expr_t *e)
|
||||||
}
|
}
|
||||||
auto new = new_unary_expr (op, e);
|
auto new = new_unary_expr (op, e);
|
||||||
new->expr.type = result_type;
|
new->expr.type = result_type;
|
||||||
return new;
|
return edag_add_expr (fold_constants (new));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue