Lines Matching refs:cfg
27 static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_block *b) /* {{{ */ in zend_mark_reachable() argument
29 zend_basic_block *blocks = cfg->blocks; in zend_mark_reachable()
33 ZEND_WORKLIST_ALLOCA(&work, cfg->blocks_count, list_use_heap); in zend_mark_reachable()
35 zend_worklist_push(&work, b - cfg->blocks); in zend_mark_reachable()
39 b = cfg->blocks + zend_worklist_pop(&work); in zend_mark_reachable()
66 if ((cfg->flags & ZEND_CFG_STACKLESS)) { in zend_mark_reachable()
77 if ((cfg->flags & ZEND_CFG_RECV_ENTRY)) { in zend_mark_reachable()
98 zend_worklist_push(&work, succ - cfg->blocks); in zend_mark_reachable()
107 static void zend_mark_reachable_blocks(const zend_op_array *op_array, zend_cfg *cfg, int start) /* … in zend_mark_reachable_blocks() argument
109 zend_basic_block *blocks = cfg->blocks; in zend_mark_reachable_blocks()
112 zend_mark_reachable(op_array->opcodes, cfg, blocks + start); in zend_mark_reachable_blocks()
117 uint32_t *block_map = cfg->map; in zend_mark_reachable_blocks()
148 …zend_mark_reachable(op_array->opcodes, cfg, blocks + block_map[op_array->try_catch_array[j].try_op… in zend_mark_reachable_blocks()
165 zend_mark_reachable(op_array->opcodes, cfg, b); in zend_mark_reachable_blocks()
173 zend_mark_reachable(op_array->opcodes, cfg, b); in zend_mark_reachable_blocks()
181 zend_mark_reachable(op_array->opcodes, cfg, b); in zend_mark_reachable_blocks()
199 if (cfg->flags & ZEND_FUNC_FREE_LOOP_VAR) { in zend_mark_reachable_blocks()
202 uint32_t *block_map = cfg->map; in zend_mark_reachable_blocks()
205 for (b = blocks; b < blocks + cfg->blocks_count; b++) { in zend_mark_reachable_blocks()
228 void zend_cfg_remark_reachable_blocks(const zend_op_array *op_array, zend_cfg *cfg) /* {{{ */ in zend_cfg_remark_reachable_blocks() argument
230 zend_basic_block *blocks = cfg->blocks; in zend_cfg_remark_reachable_blocks()
234 for (i = 0; i < cfg->blocks_count; i++) { in zend_cfg_remark_reachable_blocks()
243 for (i = 0; i < cfg->blocks_count; i++) { in zend_cfg_remark_reachable_blocks()
247 zend_mark_reachable_blocks(op_array, cfg, start); in zend_cfg_remark_reachable_blocks()
269 …g(zend_arena **arena, const zend_op_array *op_array, uint32_t build_flags, zend_cfg *cfg) /* {{{ */ in zend_build_cfg() argument
281 cfg->flags = build_flags & (ZEND_CFG_STACKLESS|ZEND_CFG_RECV_ENTRY); in zend_build_cfg()
283 cfg->map = block_map = zend_arena_calloc(arena, op_array->last, sizeof(uint32_t)); in zend_build_cfg()
463 cfg->blocks_count = blocks_count; in zend_build_cfg()
466 cfg->blocks = blocks = zend_arena_calloc(arena, sizeof(zend_basic_block), blocks_count); in zend_build_cfg()
586 cfg->flags |= flags; in zend_build_cfg()
587 zend_mark_reachable_blocks(op_array, cfg, 0); in zend_build_cfg()
591 ZEND_API void zend_cfg_build_predecessors(zend_arena **arena, zend_cfg *cfg) /* {{{ */ in zend_cfg_build_predecessors() argument
595 zend_basic_block *blocks = cfg->blocks; in zend_cfg_build_predecessors()
596 zend_basic_block *end = blocks + cfg->blocks_count; in zend_cfg_build_predecessors()
615 cfg->edges_count = edges; in zend_cfg_build_predecessors()
616 cfg->predecessors = predecessors = (int*)zend_arena_calloc(arena, sizeof(int), edges); in zend_cfg_build_predecessors()
627 for (j = 0; j < cfg->blocks_count; j++) { in zend_cfg_build_predecessors()
654 int *postnum, int *cur, const zend_cfg *cfg, int block_num) /* {{{ */ in compute_postnum_recursive() argument
657 zend_basic_block *block = &cfg->blocks[block_num]; in compute_postnum_recursive()
664 compute_postnum_recursive(postnum, cur, cfg, block->successors[s]); in compute_postnum_recursive()
672 ZEND_API void zend_cfg_compute_dominators_tree(const zend_op_array *op_array, zend_cfg *cfg) /* {{{… in zend_cfg_compute_dominators_tree() argument
674 zend_basic_block *blocks = cfg->blocks; in zend_cfg_compute_dominators_tree()
675 int blocks_count = cfg->blocks_count; in zend_cfg_compute_dominators_tree()
678 if (cfg->blocks_count == 1) { in zend_cfg_compute_dominators_tree()
684 int *postnum = do_alloca(sizeof(int) * cfg->blocks_count, use_heap); in zend_cfg_compute_dominators_tree()
685 memset(postnum, -1, sizeof(int) * cfg->blocks_count); in zend_cfg_compute_dominators_tree()
687 compute_postnum_recursive(postnum, &j, cfg, 0); in zend_cfg_compute_dominators_tree()
701 int pred = cfg->predecessors[blocks[j].predecessor_offset + k]; in zend_cfg_compute_dominators_tree()
774 ZEND_API void zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cfg) /* {{{ */ in zend_cfg_identify_loops() argument
778 zend_basic_block *blocks = cfg->blocks; in zend_cfg_identify_loops()
786 if (cfg->blocks_count == 1) { in zend_cfg_identify_loops()
787 cfg->flags |= flag; in zend_cfg_identify_loops()
791 ZEND_WORKLIST_ALLOCA(&work, cfg->blocks_count, list_use_heap); in zend_cfg_identify_loops()
795 entry_times = do_alloca(3 * sizeof(int) * cfg->blocks_count, tree_use_heap); in zend_cfg_identify_loops()
796 exit_times = entry_times + cfg->blocks_count; in zend_cfg_identify_loops()
797 sorted_blocks = exit_times + cfg->blocks_count; in zend_cfg_identify_loops()
798 memset(entry_times, -1, 2 * sizeof(int) * cfg->blocks_count); in zend_cfg_identify_loops()
852 int pred = cfg->predecessors[blocks[i].predecessor_offset + j]; in zend_cfg_identify_loops()
866 zend_bitset_clear(work.visited, zend_bitset_len(cfg->blocks_count)); in zend_cfg_identify_loops()
891 zend_worklist_push(&work, cfg->predecessors[blocks[j].predecessor_offset + k]); in zend_cfg_identify_loops()
900 cfg->flags |= flag; in zend_cfg_identify_loops()