Lines Matching refs:phi

96 	zend_ssa_phi *phi;  in add_pi()  local
101 phi = zend_arena_calloc(arena, 1, in add_pi()
105 phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi))); in add_pi()
106 memset(phi->sources, 0xff, sizeof(int) * ssa->cfg.blocks[to].predecessors_count); in add_pi()
107phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa-… in add_pi()
109 phi->pi = from; in add_pi()
110 phi->var = var; in add_pi()
111 phi->ssa_var = -1; in add_pi()
112 phi->next = ssa->blocks[to].phis; in add_pi()
113 ssa->blocks[to].phis = phi; in add_pi()
127 return phi; in add_pi()
132 zend_ssa_phi *phi, int min_var, int max_var, zend_long min, zend_long max, in pi_range() argument
135 zend_ssa_range_constraint *constraint = &phi->constraint.range; in pi_range()
145 phi->has_range_constraint = true; in pi_range()
149 static inline void pi_range_equals(zend_ssa_phi *phi, int var, zend_long val) { in pi_range_equals() argument
150 pi_range(phi, var, var, val, val, 0, 0, 0); in pi_range_equals()
152 static inline void pi_range_not_equals(zend_ssa_phi *phi, int var, zend_long val) { in pi_range_not_equals() argument
153 pi_range(phi, var, var, val, val, 0, 0, 1); in pi_range_not_equals()
155 static inline void pi_range_min(zend_ssa_phi *phi, int var, zend_long val) { in pi_range_min() argument
156 pi_range(phi, var, -1, val, ZEND_LONG_MAX, 0, 1, 0); in pi_range_min()
158 static inline void pi_range_max(zend_ssa_phi *phi, int var, zend_long val) { in pi_range_max() argument
159 pi_range(phi, -1, var, ZEND_LONG_MIN, val, 1, 0, 0); in pi_range_max()
162 static void pi_type_mask(zend_ssa_phi *phi, uint32_t type_mask) { in pi_type_mask() argument
163 phi->has_range_constraint = false; in pi_type_mask()
164 phi->constraint.type.ce = NULL; in pi_type_mask()
165 phi->constraint.type.type_mask = MAY_BE_REF|MAY_BE_RC1|MAY_BE_RCN; in pi_type_mask()
166 phi->constraint.type.type_mask |= type_mask; in pi_type_mask()
168 phi->constraint.type.type_mask |= MAY_BE_UNDEF; in pi_type_mask()
171 static inline void pi_not_type_mask(zend_ssa_phi *phi, uint32_t type_mask) { in pi_not_type_mask() argument
173 pi_type_mask(phi, ~type_mask & relevant); in pi_not_type_mask()
838 zend_ssa_phi *phi = ssa_blocks[n].phis; in zend_ssa_rename() local
840 if (phi->ssa_var < 0) { in zend_ssa_rename()
841 phi->ssa_var = ssa_vars_count; in zend_ssa_rename()
842 var[phi->var] = ssa_vars_count; in zend_ssa_rename()
845 var[phi->var] = phi->ssa_var; in zend_ssa_rename()
847 phi = phi->next; in zend_ssa_rename()
848 } while (phi); in zend_ssa_rename()
942 zend_bitset def, in, phi; in zend_build_ssa() local
977 phi = dfg.use; in zend_build_ssa()
978 zend_bitset_clear(phi, set_size * blocks_count); in zend_build_ssa()
988 zend_bitset def_j = def + j * set_size, phi_j = phi + j * set_size; in zend_build_ssa()
1027 if (!zend_bitset_empty(phi + j * set_size, set_size)) { in zend_build_ssa()
1028 ZEND_BITSET_REVERSE_FOREACH(phi + j * set_size, set_size, i) { in zend_build_ssa()
1029 zend_ssa_phi *phi = zend_arena_calloc(arena, 1, in zend_build_ssa() local
1034 phi->sources = (int*)(((char*)phi) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_ssa_phi))); in zend_build_ssa()
1035 memset(phi->sources, 0xff, sizeof(int) * blocks[j].predecessors_count); in zend_build_ssa()
1036phi->use_chains = (zend_ssa_phi**)(((char*)phi->sources) + ZEND_MM_ALIGNED_SIZE(sizeof(int) * ssa-… in zend_build_ssa()
1038 phi->pi = -1; in zend_build_ssa()
1039 phi->var = i; in zend_build_ssa()
1040 phi->ssa_var = -1; in zend_build_ssa()
1051 phi->next = *pp; in zend_build_ssa()
1052 *pp = phi; in zend_build_ssa()
1137 zend_ssa_phi *phi = ssa->blocks[i].phis; in zend_ssa_compute_use_def_chains() local
1138 while (phi) { in zend_ssa_compute_use_def_chains()
1139 phi->block = i; in zend_ssa_compute_use_def_chains()
1140 ssa_vars[phi->ssa_var].var = phi->var; in zend_ssa_compute_use_def_chains()
1141 ssa_vars[phi->ssa_var].definition_phi = phi; in zend_ssa_compute_use_def_chains()
1142 if (phi->pi >= 0) { in zend_ssa_compute_use_def_chains()
1145 ZEND_ASSERT(phi->sources[0] >= 0); in zend_ssa_compute_use_def_chains()
1146 p = ssa_vars[phi->sources[0]].phi_use_chain; in zend_ssa_compute_use_def_chains()
1147 while (p && p != phi) { in zend_ssa_compute_use_def_chains()
1148 p = zend_ssa_next_use_phi(ssa, phi->sources[0], p); in zend_ssa_compute_use_def_chains()
1151 phi->use_chains[0] = ssa_vars[phi->sources[0]].phi_use_chain; in zend_ssa_compute_use_def_chains()
1152 ssa_vars[phi->sources[0]].phi_use_chain = phi; in zend_ssa_compute_use_def_chains()
1154 if (phi->has_range_constraint) { in zend_ssa_compute_use_def_chains()
1156 zend_ssa_range_constraint *constraint = &phi->constraint.range; in zend_ssa_compute_use_def_chains()
1158 phi->sym_use_chain = ssa_vars[constraint->min_ssa_var].sym_use_chain; in zend_ssa_compute_use_def_chains()
1159 ssa_vars[constraint->min_ssa_var].sym_use_chain = phi; in zend_ssa_compute_use_def_chains()
1161 phi->sym_use_chain = ssa_vars[constraint->max_ssa_var].sym_use_chain; in zend_ssa_compute_use_def_chains()
1162 ssa_vars[constraint->max_ssa_var].sym_use_chain = phi; in zend_ssa_compute_use_def_chains()
1171 ZEND_ASSERT(phi->sources[j] >= 0); in zend_ssa_compute_use_def_chains()
1172 p = ssa_vars[phi->sources[j]].phi_use_chain; in zend_ssa_compute_use_def_chains()
1173 while (p && p != phi) { in zend_ssa_compute_use_def_chains()
1174 p = zend_ssa_next_use_phi(ssa, phi->sources[j], p); in zend_ssa_compute_use_def_chains()
1177 phi->use_chains[j] = ssa_vars[phi->sources[j]].phi_use_chain; in zend_ssa_compute_use_def_chains()
1178 ssa_vars[phi->sources[j]].phi_use_chain = phi; in zend_ssa_compute_use_def_chains()
1182 phi = phi->next; in zend_ssa_compute_use_def_chains()
1331 static inline void zend_ssa_remove_use_of_phi_source(zend_ssa *ssa, zend_ssa_phi *phi, int source, … in zend_ssa_remove_use_of_phi_source() argument
1334 while (*cur && *cur != phi) { in zend_ssa_remove_use_of_phi_source()
1343 static void zend_ssa_remove_uses_of_phi_sources(zend_ssa *ssa, zend_ssa_phi *phi) /* {{{ */ in zend_ssa_remove_uses_of_phi_sources() argument
1346 FOREACH_PHI_SOURCE(phi, source) { in zend_ssa_remove_uses_of_phi_sources()
1347 zend_ssa_remove_use_of_phi_source(ssa, phi, source, zend_ssa_next_use_phi(ssa, source, phi)); in zend_ssa_remove_uses_of_phi_sources()
1352 static void zend_ssa_remove_phi_from_block(zend_ssa *ssa, zend_ssa_phi *phi) /* {{{ */ in zend_ssa_remove_phi_from_block() argument
1354 zend_ssa_block *block = &ssa->blocks[phi->block]; in zend_ssa_remove_phi_from_block()
1356 while (*cur != phi) { in zend_ssa_remove_phi_from_block()
1381 static inline void zend_ssa_remove_phi_source(zend_ssa *ssa, zend_ssa_phi *phi, int pred_offset, in… in zend_ssa_remove_phi_source() argument
1383 int j, var_num = phi->sources[pred_offset]; in zend_ssa_remove_phi_source()
1384 zend_ssa_phi *next_phi = phi->use_chains[pred_offset]; in zend_ssa_remove_phi_source()
1388 …memmove(phi->sources + pred_offset, phi->sources + pred_offset + 1, (predecessors_count - pred_off… in zend_ssa_remove_phi_source()
1389 …memmove(phi->use_chains + pred_offset, phi->use_chains + pred_offset + 1, (predecessors_count - pr… in zend_ssa_remove_phi_source()
1395 if (phi->sources[j] == var_num) { in zend_ssa_remove_phi_source()
1399 phi->use_chains[j] = next_phi; in zend_ssa_remove_phi_source()
1406 zend_ssa_remove_use_of_phi_source(ssa, phi, var_num, next_phi); in zend_ssa_remove_phi_source()
1410 void zend_ssa_remove_phi(zend_ssa *ssa, zend_ssa_phi *phi) /* {{{ */ in zend_ssa_remove_phi() argument
1412 ZEND_ASSERT(phi->ssa_var >= 0); in zend_ssa_remove_phi()
1413 ZEND_ASSERT(ssa->vars[phi->ssa_var].use_chain < 0 in zend_ssa_remove_phi()
1414 && ssa->vars[phi->ssa_var].phi_use_chain == NULL); in zend_ssa_remove_phi()
1415 zend_ssa_remove_uses_of_phi_sources(ssa, phi); in zend_ssa_remove_phi()
1416 zend_ssa_remove_phi_from_block(ssa, phi); in zend_ssa_remove_phi()
1417 ssa->vars[phi->ssa_var].definition_phi = NULL; in zend_ssa_remove_phi()
1418 phi->ssa_var = -1; in zend_ssa_remove_phi()
1425 zend_ssa_phi *phi; in zend_ssa_remove_uses_of_var() local
1427 FOREACH_PHI_USE(var, phi) { in zend_ssa_remove_uses_of_var()
1428 int i, end = NUM_PHI_SOURCES(phi); in zend_ssa_remove_uses_of_var()
1430 if (phi->sources[i] == var_num) { in zend_ssa_remove_uses_of_var()
1431 phi->use_chains[i] = NULL; in zend_ssa_remove_uses_of_var()
1459 zend_ssa_phi *phi; in zend_ssa_remove_predecessor() local
1480 for (phi = next_ssa_block->phis; phi; phi = phi->next) { in zend_ssa_remove_predecessor()
1481 if (phi->pi >= 0) { in zend_ssa_remove_predecessor()
1482 if (phi->pi == from) { in zend_ssa_remove_predecessor()
1483 zend_ssa_rename_var_uses(ssa, phi->ssa_var, phi->sources[0], /* update_types */ 0); in zend_ssa_remove_predecessor()
1484 zend_ssa_remove_phi(ssa, phi); in zend_ssa_remove_predecessor()
1487 ZEND_ASSERT(phi->sources[pred_offset] >= 0); in zend_ssa_remove_predecessor()
1488 zend_ssa_remove_phi_source(ssa, phi, pred_offset, next_block->predecessors_count); in zend_ssa_remove_predecessor()
1505 zend_ssa_phi *phi; in zend_ssa_remove_block() local
1511 for (phi = ssa_block->phis; phi; phi = phi->next) { in zend_ssa_remove_block()
1512 zend_ssa_remove_uses_of_var(ssa, phi->ssa_var); in zend_ssa_remove_block()
1513 zend_ssa_remove_phi(ssa, phi); in zend_ssa_remove_block()
1585 zend_ssa_phi *phi; in propagate_phi_type_widening() local
1586 FOREACH_PHI_USE(&ssa->vars[var], phi) { in propagate_phi_type_widening()
1587 if (ssa->var_info[var].type & ~ssa->var_info[phi->ssa_var].type) { in propagate_phi_type_widening()
1588 ssa->var_info[phi->ssa_var].type |= ssa->var_info[var].type; in propagate_phi_type_widening()
1589 propagate_phi_type_widening(ssa, phi->ssa_var); in propagate_phi_type_widening()
1600 zend_ssa_phi *phi; in zend_ssa_rename_var_uses() local
1664 FOREACH_PHI_USE(old_var, phi) { in zend_ssa_rename_var_uses()
1671 for (j = 0; j < ssa->cfg.blocks[phi->block].predecessors_count; j++) { in zend_ssa_rename_var_uses()
1672 if (phi->sources[j] == new) { in zend_ssa_rename_var_uses()
1673 existing_use_chain_ptr = &phi->use_chains[j]; in zend_ssa_rename_var_uses()
1678 for (j = 0; j < ssa->cfg.blocks[phi->block].predecessors_count; j++) { in zend_ssa_rename_var_uses()
1679 if (phi->sources[j] == new) { in zend_ssa_rename_var_uses()
1681 } else if (phi->sources[j] == old) { in zend_ssa_rename_var_uses()
1682 phi->sources[j] = new; in zend_ssa_rename_var_uses()
1688 phi->use_chains[j] = *existing_use_chain_ptr; in zend_ssa_rename_var_uses()
1691 phi->use_chains[j] = new_var->phi_use_chain; in zend_ssa_rename_var_uses()
1692 new_var->phi_use_chain = phi; in zend_ssa_rename_var_uses()
1696 phi->use_chains[j] = NULL; in zend_ssa_rename_var_uses()
1705 if (update_types && (ssa->var_info[new].type & ~ssa->var_info[phi->ssa_var].type)) { in zend_ssa_rename_var_uses()
1706 ssa->var_info[phi->ssa_var].type |= ssa->var_info[new].type; in zend_ssa_rename_var_uses()
1707 propagate_phi_type_widening(ssa, phi->ssa_var); in zend_ssa_rename_var_uses()