Lines Matching refs:ssa
50 zend_ssa *ssa; member
62 static inline bool is_bad_mod(const zend_ssa *ssa, int use, int def) { in is_bad_mod() argument
67 if (ssa->var_info[use].type & MAY_BE_REF) { in is_bad_mod()
75 zend_op_array *op_array, zend_ssa *ssa, in may_have_side_effects() argument
186 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def)) { in may_have_side_effects()
192 && ssa->vars[ssa_op->op2_use].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
217 return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def); in may_have_side_effects()
219 return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
220 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE; in may_have_side_effects()
223 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
224 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
241 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
242 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
274 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in add_to_worklists()
287 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in add_to_phi_worklist_no_val()
293 …erands_to_worklists(context *ctx, zend_op *opline, zend_ssa_op *ssa_op, zend_ssa *ssa, int check) { in add_operands_to_worklists() argument
300 && (ssa->var_info[ssa_op->op1_use].type & MAY_BE_REF) != 0)) { in add_operands_to_worklists()
309 && (ssa->var_info[ssa_op->op2_use].type & MAY_BE_REF) != 0)) { in add_operands_to_worklists()
318 zend_ssa *ssa = ctx->ssa; in add_phi_sources_to_worklists() local
326 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in is_var_dead()
344 zend_ssa_var *var = &ctx->ssa->vars[free_var]; in try_remove_var_def()
348 zend_ssa_op *def_op = &ctx->ssa->ops[def]; in try_remove_var_def()
400 if ((ctx->ssa->var_info[ssa_op->op1_use].type & (MAY_BE_REF|MAY_BE_ANY|MAY_BE_UNDEF)) != 0 in is_free_of_live_var()
401 && !may_be_refcounted(ctx->ssa->var_info[ssa_op->op1_use].type)) { in is_free_of_live_var()
414 zend_ssa *ssa = ctx->ssa; in dce_instr() local
429 if (may_be_refcounted(ssa->var_info[ssa_op->op1_use].type) in dce_instr()
438 if (may_be_refcounted(ssa->var_info[ssa_op->op2_use].type)) { in dce_instr()
450 zend_ssa_rename_defs_of_instr(ctx->ssa, ssa_op); in dce_instr()
451 zend_ssa_remove_instr(ctx->ssa, opline, ssa_op); in dce_instr()
455 opline->op1.var = EX_NUM_TO_VAR(ssa->vars[free_var].var); in dce_instr()
459 ssa_op->op1_use_chain = ssa->vars[free_var].use_chain; in dce_instr()
460 ssa->vars[free_var].use_chain = ssa_op - ssa->ops; in dce_instr()
466 static inline int get_common_phi_source(zend_ssa *ssa, zend_ssa_phi *phi) { in get_common_phi_source() argument
487 zend_ssa *ssa = ctx->ssa; in try_remove_trivial_phi() local
490 int common_source = get_common_phi_source(ssa, phi); in try_remove_trivial_phi()
492 zend_ssa_rename_var_uses(ssa, phi->ssa_var, common_source, 1); in try_remove_trivial_phi()
493 zend_ssa_remove_phi(ssa, phi); in try_remove_trivial_phi()
506 static inline bool may_break_varargs(const zend_op_array *op_array, const zend_ssa *ssa, const zend… in may_break_varargs() argument
508 && ssa->vars[ssa_op->op1_def].var < op_array->num_args) { in may_break_varargs()
512 && ssa->vars[ssa_op->op2_def].var < op_array->num_args) { in may_break_varargs()
516 && ssa->vars[ssa_op->result_def].var < op_array->num_args) { in may_break_varargs()
526 int dce_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *optimizer_ctx, zend_ssa *ssa… in dce_optimize_op_array() argument
532 bool has_varargs = (ssa->cfg.flags & ZEND_FUNC_VARARG) != 0; in dce_optimize_op_array()
535 ctx.ssa = ssa; in dce_optimize_op_array()
543 ctx.phi_worklist_len = zend_bitset_len(ssa->vars_count); in dce_optimize_op_array()
557 && may_be_refcounted(ssa->var_info[phi->ssa_var].type)) { in dce_optimize_op_array()
564 int b = ssa->cfg.blocks_count; in dce_optimize_op_array()
569 zend_basic_block *block = &ssa->cfg.blocks[b]; in dce_optimize_op_array()
584 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 0); in dce_optimize_op_array()
586 add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0); in dce_optimize_op_array()
588 …} else if (may_have_side_effects(op_array, ssa, &op_array->opcodes[i], &ssa->ops[i], ctx.reorder_d… in dce_optimize_op_array()
589 || (zend_may_throw(&op_array->opcodes[i], &ssa->ops[i], op_array, ssa) in dce_optimize_op_array()
591 || (has_varargs && may_break_varargs(op_array, ssa, &ssa->ops[i]))) { in dce_optimize_op_array()
594 && ssa->ops[i].result_def >= 0 in dce_optimize_op_array()
595 && ssa->vars[ssa->ops[i].result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { in dce_optimize_op_array()
599 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 0); in dce_optimize_op_array()
601 add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0); in dce_optimize_op_array()
619 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 1); in dce_optimize_op_array()
625 add_operands_to_worklists(&ctx, &op_array->opcodes[i+1], &ssa->ops[i+1], ssa, 1); in dce_optimize_op_array()
631 add_phi_sources_to_worklists(&ctx, ssa->vars[i].definition_phi, 1); in dce_optimize_op_array()
637 removed_ops += dce_instr(&ctx, &op_array->opcodes[i], &ssa->ops[i]); in dce_optimize_op_array()
645 zend_ssa_phi *phi = ssa->vars[i].definition_phi; in dce_optimize_op_array()
656 zend_ssa_remove_uses_of_var(ssa, phi->ssa_var); in dce_optimize_op_array()
657 zend_ssa_remove_phi(ssa, phi); in dce_optimize_op_array()