Make inc/dec_users return the the expression.

Just for convenience.
This commit is contained in:
Bill Currie 2011-01-11 08:44:43 +09:00
parent 18ae178eaf
commit abe471110c
2 changed files with 8 additions and 4 deletions

View file

@ -539,8 +539,9 @@ expr_t *new_move_expr (expr_t *e1, expr_t *e2, struct type_s *type);
\param e The expression referencing the temporary variable. If
a block expression, the result of the block will be
incremented.
\return \a e
*/
void inc_users (expr_t *e);
expr_t *inc_users (expr_t *e);
/** Temporary variable reference counting.
@ -550,8 +551,9 @@ void inc_users (expr_t *e);
\param e The expression referencing the temporary variable. If
a block expression, the result of the block will be
decremented.
\return \a e
*/
void dec_users (expr_t *e);
expr_t *dec_users (expr_t *e);
/** Convert a name to an expression of the appropriate type.

View file

@ -370,22 +370,24 @@ check_initialized (expr_t *e)
}
}
void
expr_t *
inc_users (expr_t *e)
{
if (e && e->type == ex_temp)
e->e.temp.users++;
else if (e && e->type == ex_block)
inc_users (e->e.block.result);
return e;
}
void
expr_t *
dec_users (expr_t *e)
{
if (e && e->type == ex_temp)
e->e.temp.users--;
else if (e && e->type == ex_block)
dec_users (e->e.block.result);
return e;
}
expr_t *