for (i = 0; i < vec_size(ec->params); i++)
vec_push(call->params, (ast_expression*)ec->params[i]);
vec_push(vec_last(self->blocks)->exprs, (ast_expression*)call);
+
+ self->ir_func->flags |= IR_FLAG_ACCUMULATE;
}
for (i = 0; i < vec_size(self->blocks); ++i) {
ir_instr *in;
if (!ir_check_unreachable(self))
return false;
+
self->final = true;
+
+ /* can eliminate the return instructions for accumulation */
+ if (self->owner->flags & IR_FLAG_ACCUMULATE)
+ return true;
+
self->is_return = true;
in = ir_instr_new(ctx, self, INSTR_RETURN);
if (!in)
#define IR_FLAG_HAS_GOTO (1<<3)
#define IR_FLAG_INCLUDE_DEF (1<<4)
#define IR_FLAG_ERASEABLE (1<<5)
+#define IR_FLAG_ACCUMULATE (1<<6)
#define IR_FLAG_MASK_NO_OVERLAP (IR_FLAG_HAS_ARRAYS | IR_FLAG_HAS_UNINITIALIZED)
#define IR_FLAG_MASK_NO_LOCAL_TEMPS (IR_FLAG_HAS_ARRAYS | IR_FLAG_HAS_UNINITIALIZED)