mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[qfcc] Give address operands a good expression
That is, those created by operand_address. The dag code needs the expression that is attached to the statement to have the correct expression type in order to do the right thing with the operands and aliasing, especially when generating temps. This fixes assignchain when optimizing (all tests pass again).
This commit is contained in:
parent
025dd63493
commit
72f4b8ccb5
2 changed files with 10 additions and 2 deletions
|
@ -401,7 +401,7 @@ expr_t *new_binary_expr (int op, expr_t *e1, expr_t *e2);
|
|||
/** Create a new unary expression node node.
|
||||
|
||||
If \a e1 is an error expression, then it will be returned instead of a
|
||||
new binary expression.
|
||||
new unary expression.
|
||||
|
||||
\param op The op-code of the unary expression.
|
||||
\param e1 The "right" side of the expression.
|
||||
|
|
|
@ -663,14 +663,22 @@ operand_address (sblock_t *sblock, operand_t *reference, operand_t **op,
|
|||
expr_t *e)
|
||||
{
|
||||
statement_t *s;
|
||||
type_t *type;
|
||||
|
||||
switch (reference->op_type) {
|
||||
case op_def:
|
||||
case op_temp:
|
||||
case op_alias:
|
||||
// build an address expression so dags can extract the correct
|
||||
// type. address_expr cannot be used because reference might not
|
||||
// be something it likes
|
||||
e = expr_file_line (new_unary_expr ('&', e), e);
|
||||
type = pointer_type (reference->type);
|
||||
e->e.expr.type = type;
|
||||
|
||||
s = new_statement (st_expr, "&", e);
|
||||
s->opa = reference;
|
||||
s->opc = temp_operand (pointer_type (reference->type), e);
|
||||
s->opc = temp_operand (type, e);
|
||||
sblock_add_statement (sblock, s);
|
||||
if (op) {
|
||||
*(op) = s->opc;
|
||||
|
|
Loading…
Reference in a new issue