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
172 strip_leading_nops(op_array, block); in zend_optimize_block()
174 opline = op_array->opcodes + block->start; in zend_optimize_block()
175 end = opline + block->len; in zend_optimize_block()
206 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
207 block->successors_count = 1; in zend_optimize_block()
208 block->successors[0] = block->successors[1]; in zend_optimize_block()
212 DEL_SOURCE(block, block->successors[1]); in zend_optimize_block()
213 block->successors_count = 1; in zend_optimize_block()
220 DEL_SOURCE(block, block->successors[1]); in zend_optimize_block()
221 block->successors_count = 1; in zend_optimize_block()
224 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
225 block->successors_count = 1; in zend_optimize_block()
226 block->successors[0] = block->successors[1]; in zend_optimize_block()
233 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
234 block->successors[0] = block->successors[1]; in zend_optimize_block()
238 DEL_SOURCE(block, block->successors[0]); in zend_optimize_block()
240 block->successors_count = 1; in zend_optimize_block()
377 if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && in zend_optimize_block()
434 int target = get_const_switch_target(cfg, op_array, block, opline, &ZEND_OP1_LITERAL(opline)); in zend_optimize_block()
440 block->successors_count = 1; in zend_optimize_block()
441 block->successors[0] = target; in zend_optimize_block()
649 tmp = block->successors[0]; in zend_optimize_block()
650 block->successors[0] = block->successors[1]; in zend_optimize_block()
651 block->successors[1] = tmp; in zend_optimize_block()
1128 static void zend_jmp_optimization(zend_basic_block *block, zend_op_array *op_array, zend_cfg *cfg, … in zend_jmp_optimization() argument
1134 if (block->len == 0) { in zend_jmp_optimization()
1138 last_op = op_array->opcodes + block->start + block->len - 1; in zend_jmp_optimization()
1142 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1144 int next = (block - blocks) + 1; in zend_jmp_optimization()
1152 if (block->successors[0] == next) { in zend_jmp_optimization()
1155 block->len--; in zend_jmp_optimization()
1160 block->successors[0] != target_block->successors[0] && in zend_jmp_optimization()
1164 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1165 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1166 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1177 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1178 block->successors_count = 2; in zend_jmp_optimization()
1179 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1180 block->successors[1] = target_block->successors[1]; in zend_jmp_optimization()
1181 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1182 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1195 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1196 block->successors_count = 0; in zend_jmp_optimization()
1200 } else if (0&& block->op1_to != block && in zend_jmp_optimization()
1201 block->op1_to != blocks && in zend_jmp_optimization()
1209 zend_block_source *cs = block->op1_to->sources; in zend_jmp_optimization()
1213 if (cs->from->follow_to == block->op1_to) { in zend_jmp_optimization()
1220 next = block->op1_to; in zend_jmp_optimization()
1223 if (next->follow_to == block) { in zend_jmp_optimization()
1232 while (prev->next != block->op1_to) { in zend_jmp_optimization()
1236 next->next = block->next; in zend_jmp_optimization()
1237 block->next = block->op1_to; in zend_jmp_optimization()
1239 block->follow_to = block->op1_to; in zend_jmp_optimization()
1240 block->op1_to = NULL; in zend_jmp_optimization()
1242 block->len--; in zend_jmp_optimization()
1243 if(block->len == 0) { in zend_jmp_optimization()
1245 delete_code_block(block, ctx); in zend_jmp_optimization()
1269 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1270 block->successors_count = 1; in zend_jmp_optimization()
1274 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1275 block->successors_count = 1; in zend_jmp_optimization()
1276 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1282 if (block->successors[0] == block->successors[1]) { in zend_jmp_optimization()
1294 block->successors_count = 1; in zend_jmp_optimization()
1304 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1325 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1326 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1327 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1337 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1338 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1339 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1347 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1348 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1349 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1354 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1355 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1356 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1364 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1366 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1368 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1370 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1381 target_block = blocks + block->successors[1]; in zend_jmp_optimization()
1390 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1391 block->successors[1] = target_block->successors[0]; in zend_jmp_optimization()
1392 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1401 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1403 block->successors[1] = target_block->successors[0]; in zend_jmp_optimization()
1404 ADD_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1406 block->successors[1] = block->successors[0]; in zend_jmp_optimization()
1407 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1408 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1431 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1432 block->successors_count = 1; in zend_jmp_optimization()
1433 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1450 target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1467 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1468 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1469 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1476 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1477 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1478 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1486 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1487 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1488 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1496 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1497 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1498 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1503 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1504 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1505 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1512 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1514 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1516 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1518 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1525 int next = (block - blocks) + 1; in zend_jmp_optimization()
1539 DEL_SOURCE(block, block->successors[1]); in zend_jmp_optimization()
1540 block->successors_count = 1; in zend_jmp_optimization()
1547 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1548 block->successors_count = 1; in zend_jmp_optimization()
1549 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1552 } else if (block->successors[0] == block->successors[1]) { in zend_jmp_optimization()
1559 block->successors_count = 1; in zend_jmp_optimization()
1562 } else if (block->successors[0] == next) { in zend_jmp_optimization()
1566 block->successors[0] = block->successors[1]; in zend_jmp_optimization()
1567 block->successors[1] = next; in zend_jmp_optimization()
1570 } else if (block->successors[1] == next) { in zend_jmp_optimization()
1583 zend_basic_block *target_block = blocks + block->successors[0]; in zend_jmp_optimization()
1602 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1603 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1604 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1612 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1613 block->successors[0] = target_block->successors[1]; in zend_jmp_optimization()
1614 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1619 DEL_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1620 block->successors[0] = target_block->successors[0]; in zend_jmp_optimization()
1621 ADD_SOURCE(block, block->successors[0]); in zend_jmp_optimization()
1637 zend_basic_block *block, *next_block; in zend_t_usage() local
1657 block = cfg->blocks + n; in zend_t_usage()
1659 if (!(block->flags & ZEND_BB_REACHABLE)) { in zend_t_usage()
1663 opline = op_array->opcodes + block->start; in zend_t_usage()
1664 end = opline + block->len; in zend_t_usage()
1665 if (!(block->flags & ZEND_BB_FOLLOW) || in zend_t_usage()
1666 (block->flags & ZEND_BB_TARGET)) { in zend_t_usage()
1737 block = cfg->blocks + (--n); in zend_t_usage()
1739 if (!(block->flags & ZEND_BB_REACHABLE) || block->len == 0) { in zend_t_usage()
1743 end = op_array->opcodes + block->start; in zend_t_usage()
1744 opline = end + block->len - 1; in zend_t_usage()
1750 } else if (block->successors_count > 1) { in zend_t_usage()
1753 next_block = block; in zend_t_usage()