Lines Matching defs:stmt
26 static pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt);
1982 static pseudo_t linearize_compound_statement(struct entrypoint *ep, struct statement *stmt)
1988 FOR_EACH_PTR(stmt->stmts, s) {
2010 static pseudo_t linearize_fn_statement(struct entrypoint *ep, struct statement *stmt)
2016 pseudo = linearize_compound_statement(ep, stmt);
2017 if (!is_void_type(stmt->ret)) { // non-void function
2021 bb_ret = get_bound_block(ep, stmt->ret);
2022 add_return(ep, bb_ret, stmt->ret, undef_pseudo());
2025 bb = add_label(ep, stmt->ret);
2032 static pseudo_t linearize_inlined_call(struct entrypoint *ep, struct statement *stmt)
2035 struct statement *args = stmt->args;
2049 pseudo = linearize_fn_statement(ep, stmt);
2052 insn->func = symbol_pseudo(ep, stmt->inline_fn);
2055 bb->pos = stmt->pos;
2060 static pseudo_t linearize_context(struct entrypoint *ep, struct statement *stmt)
2063 struct expression *expr = stmt->expression;
2066 insn->context_expr = stmt->context;
2071 static pseudo_t linearize_range(struct entrypoint *ep, struct statement *stmt)
2075 use_pseudo(insn, linearize_expression(ep, stmt->range_expression), &insn->src1);
2076 use_pseudo(insn, linearize_expression(ep, stmt->range_low), &insn->src2);
2077 use_pseudo(insn, linearize_expression(ep, stmt->range_high), &insn->src3);
2130 static pseudo_t linearize_asm_statement(struct entrypoint *ep, struct statement *stmt)
2138 expr = stmt->asm_string;
2140 warning(stmt->pos, "expected string in inline asm");
2149 FOR_EACH_PTR(stmt->asm_inputs, op) {
2154 FOR_EACH_PTR(stmt->asm_outputs, op) {
2161 FOR_EACH_PTR(stmt->asm_outputs, op) {
2166 FOR_EACH_PTR(stmt->asm_clobbers, clob) {
2200 static pseudo_t linearize_declaration(struct entrypoint *ep, struct statement *stmt)
2204 concat_symbol_list(stmt->declaration, &ep->syms);
2206 FOR_EACH_PTR(stmt->declaration, sym) {
2212 static pseudo_t linearize_return(struct entrypoint *ep, struct statement *stmt)
2214 struct expression *expr = stmt->expression;
2215 struct symbol *ret = stmt->ret_target;
2227 static pseudo_t linearize_switch(struct entrypoint *ep, struct statement *stmt)
2231 struct basic_block *switch_end = alloc_basic_block(ep, stmt->pos);
2233 struct expression *expr = stmt->switch_expression;
2242 active = alloc_basic_block(ep, stmt->pos);
2252 FOR_EACH_PTR(stmt->switch_case->symbol_list, sym) {
2253 struct statement *case_stmt = sym->stmt;
2279 bind_label(stmt->switch_break, switch_end, stmt->pos);
2282 linearize_statement(ep, stmt->switch_statement);
2297 static pseudo_t linearize_iterator(struct entrypoint *ep, struct statement *stmt)
2299 struct statement *pre_statement = stmt->iterator_pre_statement;
2300 struct expression *pre_condition = stmt->iterator_pre_condition;
2301 struct statement *statement = stmt->iterator_statement;
2302 struct statement *post_statement = stmt->iterator_post_statement;
2303 struct expression *post_condition = stmt->iterator_post_condition;
2307 FOR_EACH_PTR(stmt->iterator_syms, sym) {
2310 concat_symbol_list(stmt->iterator_syms, &ep->syms);
2313 loop_body = loop_top = alloc_basic_block(ep, stmt->pos);
2314 loop_continue = alloc_basic_block(ep, stmt->pos);
2315 loop_end = alloc_basic_block(ep, stmt->pos);
2319 loop_top = alloc_basic_block(ep, stmt->pos);
2326 bind_label(stmt->iterator_continue, loop_continue, stmt->pos);
2327 bind_label(stmt->iterator_break, loop_end, stmt->pos);
2344 static pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stmt)
2348 if (!stmt)
2353 bb->pos = stmt->pos;
2354 current_pos = stmt->pos;
2356 switch (stmt->type) {
2361 return linearize_declaration(ep, stmt);
2364 return linearize_context(ep, stmt);
2367 return linearize_range(ep, stmt);
2370 return linearize_expression(ep, stmt->expression);
2373 return linearize_asm_statement(ep, stmt);
2376 return linearize_return(ep, stmt);
2379 add_label(ep, stmt->case_label);
2380 linearize_statement(ep, stmt->case_statement);
2385 struct symbol *label = stmt->label_identifier;
2390 return linearize_statement(ep, stmt->label_statement);
2404 if (stmt->goto_label) {
2405 add_goto(ep, get_bound_block(ep, stmt->goto_label));
2409 expr = stmt->goto_expression;
2424 FOR_EACH_PTR(stmt->target_list, sym) {
2437 if (stmt->inline_fn)
2438 return linearize_inlined_call(ep, stmt);
2439 return linearize_compound_statement(ep, stmt);
2447 struct expression *cond = stmt->if_conditional;
2449 bb_true = alloc_basic_block(ep, stmt->pos);
2450 bb_false = endif = alloc_basic_block(ep, stmt->pos);
2459 linearize_statement(ep, stmt->if_true);
2461 if (stmt->if_false) {
2462 endif = alloc_basic_block(ep, stmt->pos);
2465 linearize_statement(ep, stmt->if_false);
2472 return linearize_switch(ep, stmt);
2475 return linearize_iterator(ep, stmt);
2534 struct statement *stmt = base_type->stmt;
2544 if (!stmt || sym->bogus_linear)
2553 if (stmt->type == STMT_ASM) { // top-level asm
2554 linearize_asm_statement(ep, stmt);
2570 result = linearize_fn_statement(ep, stmt);