Lines Matching refs:ssa
51 zend_ssa *ssa; member
63 static inline zend_bool is_bad_mod(const zend_ssa *ssa, int use, int def) { in is_bad_mod() argument
68 if (ssa->var_info[use].type & MAY_BE_REF) { in is_bad_mod()
76 zend_op_array *op_array, zend_ssa *ssa, in may_have_side_effects() argument
180 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def)) { in may_have_side_effects()
186 && ssa->vars[ssa_op->op2_use].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
211 return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def); in may_have_side_effects()
213 return is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
214 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE; in may_have_side_effects()
217 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
218 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
235 if (is_bad_mod(ssa, ssa_op->op1_use, ssa_op->op1_def) in may_have_side_effects()
236 || ssa->vars[ssa_op->op1_def].escape_state != ESCAPE_STATE_NO_ESCAPE) { in may_have_side_effects()
261 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in add_to_worklists()
274 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in add_to_phi_worklist_no_val()
280 …erands_to_worklists(context *ctx, zend_op *opline, zend_ssa_op *ssa_op, zend_ssa *ssa, int check) { in add_operands_to_worklists() argument
287 && (ssa->var_info[ssa_op->op1_use].type & MAY_BE_REF) != 0)) { in add_operands_to_worklists()
296 && (ssa->var_info[ssa_op->op2_use].type & MAY_BE_REF) != 0)) { in add_operands_to_worklists()
305 zend_ssa *ssa = ctx->ssa; in add_phi_sources_to_worklists() local
313 zend_ssa_var *var = &ctx->ssa->vars[var_num]; in is_var_dead()
331 zend_ssa_var *var = &ctx->ssa->vars[free_var]; in try_remove_var_def()
335 zend_ssa_op *def_op = &ctx->ssa->ops[def]; in try_remove_var_def()
385 zend_ssa *ssa = ctx->ssa; in dce_instr() local
395 && ((ssa->var_info[ssa_op->op1_use].type & (MAY_BE_REF|MAY_BE_ANY|MAY_BE_UNDEF)) == 0 in dce_instr()
396 || may_be_refcounted(ssa->var_info[ssa_op->op1_use].type)) in dce_instr()
403 if (may_be_refcounted(ssa->var_info[ssa_op->op1_use].type) in dce_instr()
412 if (may_be_refcounted(ssa->var_info[ssa_op->op2_use].type)) { in dce_instr()
424 zend_ssa_rename_defs_of_instr(ctx->ssa, ssa_op); in dce_instr()
425 zend_ssa_remove_instr(ctx->ssa, opline, ssa_op); in dce_instr()
429 opline->op1.var = EX_NUM_TO_VAR(ssa->vars[free_var].var); in dce_instr()
433 ssa_op->op1_use_chain = ssa->vars[free_var].use_chain; in dce_instr()
434 ssa->vars[free_var].use_chain = ssa_op - ssa->ops; in dce_instr()
440 static inline int get_common_phi_source(zend_ssa *ssa, zend_ssa_phi *phi) { in get_common_phi_source() argument
461 zend_ssa *ssa = ctx->ssa; in try_remove_trivial_phi() local
464 int common_source = get_common_phi_source(ssa, phi); in try_remove_trivial_phi()
466 zend_ssa_rename_var_uses(ssa, phi->ssa_var, common_source, 1); in try_remove_trivial_phi()
467 zend_ssa_remove_phi(ssa, phi); in try_remove_trivial_phi()
480 static inline zend_bool may_break_varargs(const zend_op_array *op_array, const zend_ssa *ssa, const… in may_break_varargs() argument
482 && ssa->vars[ssa_op->op1_def].var < op_array->num_args) { in may_break_varargs()
486 && ssa->vars[ssa_op->op2_def].var < op_array->num_args) { in may_break_varargs()
490 && ssa->vars[ssa_op->result_def].var < op_array->num_args) { in may_break_varargs()
500 int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reorder_dtor_effects) { in dce_optimize_op_array() argument
506 zend_bool has_varargs = (ssa->cfg.flags & ZEND_FUNC_VARARG) != 0; in dce_optimize_op_array()
509 ctx.ssa = ssa; in dce_optimize_op_array()
517 ctx.phi_worklist_len = zend_bitset_len(ssa->vars_count); in dce_optimize_op_array()
534 && may_be_refcounted(ssa->var_info[phi->ssa_var].type)) { in dce_optimize_op_array()
541 int b = ssa->cfg.blocks_count; in dce_optimize_op_array()
546 zend_basic_block *block = &ssa->cfg.blocks[b]; in dce_optimize_op_array()
561 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 0); in dce_optimize_op_array()
563 add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0); in dce_optimize_op_array()
565 …} else if (may_have_side_effects(op_array, ssa, &op_array->opcodes[i], &ssa->ops[i], ctx.reorder_d… in dce_optimize_op_array()
566 || (zend_may_throw(&op_array->opcodes[i], &ssa->ops[i], op_array, ssa) in dce_optimize_op_array()
568 || (has_varargs && may_break_varargs(op_array, ssa, &ssa->ops[i]))) { in dce_optimize_op_array()
571 && ssa->ops[i].result_def >= 0 in dce_optimize_op_array()
572 && ssa->vars[ssa->ops[i].result_def].escape_state == ESCAPE_STATE_NO_ESCAPE) { in dce_optimize_op_array()
576 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 0); in dce_optimize_op_array()
578 add_operands_to_worklists(&ctx, &op_array->opcodes[op_data], &ssa->ops[op_data], ssa, 0); in dce_optimize_op_array()
596 add_operands_to_worklists(&ctx, &op_array->opcodes[i], &ssa->ops[i], ssa, 1); in dce_optimize_op_array()
602 add_operands_to_worklists(&ctx, &op_array->opcodes[i+1], &ssa->ops[i+1], ssa, 1); in dce_optimize_op_array()
608 add_phi_sources_to_worklists(&ctx, ssa->vars[i].definition_phi, 1); in dce_optimize_op_array()
614 removed_ops += dce_instr(&ctx, &op_array->opcodes[i], &ssa->ops[i]); in dce_optimize_op_array()
622 zend_ssa_phi *phi = ssa->vars[i].definition_phi; in dce_optimize_op_array()
633 zend_ssa_remove_uses_of_var(ssa, phi->ssa_var); in dce_optimize_op_array()
634 zend_ssa_remove_phi(ssa, phi); in dce_optimize_op_array()