Lines Matching refs:op
30 if (a > 0 && _values[a].op == IR_COPY) { in ir_sccp_identity()
32 IR_ASSERT(a < 0 || _values[a].op != IR_COPY); /* this may be a copy of symbolic constant */ in ir_sccp_identity()
49 op1_insn = (op1 > 0 && IR_IS_CONST_OP(_values[op1].op)) ? _values + op1 : ctx->ir_base + op1; in ir_sccp_fold()
50 op2_insn = (op2 > 0 && IR_IS_CONST_OP(_values[op2].op)) ? _values + op2 : ctx->ir_base + op2; in ir_sccp_fold()
51 op3_insn = (op3 > 0 && IR_IS_CONST_OP(_values[op3].op)) ? _values + op3 : ctx->ir_base + op3; in ir_sccp_fold()
68 insn = (op1 > 0 && IR_IS_CONST_OP(_values[op1].op)) ? _values + op1 : ctx->ir_base + op1; in ir_sccp_fold()
69 if (IR_IS_CONST_OP(insn->op)) { in ir_sccp_fold()
76 } else if (_values[res].op == IR_COPY && _values[res].op1 == op1) { in ir_sccp_fold()
143 if (v->op == IR_TOP) { in ir_sccp_meet_phi()
151 } else if (v->op == IR_COPY) { in ir_sccp_meet_phi()
153 IR_ASSERT(input < 0 || _values[input].op != IR_COPY); in ir_sccp_meet_phi()
156 } else if (v->op == IR_BOTTOM) { in ir_sccp_meet_phi()
160 } else if (v->op == IR_BOTTOM) { in ir_sccp_meet_phi()
191 if (v->op == IR_TOP) { in ir_sccp_meet_phi()
199 } else if (v->op == IR_COPY) { in ir_sccp_meet_phi()
201 IR_ASSERT(input < 0 || _values[input].op != IR_COPY); in ir_sccp_meet_phi()
208 } else if (v->op == IR_BOTTOM) { in ir_sccp_meet_phi()
216 } else if (v->op == IR_BOTTOM) { in ir_sccp_meet_phi()
230 if (_values[i].op == IR_COPY && _values[i].op1 == new_copy) { in ir_sccp_meet_phi()
258 } else if (insn->op == IR_ALLOCA || insn->op == IR_BLOCK_BEGIN) { in ir_is_dead_load_ex()
267 uint32_t flags = ir_op_flags[ctx->ir_base[ref].op]; in ir_is_dead_load()
271 } else if (ctx->ir_base[ref].op == IR_ALLOCA) { in ir_is_dead_load()
281 return IR_IS_FOLDABLE_OP(ctx->ir_base[ref].op); in ir_is_dead()
319 IR_ASSERT(!IR_IS_SYM_CONST(v1->op)); in ir_sccp_is_equal()
320 IR_ASSERT(!IR_IS_SYM_CONST(v2->op)); in ir_sccp_is_equal()
351 if (input > 0 && _values[input].op > IR_COPY) { in ir_sccp_remove_insn()
378 } else if (ctx->ir_base[input].op == IR_PHI && ctx->use_lists[input].count == 1) { in ir_sccp_remove_insn2()
401 if (input > 0 && _values[input].op > IR_COPY) { in ir_sccp_replace_insn()
433 if (worklist && _values[use].op > IR_COPY) { in ir_sccp_replace_insn()
462 } else if (ctx->ir_base[input].op == IR_PHI && ctx->use_lists[input].count == 1) { in ir_sccp_replace_insn2()
603 next_insn->op = IR_BEGIN; in ir_sccp_remove_if()
615 IR_ASSERT(insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN); in ir_sccp_remove_unfeasible_merge_inputs()
624 IR_ASSERT(input_insn->op == IR_END || input_insn->op == IR_LOOP_END|| in ir_sccp_remove_unfeasible_merge_inputs()
625 input_insn->op == IR_IJMP || input_insn->op == IR_UNREACHABLE); in ir_sccp_remove_unfeasible_merge_inputs()
626 if (input_insn->op == IR_END || input_insn->op == IR_LOOP_END) { in ir_sccp_remove_unfeasible_merge_inputs()
640 IR_ASSERT((use_insn->op != IR_PHI) && "PHI must be already removed"); in ir_sccp_remove_unfeasible_merge_inputs()
641 if (ir_op_flags[use_insn->op] & IR_OP_FLAG_CONTROL) { in ir_sccp_remove_unfeasible_merge_inputs()
645 } else if (use_insn->op != IR_NOP) { in ir_sccp_remove_unfeasible_merge_inputs()
647 IR_ASSERT(use_insn->op == IR_VAR); in ir_sccp_remove_unfeasible_merge_inputs()
649 while (!IR_IS_BB_START(ctx->ir_base[region].op)) { in ir_sccp_remove_unfeasible_merge_inputs()
669 insn->op = IR_BEGIN; in ir_sccp_remove_unfeasible_merge_inputs()
671 input_insn->op = IR_END; in ir_sccp_remove_unfeasible_merge_inputs()
678 insn->op = IR_BEGIN; in ir_sccp_remove_unfeasible_merge_inputs()
712 if (use_insn->op == IR_PHI) { in ir_sccp_remove_unfeasible_merge_inputs()
745 return !IR_IS_SYM_CONST(insn->op) && insn->val.d == (double)(float)insn->val.d; in ir_may_promote_d2f()
747 switch (insn->op) { in ir_may_promote_d2f()
778 return !IR_IS_SYM_CONST(insn->op) && insn->val.f == (float)(double)insn->val.f; in ir_may_promote_f2d()
780 switch (insn->op) { in ir_may_promote_f2d()
814 switch (insn->op) { in ir_promote_d2f()
878 switch (insn->op) { in ir_promote_f2d()
946 return !IR_IS_SYM_CONST(insn->op); in ir_may_promote_i2i()
948 switch (insn->op) { in ir_may_promote_i2i()
984 switch (insn->op) { in ir_promote_i2i()
1040 static ir_ref ir_ext_const(ir_ctx *ctx, ir_insn *val_insn, ir_op op, ir_type type) in ir_ext_const() argument
1050 if (op == IR_SEXT) { in ir_ext_const()
1058 if (op == IR_SEXT) { in ir_ext_const()
1066 if (op == IR_SEXT) { in ir_ext_const()
1076 static ir_ref ir_ext_ref(ir_ctx *ctx, ir_ref var_ref, ir_ref src_ref, ir_op op, ir_type type, ir_bi… in ir_ext_ref() argument
1078 uint32_t optx = IR_OPTX(op, type, 1); in ir_ext_ref()
1109 ir_op op = insn->op; in ir_try_promote_ext() local
1117 if (phi_insn->op != IR_PHI in ir_try_promote_ext()
1119 || ctx->ir_base[phi_insn->op1].op != IR_LOOP_BEGIN) { in ir_try_promote_ext()
1125 if ((op_insn->op != IR_ADD && op_insn->op != IR_SUB && op_insn->op != IR_MUL) in ir_try_promote_ext()
1141 if ((use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) in ir_try_promote_ext()
1144 } else if (use_insn->op == IR_IF) { in ir_try_promote_ext()
1163 if (use_insn->op == IR_IF) { in ir_try_promote_ext()
1166 IR_ASSERT(((use_insn->op >= IR_EQ && use_insn->op <= IR_UGT) in ir_try_promote_ext()
1167 || use_insn->op == IR_ADD || use_insn->op == IR_SUB || use_insn->op == IR_MUL) in ir_try_promote_ext()
1171 && !IR_IS_SYM_CONST(ctx->ir_base[use_insn->op1].op)) { in ir_try_promote_ext()
1172 ctx->ir_base[use].op1 = ir_ext_const(ctx, &ctx->ir_base[use_insn->op1], op, type); in ir_try_promote_ext()
1174 ctx->ir_base[use].op1 = ir_ext_ref(ctx, use, use_insn->op1, op, type, worklist); in ir_try_promote_ext()
1179 && !IR_IS_SYM_CONST(ctx->ir_base[use_insn->op2].op)) { in ir_try_promote_ext()
1180 ctx->ir_base[use].op2 = ir_ext_const(ctx, &ctx->ir_base[use_insn->op2], op, type); in ir_try_promote_ext()
1182 ctx->ir_base[use].op2 = ir_ext_ref(ctx, use, use_insn->op2, op, type, worklist); in ir_try_promote_ext()
1192 && !IR_IS_SYM_CONST(ctx->ir_base[phi_insn->op2].op)) { in ir_try_promote_ext()
1193 ctx->ir_base[ref].op2 = ir_ext_const(ctx, &ctx->ir_base[phi_insn->op2], op, type); in ir_try_promote_ext()
1195 ctx->ir_base[ref].op2 = ir_ext_ref(ctx, ref, phi_insn->op2, op, type, worklist); in ir_try_promote_ext()
1207 if (ctx->ir_base[*p].op == IR_IF_TRUE) { in ir_get_true_false_refs()
1208 IR_ASSERT(ctx->ir_base[*(p + 1)].op == IR_IF_FALSE); in ir_get_true_false_refs()
1212 IR_ASSERT(ctx->ir_base[*p].op == IR_IF_FALSE); in ir_get_true_false_refs()
1213 IR_ASSERT(ctx->ir_base[*(p + 1)].op == IR_IF_TRUE); in ir_get_true_false_refs()
1224 IR_ASSERT(ctx->ir_base[begin].op == IR_BEGIN); in ir_merge_blocks()
1225 IR_ASSERT(ctx->ir_base[end].op == IR_END); in ir_merge_blocks()
1243 if (ctx->ir_base[prev].op == IR_BEGIN || ctx->ir_base[prev].op == IR_MERGE) { in ir_merge_blocks()
1257 IR_ASSERT(use_insn->op == IR_VAR); in ir_remove_unused_vars()
1271 if (end1->op != IR_END || end2->op != IR_END) { in ir_try_remove_empty_diamond()
1286 if (root->op != IR_IF in ir_try_remove_empty_diamond()
1287 && !(root->op == IR_SWITCH && ctx->use_lists[root_ref].count == 2)) { in ir_try_remove_empty_diamond()
1336 if (ctx->ir_base[next->op1].op == IR_BEGIN || ctx->ir_base[next->op1].op == IR_MERGE) { in ir_try_remove_empty_diamond()
1351 if (end->op != IR_END) { in ir_try_remove_empty_diamond()
1356 if (start->op != IR_CASE_VAL && start->op != IR_CASE_DEFAULT) { in ir_try_remove_empty_diamond()
1401 if (ctx->ir_base[next->op1].op == IR_BEGIN || ctx->ir_base[next->op1].op == IR_MERGE) { in ir_try_remove_empty_diamond()
1412 && !IR_IS_SYM_CONST(ctx->ir_base[ref].op) in ir_is_zero()
1425 if (end1->op == IR_END && end2->op == IR_END) { in ir_optimize_phi()
1434 if (root->op == IR_IF && ctx->use_lists[root->op2].count == 1) { in ir_optimize_phi()
1441 is_cmp = (cond->op == IR_LT || cond->op == IR_LE || cond->op == IR_GT || cond->op == IR_GE || in ir_optimize_phi()
1442 cond->op == IR_ULT || cond->op == IR_ULE || cond->op == IR_UGT || cond->op == IR_UGE); in ir_optimize_phi()
1443 is_less = (cond->op == IR_LT || cond->op == IR_LE || in ir_optimize_phi()
1444 cond->op == IR_ULT || cond->op == IR_ULE); in ir_optimize_phi()
1446 is_cmp = (cond->op == IR_LT || cond->op == IR_LE || cond->op == IR_GT || cond->op == IR_GE); in ir_optimize_phi()
1447 is_less = (cond->op == IR_LT || cond->op == IR_LE); in ir_optimize_phi()
1450 … is_cmp = (cond->op == IR_ULT || cond->op == IR_ULE || cond->op == IR_UGT || cond->op == IR_UGE); in ir_optimize_phi()
1451 is_less = (cond->op == IR_ULT || cond->op == IR_ULE); in ir_optimize_phi()
1491 insn->op = ( in ir_optimize_phi()
1494 ((start1->op == IR_IF_TRUE) ? insn->op2 : insn->op3) in ir_optimize_phi()
1522 if (ctx->ir_base[next->op1].op == IR_BEGIN || ctx->ir_base[next->op1].op == IR_MERGE) { in ir_optimize_phi()
1528 && ((ctx->ir_base[insn->op2].op == IR_NEG in ir_optimize_phi()
1533 && is_less == (start1->op == IR_IF_TRUE)) in ir_optimize_phi()
1536 && is_less != (start1->op == IR_IF_TRUE)))) in ir_optimize_phi()
1537 || (ctx->ir_base[insn->op3].op == IR_NEG in ir_optimize_phi()
1542 && is_less != (start1->op == IR_IF_TRUE)) in ir_optimize_phi()
1545 && is_less == (start1->op == IR_IF_TRUE)))))) { in ir_optimize_phi()
1581 insn->op = IR_ABS; in ir_optimize_phi()
1583 if (ctx->ir_base[insn->op2].op == IR_NEG) { in ir_optimize_phi()
1609 if (ctx->ir_base[next->op1].op == IR_BEGIN || ctx->ir_base[next->op1].op == IR_MERGE) { in ir_optimize_phi()
1650 insn->op = IR_COND; in ir_optimize_phi()
1653 if (start1->op == IR_IF_FALSE) { in ir_optimize_phi()
1669 if (ctx->ir_base[next->op1].op == IR_BEGIN || ctx->ir_base[next->op1].op == IR_MERGE) { in ir_optimize_phi()
1683 static bool ir_cmp_is_true(ir_op op, ir_insn *op1, ir_insn *op2) in ir_cmp_is_true() argument
1687 if (op == IR_EQ) { in ir_cmp_is_true()
1689 } else if (op == IR_NE) { in ir_cmp_is_true()
1691 } else if (op == IR_LT) { in ir_cmp_is_true()
1697 } else if (op == IR_GE) { in ir_cmp_is_true()
1703 } else if (op == IR_LE) { in ir_cmp_is_true()
1709 } else if (op == IR_GT) { in ir_cmp_is_true()
1715 } else if (op == IR_ULT) { in ir_cmp_is_true()
1717 } else if (op == IR_UGE) { in ir_cmp_is_true()
1719 } else if (op == IR_ULE) { in ir_cmp_is_true()
1721 } else if (op == IR_UGT) { in ir_cmp_is_true()
1728 if (op == IR_EQ) { in ir_cmp_is_true()
1730 } else if (op == IR_NE) { in ir_cmp_is_true()
1732 } else if (op == IR_LT) { in ir_cmp_is_true()
1734 } else if (op == IR_GE) { in ir_cmp_is_true()
1736 } else if (op == IR_LE) { in ir_cmp_is_true()
1738 } else if (op == IR_GT) { in ir_cmp_is_true()
1740 } else if (op == IR_ULT) { in ir_cmp_is_true()
1742 } else if (op == IR_UGE) { in ir_cmp_is_true()
1744 } else if (op == IR_ULE) { in ir_cmp_is_true()
1746 } else if (op == IR_UGT) { in ir_cmp_is_true()
1754 if (op == IR_EQ) { in ir_cmp_is_true()
1756 } else if (op == IR_NE) { in ir_cmp_is_true()
1758 } else if (op == IR_LT) { in ir_cmp_is_true()
1760 } else if (op == IR_GE) { in ir_cmp_is_true()
1762 } else if (op == IR_LE) { in ir_cmp_is_true()
1764 } else if (op == IR_GT) { in ir_cmp_is_true()
1766 } else if (op == IR_ULT) { in ir_cmp_is_true()
1768 } else if (op == IR_UGE) { in ir_cmp_is_true()
1770 } else if (op == IR_ULE) { in ir_cmp_is_true()
1772 } else if (op == IR_UGT) { in ir_cmp_is_true()
1786 if (cond->op == IR_PHI in ir_try_split_if()
1789 && ((IR_IS_CONST_REF(cond->op2) && !IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op)) in ir_try_split_if()
1790 || (IR_IS_CONST_REF(cond->op3) && !IR_IS_SYM_CONST(ctx->ir_base[cond->op3].op)))) { in ir_try_split_if()
1799 if (end1->op == IR_END && end2->op == IR_END) { in ir_try_split_if()
1802 ir_op op = IR_IF_FALSE; in ir_try_split_if() local
1806 if (!IR_IS_CONST_REF(cond->op2) || IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op)) { in ir_try_split_if()
1815 op = IR_IF_TRUE; in ir_try_split_if()
1820 if (IR_IS_CONST_REF(cond->op3) && !IR_IS_SYM_CONST(ctx->ir_base[cond->op3].op)) { in ir_try_split_if()
1821 if (ir_const_is_true(&ctx->ir_base[cond->op3]) ^ (op == IR_IF_TRUE)) { in ir_try_split_if()
1927 merge->optx = IR_OPTX(op, IR_VOID, 1); in ir_try_split_if()
1945 if (ctx->ir_base[end2->op1].op == IR_BEGIN || ctx->ir_base[end2->op1].op == IR_MERGE) { in ir_try_split_if()
1962 if (cond->op >= IR_EQ && cond->op <= IR_UGT in ir_try_split_if_cmp()
1964 && !IR_IS_SYM_CONST(ctx->ir_base[cond->op2].op) in ir_try_split_if_cmp()
1969 if (phi->op == IR_PHI in ir_try_split_if_cmp()
1973 && ((IR_IS_CONST_REF(phi->op2) && !IR_IS_SYM_CONST(ctx->ir_base[phi->op2].op)) in ir_try_split_if_cmp()
1974 || (IR_IS_CONST_REF(phi->op3) && !IR_IS_SYM_CONST(ctx->ir_base[phi->op3].op)))) { in ir_try_split_if_cmp()
1983 if (end1->op == IR_END && end2->op == IR_END) { in ir_try_split_if_cmp()
1986 ir_op op = IR_IF_FALSE; in ir_try_split_if_cmp() local
1990 if (!IR_IS_CONST_REF(phi->op2) || IR_IS_SYM_CONST(ctx->ir_base[phi->op2].op)) { in ir_try_split_if_cmp()
1997 if (ir_cmp_is_true(cond->op, &ctx->ir_base[phi->op2], &ctx->ir_base[cond->op2])) { in ir_try_split_if_cmp()
1999 op = IR_IF_TRUE; in ir_try_split_if_cmp()
2004 if (IR_IS_CONST_REF(phi->op3) && !IR_IS_SYM_CONST(ctx->ir_base[phi->op3].op)) { in ir_try_split_if_cmp()
2005 …if (ir_cmp_is_true(cond->op, &ctx->ir_base[phi->op3], &ctx->ir_base[cond->op2]) ^ (op == IR_IF_TRU… in ir_try_split_if_cmp()
2122 merge->optx = IR_OPTX(op, IR_VOID, 1); in ir_try_split_if_cmp()
2141 if (ctx->ir_base[end2->op1].op == IR_BEGIN || ctx->ir_base[end2->op1].op == IR_MERGE) { in ir_try_split_if_cmp()
2169 if (next->op == IR_PHI) { in ir_optimize_merge()
2174 if (phi->op == IR_PHI && next->op != IR_PHI) { in ir_optimize_merge()
2175 if (next->op == IR_IF && next->op1 == merge_ref && ctx->use_lists[phi_ref].count == 1) { in ir_optimize_merge()
2183 if (cmp->op >= IR_EQ && cmp->op <= IR_UGT in ir_optimize_merge()
2186 && !IR_IS_SYM_CONST(ctx->ir_base[cmp->op2].op) in ir_optimize_merge()
2218 flags = ir_op_flags[insn->op]; in ir_sccp()
2223 } else if (insn->op == IR_PHI) { in ir_sccp()
2227 } else if (EXPECTED(IR_IS_FOLDABLE_OP(insn->op))) { in ir_sccp()
2258 if (insn->op == IR_FP2FP || insn->op == IR_FP2INT || insn->op == IR_TRUNC in ir_sccp()
2259 || insn->op == IR_ZEXT || insn->op == IR_SEXT || insn->op == IR_EQ || insn->op == IR_NE) { in ir_sccp()
2267 if (insn->op == IR_FP2FP || insn->op == IR_FP2INT || insn->op == IR_TRUNC in ir_sccp()
2268 || insn->op == IR_ZEXT || insn->op == IR_SEXT || insn->op == IR_EQ || insn->op == IR_NE) { in ir_sccp()
2276 if (insn->op == IR_MERGE || insn->op == IR_BEGIN) { in ir_sccp()
2279 if (insn->op == IR_MERGE || insn->op == IR_LOOP_BEGIN) { in ir_sccp()
2304 IR_ASSERT(insn->op == IR_START || IR_IS_FEASIBLE(insn->op1)); in ir_sccp()
2313 if (insn->op == IR_IF) { in ir_sccp()
2324 && (IR_IS_CONST_REF(insn->op2) || _values[insn->op2].op != IR_COPY) in ir_sccp()
2333 IR_ASSERT(use_insn->op == IR_IF_TRUE || use_insn->op == IR_IF_FALSE); in ir_sccp()
2334 if ((use_insn->op == IR_IF_TRUE) != b) { in ir_sccp()
2336 IR_ASSERT(ctx->ir_base[use].op == IR_IF_TRUE || ctx->ir_base[use].op == IR_IF_FALSE); in ir_sccp()
2350 } else if (insn->op == IR_SWITCH) { in ir_sccp()
2361 && (IR_IS_CONST_REF(insn->op2) || _values[insn->op2].op != IR_COPY) in ir_sccp()
2372 if (use_insn->op == IR_CASE_VAL) { in ir_sccp()
2377 } else if (use_insn->op == IR_CASE_DEFAULT) { in ir_sccp()
2447 if (IR_IS_CONST_OP(_values[i].op) || IR_IS_SYM_CONST(_values[i].op)) { in ir_sccp()
2452 } else if (_values[i].op == IR_COPY) { in ir_sccp()
2457 } else if (_values[i].op == IR_IF) { in ir_sccp()
2459 } else if (_values[i].op == IR_MERGE) { in ir_sccp()
2462 fprintf(stderr, "%d. %d\n", i, _values[i].op); in ir_sccp()
2469 if (value->op == IR_BOTTOM) { in ir_sccp()
2471 } else if (IR_IS_CONST_OP(value->op)) { in ir_sccp()
2475 } else if (IR_IS_SYM_CONST(value->op)) { in ir_sccp()
2480 } else if (value->op == IR_COPY) { in ir_sccp()
2483 } else if (value->op == IR_TOP) { in ir_sccp()
2486 if (ir_op_flags[insn->op] & (IR_OP_FLAG_DATA|IR_OP_FLAG_MEM)) { in ir_sccp()
2487 if (insn->op != IR_PARAM && (insn->op != IR_VAR || _values[insn->op1].op == IR_TOP)) { in ir_sccp()
2491 if (ir_op_flags[insn->op] & IR_OP_FLAG_TERMINATOR) { in ir_sccp()
2508 } else if (value->op == IR_IF) { in ir_sccp()
2511 } else if (value->op == IR_MERGE) { in ir_sccp()
2514 } else if (value->op == IR_LOAD) { in ir_sccp()
2521 IR_ASSERT(_values[i].op == IR_MERGE); in ir_sccp()
2529 if (IR_IS_FOLDABLE_OP(insn->op)) { in ir_sccp()
2531 if (insn->op == IR_PHI) { in ir_sccp()
2537 switch (insn->op) { in ir_sccp()
2588 } else if (ir_op_flags[insn->op] & IR_OP_FLAG_BB_START) { in ir_sccp()
2591 } else if (insn->op == IR_BEGIN) { in ir_sccp()
2592 if (ctx->ir_base[insn->op1].op == IR_END in ir_sccp()
2596 } else if (insn->op == IR_MERGE) { in ir_sccp()