Lines Matching refs:block
145 static int get_const_switch_target(zend_cfg *cfg, zend_op_array *op_array, zend_basic_block *block,… in get_const_switch_target() argument
151 return block->successors[block->successors_count - 1]; in get_const_switch_target()
161 return block->successors[block->successors_count - 2]; in get_const_switch_target()
166 static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array, zend_bitset used_… in zend_optimize_block() argument
171 if (block->len == 0) { in zend_optimize_block()
175 if (op_array->opcodes[block->start].opcode == ZEND_NOP) { in zend_optimize_block()
177 strip_leading_nops(op_array, block); in zend_optimize_block()
180 opline = op_array->opcodes + block->start; in zend_optimize_block()
181 end = opline + block->len; in zend_optimize_block()
210 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
211 block->successors_count = 1; in zend_optimize_block()
212 block->successors[0] = block->successors[1]; in zend_optimize_block()
216 DEL_SOURCE(block, block->successors[1]); in zend_optimize_block()
217 block->successors_count = 1; in zend_optimize_block()
224 DEL_SOURCE(block, block->successors[1]); in zend_optimize_block()
225 block->successors_count = 1; in zend_optimize_block()
228 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
229 block->successors_count = 1; in zend_optimize_block()
230 block->successors[0] = block->successors[1]; in zend_optimize_block()
237 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
238 block->successors[0] = block->successors[1]; in zend_optimize_block()
242 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
244 block->successors_count = 1; in zend_optimize_block()
379 if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && in zend_optimize_block()
436 int target = get_const_switch_target(cfg, op_array, block, opline, &ZEND_OP1_LITERAL(opline)); in zend_optimize_block()
442 block->successors_count = 1; in zend_optimize_block()
443 block->successors[0] = target; in zend_optimize_block()
652 tmp = block->successors[0]; in zend_optimize_block()
653 block->successors[0] = block->successors[1]; in zend_optimize_block()
654 block->successors[1] = tmp; in zend_optimize_block()
1100 static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, zend_cfg *cfg, … in zend_jmp_optimization() argument
1106 if (block->len == 0) { in zend_jmp_optimization()
1110 last_op = op_array->opcodes + block->start + block->len - 1; in zend_jmp_optimization()
1114 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1116 int next = (block - blocks) + 1; in zend_jmp_optimization()
1124 if (block->successors[0] == next) { in zend_jmp_optimization()
1127 block->len--; in zend_jmp_optimization()
1132 block->successors[0] != target_block->successors[0] && in zend_jmp_optimization()
1136 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1137 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1138 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1149 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1150 block->successors_count = 2; in zend_jmp_optimization()
1151 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1152 block->successors[1] = target_block->successors[1]; in zend_jmp_optimization()
1153 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1154 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1167 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1168 block->successors_count = 0; in zend_jmp_optimization()
1172 } else if (0&& block->op1_to != block && in zend_jmp_optimization()
1173 block->op1_to != blocks && in zend_jmp_optimization()
1181 zend_block_source *cs = block->op1_to->sources; in zend_jmp_optimization()
1185 if (cs->from->follow_to == block->op1_to) { in zend_jmp_optimization()
1192 next = block->op1_to; in zend_jmp_optimization()
1195 if (next->follow_to == block) { in zend_jmp_optimization()
1204 while (prev->next != block->op1_to) { in zend_jmp_optimization()
1208 next->next = block->next; in zend_jmp_optimization()
1209 block->next = block->op1_to; in zend_jmp_optimization()
1211 block->follow_to = block->op1_to; in zend_jmp_optimization()
1212 block->op1_to = NULL; in zend_jmp_optimization()
1214 block->len--; in zend_jmp_optimization()
1215 if(block->len == 0) { in zend_jmp_optimization()
1217 delete_code_block(block, ctx); in zend_jmp_optimization()
1241 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1242 block->successors_count = 1; in zend_jmp_optimization()
1246 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1247 block->successors_count = 1; in zend_jmp_optimization()
1248 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1254 if (block->successors[0] == block->successors[1]) { in zend_jmp_optimization()
1266 block->successors_count = 1; in zend_jmp_optimization()
1276 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1297 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1298 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1299 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1309 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1310 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1311 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1319 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1320 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1321 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1326 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1327 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1328 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1336 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1338 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1340 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1342 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1353 target_block = blocks + block->successors[1]; in zend_jmp_optimization()
1362 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1363 block->successors[1] = target_block->successors[0]; in zend_jmp_optimization()
1364 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1373 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1375 block->successors[1] = target_block->successors[0]; in zend_jmp_optimization()
1376 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1378 block->successors[1] = block->successors[0]; in zend_jmp_optimization()
1379 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1380 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1403 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1404 block->successors_count = 1; in zend_jmp_optimization()
1405 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1422 target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1439 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1440 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1441 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1448 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1449 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1450 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1458 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1459 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1460 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1468 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1469 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1470 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1475 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1476 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1477 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1484 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1486 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1488 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1490 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1497 int next = (block - blocks) + 1; in zend_jmp_optimization()
1511 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1512 block->successors_count = 1; in zend_jmp_optimization()
1519 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1520 block->successors_count = 1; in zend_jmp_optimization()
1521 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1524 } else if (block->successors[0] == block->successors[1]) { in zend_jmp_optimization()
1531 block->successors_count = 1; in zend_jmp_optimization()
1534 } else if (block->successors[0] == next) { in zend_jmp_optimization()
1538 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1539 block->successors[1] = next; in zend_jmp_optimization()
1542 } else if (block->successors[1] == next) { in zend_jmp_optimization()
1555 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1574 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1575 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1576 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1584 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1585 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1586 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1591 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1592 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1593 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1609 zend_basic_block *block, *next_block; in zend_t_usage() local
1629 block = cfg->blocks + n; in zend_t_usage()
1631 if (!(block->flags & ZEND_BB_REACHABLE)) { in zend_t_usage()
1635 opline = op_array->opcodes + block->start; in zend_t_usage()
1636 end = opline + block->len; in zend_t_usage()
1637 if (!(block->flags & ZEND_BB_FOLLOW) || in zend_t_usage()
1638 (block->flags & ZEND_BB_TARGET)) { in zend_t_usage()
1710 block = cfg->blocks + (--n); in zend_t_usage()
1712 if (!(block->flags & ZEND_BB_REACHABLE) || block->len == 0) { in zend_t_usage()
1716 end = op_array->opcodes + block->start; in zend_t_usage()
1717 opline = end + block->len - 1; in zend_t_usage()
1723 } else if (block->successors_count > 1) { in zend_t_usage()
1726 next_block = block; in zend_t_usage()