Lines Matching refs:expr

39 static struct expression * dup_expression(struct expression *expr)  in dup_expression()  argument
41 struct expression *dup = alloc_expression(expr->pos, expr->type); in dup_expression()
42 *dup = *expr; in dup_expression()
78 static struct expression * copy_expression(struct expression *expr) in copy_expression() argument
80 if (!expr) in copy_expression()
83 switch (expr->type) { in copy_expression()
89 struct symbol *sym = copy_symbol(expr->pos, expr->symbol); in copy_expression()
90 if (sym == expr->symbol) in copy_expression()
92 expr = dup_expression(expr); in copy_expression()
93 expr->symbol = sym; in copy_expression()
107 struct expression *unop = copy_expression(expr->unop); in copy_expression()
108 if (expr->unop == unop) in copy_expression()
110 expr = dup_expression(expr); in copy_expression()
111 expr->unop = unop; in copy_expression()
116 struct expression *base = copy_expression(expr->base); in copy_expression()
117 expr = dup_expression(expr); in copy_expression()
118 expr->base = base; in copy_expression()
127 struct expression *left = copy_expression(expr->left); in copy_expression()
128 struct expression *right = copy_expression(expr->right); in copy_expression()
129 if (left == expr->left && right == expr->right) in copy_expression()
131 expr = dup_expression(expr); in copy_expression()
132 expr->left = left; in copy_expression()
133 expr->right = right; in copy_expression()
138 struct expression *left = copy_expression(expr->left); in copy_expression()
139 struct expression *right = copy_expression(expr->right); in copy_expression()
140 if (expr->op == '=' && left == expr->left && right == expr->right) in copy_expression()
142 expr = dup_expression(expr); in copy_expression()
143 expr->left = left; in copy_expression()
144 expr->right = right; in copy_expression()
150 struct expression *deref = copy_expression(expr->deref); in copy_expression()
151 expr = dup_expression(expr); in copy_expression()
152 expr->deref = deref; in copy_expression()
158 if (expr->cast_expression->type == EXPR_INITIALIZER) { in copy_expression()
159 struct expression *cast = expr->cast_expression; in copy_expression()
160 struct symbol *sym = expr->cast_type; in copy_expression()
161 expr = dup_expression(expr); in copy_expression()
162 expr->cast_expression = copy_expression(cast); in copy_expression()
163 expr->cast_type = alloc_symbol(sym->pos, sym->type); in copy_expression()
164 *expr->cast_type = *sym; in copy_expression()
172 struct expression *cast = copy_expression(expr->cast_expression); in copy_expression()
173 if (cast == expr->cast_expression) in copy_expression()
175 expr = dup_expression(expr); in copy_expression()
176 expr->cast_expression = cast; in copy_expression()
183 struct expression *cond = copy_expression(expr->conditional); in copy_expression()
184 struct expression *valt = copy_expression(expr->cond_true); in copy_expression()
185 struct expression *valf = copy_expression(expr->cond_false); in copy_expression()
186 if (cond == expr->conditional && valt == expr->cond_true && valf == expr->cond_false) in copy_expression()
188 expr = dup_expression(expr); in copy_expression()
189 expr->conditional = cond; in copy_expression()
190 expr->cond_true = valt; in copy_expression()
191 expr->cond_false = valf; in copy_expression()
197 struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND); in copy_expression()
198 copy_statement(expr->statement, stmt); in copy_expression()
199 expr = dup_expression(expr); in copy_expression()
200 expr->statement = stmt; in copy_expression()
206 struct expression *fn = copy_expression(expr->fn); in copy_expression()
207 struct expression_list *list = expr->args; in copy_expression()
210 expr = dup_expression(expr); in copy_expression()
211 expr->fn = fn; in copy_expression()
212 expr->args = NULL; in copy_expression()
214 add_expression(&expr->args, copy_expression(arg)); in copy_expression()
221 struct expression_list *list = expr->expr_list; in copy_expression()
223 expr = dup_expression(expr); in copy_expression()
224 expr->expr_list = NULL; in copy_expression()
226 add_expression(&expr->expr_list, copy_expression(entry)); in copy_expression()
233 struct symbol *label_symbol = copy_symbol(expr->pos, expr->label_symbol); in copy_expression()
234 expr = dup_expression(expr); in copy_expression()
235 expr->label_symbol = label_symbol; in copy_expression()
240 struct expression *sub_expr = copy_expression(expr->idx_expression); in copy_expression()
241 expr = dup_expression(expr); in copy_expression()
242 expr->idx_expression = sub_expr; in copy_expression()
247 struct expression *sub_expr = copy_expression(expr->ident_expression); in copy_expression()
248 expr = dup_expression(expr); in copy_expression()
249 expr->ident_expression = sub_expr; in copy_expression()
255 struct expression *val = copy_expression(expr->init_expr); in copy_expression()
256 expr = dup_expression(expr); in copy_expression()
257 expr->init_expr = val; in copy_expression()
261 struct expression *val = copy_expression(expr->down); in copy_expression()
262 if (expr->op == '.') { in copy_expression()
263 if (expr->down != val) { in copy_expression()
264 expr = dup_expression(expr); in copy_expression()
265 expr->down = val; in copy_expression()
268 struct expression *idx = copy_expression(expr->index); in copy_expression()
269 if (expr->down != val || expr->index != idx) { in copy_expression()
270 expr = dup_expression(expr); in copy_expression()
271 expr->down = val; in copy_expression()
272 expr->index = idx; in copy_expression()
278 expr = dup_expression(expr); in copy_expression()
279 expr->constraint = copy_expression(expr->constraint); in copy_expression()
280 expr->expr = copy_expression(expr->expr); in copy_expression()
284 warning(expr->pos, "trying to copy expression type %d", expr->type); in copy_expression()
286 return expr; in copy_expression()
292 struct expression *expr; in copy_asm_constraints() local
294 FOR_EACH_PTR(in, expr) { in copy_asm_constraints()
295 add_expression(&out, copy_expression(expr)); in copy_asm_constraints()
296 } END_FOR_EACH_PTR(expr); in copy_asm_constraints()
347 struct expression *expr = copy_expression(stmt->expression); in copy_one_statement() local
348 if (expr == stmt->expression) in copy_one_statement()
351 stmt->expression = expr; in copy_one_statement()
355 struct expression *expr = copy_expression(stmt->range_expression); in copy_one_statement() local
356 if (expr == stmt->expression) in copy_one_statement()
359 stmt->range_expression = expr; in copy_one_statement()
407 struct expression *expr = copy_expression(stmt->switch_expression); in copy_one_statement() local
414 stmt->switch_expression = expr; in copy_one_statement()
507 int inline_function(struct expression *expr, struct symbol *sym) in inline_function() argument
511 struct expression_list *arg_list = expr->args; in inline_function()
512 struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND); in inline_function()
528 expr->type = EXPR_STATEMENT; in inline_function()
529 expr->statement = stmt; in inline_function()
530 expr->ctype = fn->ctype.base_type; in inline_function()
555 struct statement *decl = alloc_statement(expr->pos, STMT_DECLARATION); in inline_function()