self->cond = cond;
self->on_true = ontrue;
self->on_false = onfalse;
- self->phi_out = NULL;
return self;
}
* may still happen, thus we remember a created ir_value and simply return one
* if it already exists.
*/
- if (self->phi_out) {
- *out = self->phi_out;
+ if (self->expression.outr) {
+ *out = self->expression.outr;
return true;
}
ir_phi_add(phi, ontrue, trueval);
ir_phi_add(phi, onfalse, falseval);
- self->phi_out = ir_phi_value(phi);
- *out = self->phi_out;
+ self->expression.outr = ir_phi_value(phi);
+ *out = self->expression.outr;
return true;
}
/* It's all just 'expressions', since an ast_block is one too. */
ast_expression *on_true;
ast_expression *on_false;
- /* After a ternary expression we find ourselves in a new IR block
- * and start with a PHI node */
- ir_value *phi_out;
};
ast_ternary* ast_ternary_new(lex_ctx ctx, ast_expression *cond, ast_expression *ontrue, ast_expression *onfalse);
void ast_ternary_delete(ast_ternary*);