Add an offset alias expression

This should make dealing with def elements (vector etc) easier.
This commit is contained in:
Bill Currie 2019-06-10 18:13:28 +09:00
parent efdfc7436f
commit 913b9f52e0
2 changed files with 13 additions and 0 deletions

View file

@ -558,6 +558,7 @@ expr_t *new_this_expr (void);
expr_t *new_ret_expr (struct type_s *type);
expr_t *new_alias_expr (struct type_s *type, expr_t *expr);
expr_t *new_offset_alias_expr (struct type_s *type, expr_t *expr, int offset);
/** Create an expression of the correct type that references the specified
parameter slot.

View file

@ -1025,6 +1025,18 @@ new_alias_expr (type_t *type, expr_t *expr)
return alias;
}
expr_t *
new_offset_alias_expr (type_t *type, expr_t *expr, int offset)
{
expr_t *alias;
alias = new_binary_expr ('A', expr, new_integer_expr (offset));
alias->e.expr.type = type;
alias->file = expr->file;
alias->line = expr->line;
return alias;
}
static expr_t *
param_expr (const char *name, type_t *type)
{