49#define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__)
51#define DEBUG_PRINT(...)
55 uint32_t edge = scdf_edge(&scdf->
ssa->
cfg, from, to);
62 DEBUG_PRINT(
"Marking edge %d->%d feasible\n", from, to);
75 for (phi = ssa_block->
phis; phi; phi = phi->
next) {
120 int block_num = ssa->
cfg.
map[i];
130 if (i == block->start + block->len - 1) {
131 if (block->successors_count == 1) {
133 }
else if (block->successors_count > 1) {
150 for (phi = ssa_block->
phis; phi; phi = phi->
next) {
156 if (block->len == 0) {
161 int j,
end = block->start + block->len;
162 for (
j = block->start;
j <
end;
j++) {
169 if (block->successors_count == 1) {
171 }
else if (block->successors_count > 1) {
172 ZEND_ASSERT(opline &&
"Should have opline in non-empty block");
187static bool is_live_loop_var_free(
189 if (!zend_optimizer_is_loop_var_free(opline)) {
215 for (uint32_t i = block->start; i < block->
start + block->len; i++) {
216 if (is_live_loop_var_free(scdf, &op_array->
opcodes[i], &scdf->
ssa->
ops[i])) {
227 int block_num = block - cfg->
blocks;
228 uint32_t removed_ops = 0;
236 for (uint32_t i = block->start; i < block->
start + block->len; i++) {
240 || is_live_loop_var_free(scdf, opline, ssa_op)) {
262 uint32_t removed_ops = 0;
266 if (!kept_alive_by_loop_var_free(scdf, block)) {
267 removed_ops += block->len;
270 removed_ops += cleanup_loop_var_free_block(scdf, block);
unsigned const char * end
void scdf_init(zend_optimizer_ctx *ctx, scdf_ctx *scdf, zend_op_array *op_array, zend_ssa *ssa)
void scdf_solve(scdf_ctx *scdf, const char *name)
uint32_t scdf_remove_unreachable_blocks(scdf_ctx *scdf)
void scdf_mark_edge_feasible(scdf_ctx *scdf, int from, int to)
struct _scdf_ctx scdf_ctx
zend_bitset executable_blocks
zend_bitset instr_worklist
void(* visit_phi)(struct _scdf_ctx *scdf, zend_ssa_phi *phi)
void(* mark_feasible_successors)(struct _scdf_ctx *scdf, int block_num, zend_basic_block *block, zend_op *opline, zend_ssa_op *ssa_op)
uint32_t instr_worklist_len
uint32_t phi_var_worklist_len
void(* visit_instr)(struct _scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_op)
zend_bitset feasible_edges
uint32_t block_worklist_len
zend_bitset block_worklist
struct _scdf_ctx::@015351274142365124137142230002251013147010033176 handlers
zend_bitset phi_var_worklist
zend_basic_block * blocks
zend_ssa_phi * definition_phi
struct _zend_basic_block zend_basic_block
#define ZEND_BB_REACHABLE
struct _zend_cfg zend_cfg
struct _zend_op_array zend_op_array
#define ZEND_FUNC_FREE_LOOP_VAR
struct _zend_optimizer_ctx zend_optimizer_ctx
void zend_ssa_remove_uses_of_var(zend_ssa *ssa, int var_num)
void zend_ssa_remove_instr(zend_ssa *ssa, zend_op *opline, zend_ssa_op *ssa_op)
void zend_ssa_remove_phi(zend_ssa *ssa, zend_ssa_phi *phi)
void zend_ssa_remove_block_from_cfg(zend_ssa *ssa, int i)
void zend_ssa_remove_block(zend_op_array *op_array, zend_ssa *ssa, int i)
void zend_ssa_remove_defs_of_instr(zend_ssa *ssa, zend_ssa_op *ssa_op)
struct _zend_ssa_block zend_ssa_block
struct _zend_ssa zend_ssa
struct _zend_ssa_var zend_ssa_var
struct _zend_ssa_phi zend_ssa_phi
struct _zend_ssa_op zend_ssa_op