Lines Matching full:bb

50 #define bb_prev(bb)		list_prev_entry(bb, l)  argument
51 #define bb_next(bb) list_next_entry(bb, l) argument
91 struct bb_node *new_bb, *bb; in func_append_bb() local
93 list_for_each_entry(bb, &func->bbs, l) { in func_append_bb()
94 if (bb->head == insn) in func_append_bb()
95 return bb; in func_append_bb()
96 else if (bb->head > insn) in func_append_bb()
100 bb = bb_prev(bb); in func_append_bb()
103 p_err("OOM when allocating BB node"); in func_append_bb()
109 list_add(&new_bb->l, &bb->l); in func_append_bb()
116 struct bb_node *bb; in func_insert_dummy_bb() local
118 bb = calloc(1, sizeof(*bb)); in func_insert_dummy_bb()
119 if (!bb) { in func_insert_dummy_bb()
120 p_err("OOM when allocating BB node"); in func_insert_dummy_bb()
124 INIT_LIST_HEAD(&bb->e_prevs); in func_insert_dummy_bb()
125 INIT_LIST_HEAD(&bb->e_succs); in func_insert_dummy_bb()
126 list_add(&bb->l, after); in func_insert_dummy_bb()
128 return bb; in func_insert_dummy_bb()
168 struct bb_node *bb; in func_partition_bb_head() local
173 bb = func_append_bb(func, cur); in func_partition_bb_head()
174 if (!bb) in func_partition_bb_head()
184 bb = func_append_bb(func, cur + cur->off + 1); in func_partition_bb_head()
185 if (!bb) in func_partition_bb_head()
189 bb = func_append_bb(func, cur + 1); in func_partition_bb_head()
190 if (!bb) in func_partition_bb_head()
202 struct bb_node *bb, *last; in func_partition_bb_tail() local
206 bb = func_first_bb(func); in func_partition_bb_tail()
207 list_for_each_entry_from(bb, &last->l, l) { in func_partition_bb_tail()
208 bb->tail = bb_next(bb)->head - 1; in func_partition_bb_tail()
209 bb->idx = bb_idx++; in func_partition_bb_tail()
218 struct bb_node *bb; in func_add_special_bb() local
220 bb = func_insert_dummy_bb(&func->bbs); in func_add_special_bb()
221 if (!bb) in func_add_special_bb()
223 bb->idx = ENTRY_BLOCK_INDEX; in func_add_special_bb()
225 bb = func_insert_dummy_bb(&func_last_bb(func)->l); in func_add_special_bb()
226 if (!bb) in func_add_special_bb()
228 bb->idx = EXIT_BLOCK_INDEX; in func_add_special_bb()
246 struct bb_node *bb; in func_search_bb_with_head() local
248 list_for_each_entry(bb, &func->bbs, l) { in func_search_bb_with_head()
249 if (bb->head == insn) in func_search_bb_with_head()
250 return bb; in func_search_bb_with_head()
281 struct bb_node *bb; in func_add_bb_edges() local
283 bb = entry_bb(func); in func_add_bb_edges()
284 e = new_edge(bb, bb_next(bb), EDGE_FLAG_FALLTHROUGH); in func_add_bb_edges()
287 list_add_tail(&e->l, &bb->e_succs); in func_add_bb_edges()
289 bb = exit_bb(func); in func_add_bb_edges()
290 e = new_edge(bb_prev(bb), bb, EDGE_FLAG_FALLTHROUGH); in func_add_bb_edges()
293 list_add_tail(&e->l, &bb->e_prevs); in func_add_bb_edges()
295 bb = entry_bb(func); in func_add_bb_edges()
296 bb = bb_next(bb); in func_add_bb_edges()
297 list_for_each_entry_from(bb, &exit_bb(func)->l, l) { in func_add_bb_edges()
298 e = new_edge(bb, NULL, EDGE_FLAG_EMPTY); in func_add_bb_edges()
301 e->src = bb; in func_add_bb_edges()
303 insn = bb->tail; in func_add_bb_edges()
306 e->dst = bb_next(bb); in func_add_bb_edges()
308 list_add_tail(&e->l, &bb->e_succs); in func_add_bb_edges()
314 list_add_tail(&e->l, &bb->e_succs); in func_add_bb_edges()
318 e->dst = bb_next(bb); in func_add_bb_edges()
320 list_add_tail(&e->l, &bb->e_succs); in func_add_bb_edges()
322 e = new_edge(bb, NULL, EDGE_FLAG_JUMP); in func_add_bb_edges()
325 e->src = bb; in func_add_bb_edges()
327 list_add_tail(&e->l, &bb->e_succs); in func_add_bb_edges()
359 struct bb_node *bb, *bb2; in cfg_destroy() local
361 list_for_each_entry_safe(bb, bb2, &func->bbs, l) { in cfg_destroy()
364 list_for_each_entry_safe(e, e2, &bb->e_prevs, l) { in cfg_destroy()
369 list_for_each_entry_safe(e, e2, &bb->e_succs, l) { in cfg_destroy()
374 list_del(&bb->l); in cfg_destroy()
375 free(bb); in cfg_destroy()
384 draw_bb_node(struct func_node *func, struct bb_node *bb, struct dump_data *dd, in draw_bb_node() argument
389 if (bb->idx == ENTRY_BLOCK_INDEX || bb->idx == EXIT_BLOCK_INDEX) in draw_bb_node()
395 func->idx, bb->idx, shape); in draw_bb_node()
397 if (bb->idx == ENTRY_BLOCK_INDEX) { in draw_bb_node()
399 } else if (bb->idx == EXIT_BLOCK_INDEX) { in draw_bb_node()
404 start_idx = bb->head - func->start; in draw_bb_node()
405 dump_xlated_for_graph(dd, bb->head, bb->tail, start_idx, in draw_bb_node()
413 static void draw_bb_succ_edges(struct func_node *func, struct bb_node *bb) in draw_bb_succ_edges() argument
421 if (list_empty(&bb->e_succs)) in draw_bb_succ_edges()
424 list_for_each_entry(e, &bb->e_succs, l) { in draw_bb_succ_edges()
436 struct bb_node *bb; in func_output_bb_def() local
438 list_for_each_entry(bb, &func->bbs, l) { in func_output_bb_def()
439 draw_bb_node(func, bb, dd, opcodes, linum); in func_output_bb_def()
446 struct bb_node *bb; in func_output_edges() local
448 list_for_each_entry(bb, &func->bbs, l) { in func_output_edges()
449 draw_bb_succ_edges(func, bb); in func_output_edges()