Lines Matching refs:stmt

46 static struct statement * dup_statement(struct statement *stmt)
48 struct statement *dup = alloc_statement(stmt->pos, stmt->type);
49 *dup = *stmt;
197 struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND);
198 copy_statement(expr->statement, stmt);
200 expr->statement = stmt;
331 static struct statement *copy_one_statement(struct statement *stmt)
333 if (!stmt)
335 switch(stmt->type) {
340 struct statement *newstmt = dup_statement(stmt);
342 FOR_EACH_PTR(stmt->declaration, sym) {
343 struct symbol *newsym = copy_symbol(stmt->pos, sym);
348 stmt = newstmt;
353 struct expression *expr = copy_expression(stmt->expression);
354 if (expr == stmt->expression)
356 stmt = dup_statement(stmt);
357 stmt->expression = expr;
361 struct expression *expr = copy_expression(stmt->range_expression);
362 if (expr == stmt->expression)
364 stmt = dup_statement(stmt);
365 stmt->range_expression = expr;
369 struct statement *new = alloc_statement(stmt->pos, STMT_COMPOUND);
370 copy_statement(stmt, new);
371 stmt = new;
375 struct expression *cond = stmt->if_conditional;
376 struct statement *valt = stmt->if_true;
377 struct statement *valf = stmt->if_false;
382 if (stmt->if_conditional == cond &&
383 stmt->if_true == valt &&
384 stmt->if_false == valf)
386 stmt = dup_statement(stmt);
387 stmt->if_conditional = cond;
388 stmt->if_true = valt;
389 stmt->if_false = valf;
393 struct expression *retval = copy_expression(stmt->ret_value);
394 struct symbol *sym = copy_symbol(stmt->pos, stmt->ret_target);
396 stmt = dup_statement(stmt);
397 stmt->ret_value = retval;
398 stmt->ret_target = sym;
402 stmt = dup_statement(stmt);
403 stmt->case_label = copy_symbol(stmt->pos, stmt->case_label);
404 stmt->case_label->stmt = stmt;
405 stmt->case_expression = copy_expression(stmt->case_expression);
406 stmt->case_to = copy_expression(stmt->case_to);
407 stmt->case_statement = copy_one_statement(stmt->case_statement);
411 struct symbol *switch_break = copy_symbol(stmt->pos, stmt->switch_break);
412 struct symbol *switch_case = copy_symbol(stmt->pos, stmt->switch_case);
413 struct expression *expr = copy_expression(stmt->switch_expression);
414 struct statement *switch_stmt = copy_one_statement(stmt->switch_statement);
416 stmt = dup_statement(stmt);
418 stmt->switch_break = switch_break;
419 stmt->switch_case = switch_case;
420 stmt->switch_expression = expr;
421 stmt->switch_statement = switch_stmt;
425 stmt = dup_statement(stmt);
426 stmt->iterator_break = copy_symbol(stmt->pos, stmt->iterator_break);
427 stmt->iterator_continue = copy_symbol(stmt->pos, stmt->iterator_continue);
428 stmt->iterator_syms = copy_symbol_list(stmt->iterator_syms);
430 stmt->iterator_pre_statement = copy_one_statement(stmt->iterator_pre_statement);
431 stmt->iterator_pre_condition = copy_expression(stmt->iterator_pre_condition);
433 stmt->iterator_statement = copy_one_statement(stmt->iterator_statement);
435 stmt->iterator_post_statement = copy_one_statement(stmt->iterator_post_statement);
436 stmt->iterator_post_condition = copy_expression(stmt->iterator_post_condition);
440 stmt = dup_statement(stmt);
441 stmt->label_identifier = copy_symbol(stmt->pos, stmt->label_identifier);
442 stmt->label_statement = copy_one_statement(stmt->label_statement);
446 stmt = dup_statement(stmt);
447 stmt->goto_label = copy_symbol(stmt->pos, stmt->goto_label);
448 stmt->goto_expression = copy_expression(stmt->goto_expression);
449 stmt->target_list = copy_symbol_list(stmt->target_list);
453 stmt = dup_statement(stmt);
454 stmt->asm_inputs = copy_asm_operands(stmt->asm_inputs);
455 stmt->asm_outputs = copy_asm_operands(stmt->asm_outputs);
460 warning(stmt->pos, "trying to copy statement type %d", stmt->type);
463 return stmt;
477 struct statement *stmt;
479 FOR_EACH_PTR(src->stmts, stmt) {
480 add_statement(&dst->stmts, copy_one_statement(stmt));
481 } END_FOR_EACH_PTR(stmt);
518 struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND);
533 expr->statement = stmt;
556 copy_statement(fn->inline_stmt, stmt);
561 stmt->args = decl;
563 stmt->inline_fn = sym;
580 fn->stmt = alloc_statement(fn->pos, STMT_COMPOUND);
581 copy_statement(fn->inline_stmt, fn->stmt);