Lines Matching defs:func

48 #define func_prev(func)		list_prev_entry(func, l)
49 #define func_next(func) list_next_entry(func, l)
52 #define entry_bb(func) func_first_bb(func)
53 #define exit_bb(func) func_last_bb(func)
58 #define func_first_bb(func) \
59 list_first_entry(&func->bbs, struct bb_node, l)
60 #define func_last_bb(func) \
61 list_last_entry(&func->bbs, struct bb_node, l)
65 struct func_node *new_func, *func;
67 list_for_each_entry(func, &cfg->funcs, l) {
68 if (func->start == insn)
69 return func;
70 else if (func->start > insn)
74 func = func_prev(func);
82 list_add(&new_func->l, &func->l);
88 static struct bb_node *func_append_bb(struct func_node *func,
93 list_for_each_entry(bb, &func->bbs, l) {
134 struct func_node *func, *last_func;
136 func = cfg_append_func(cfg, cur);
137 if (!func)
145 func = cfg_append_func(cfg, cur + cur->off + 1);
146 if (!func)
152 func = cfg_first_func(cfg);
153 list_for_each_entry_from(func, &last_func->l, l) {
154 func->end = func_next(func)->start - 1;
165 static bool func_partition_bb_head(struct func_node *func)
170 cur = func->start;
171 end = func->end;
172 INIT_LIST_HEAD(&func->bbs);
173 bb = func_append_bb(func, cur);
184 bb = func_append_bb(func, cur + cur->off + 1);
189 bb = func_append_bb(func, cur + 1);
199 static void func_partition_bb_tail(struct func_node *func)
204 last = func_last_bb(func);
205 last->tail = func->end;
206 bb = func_first_bb(func);
213 func->bb_num = bb_idx;
216 static bool func_add_special_bb(struct func_node *func)
220 bb = func_insert_dummy_bb(&func->bbs);
225 bb = func_insert_dummy_bb(&func_last_bb(func)->l);
233 static bool func_partition_bb(struct func_node *func)
235 if (func_partition_bb_head(func))
238 func_partition_bb_tail(func);
243 static struct bb_node *func_search_bb_with_head(struct func_node *func,
248 list_for_each_entry(bb, &func->bbs, l) {
277 static bool func_add_bb_edges(struct func_node *func)
283 bb = entry_bb(func);
289 bb = exit_bb(func);
295 bb = entry_bb(func);
297 list_for_each_entry_from(bb, &exit_bb(func)->l, l) {
311 e->dst = func_search_bb_with_head(func,
326 e->dst = func_search_bb_with_head(func, insn + insn->off + 1);
336 struct func_node *func;
343 list_for_each_entry(func, &cfg->funcs, l) {
344 if (func_partition_bb(func) || func_add_special_bb(func))
347 if (func_add_bb_edges(func))
356 struct func_node *func, *func2;
358 list_for_each_entry_safe(func, func2, &cfg->funcs, l) {
361 list_for_each_entry_safe(bb, bb2, &func->bbs, l) {
378 list_del(&func->l);
379 free(func);
384 draw_bb_node(struct func_node *func, struct bb_node *bb, struct dump_data *dd,
395 func->idx, bb->idx, shape);
404 start_idx = bb->head - func->start;
413 static void draw_bb_succ_edges(struct func_node *func, struct bb_node *bb)
417 int func_idx = func->idx;
433 func_output_bb_def(struct func_node *func, struct dump_data *dd,
438 list_for_each_entry(bb, &func->bbs, l) {
439 draw_bb_node(func, bb, dd, opcodes, linum);
443 static void func_output_edges(struct func_node *func)
445 int func_idx = func->idx;
448 list_for_each_entry(bb, &func->bbs, l) {
449 draw_bb_succ_edges(func, bb);
462 struct func_node *func;
465 list_for_each_entry(func, &cfg->funcs, l) {
467 func->idx, func->idx);
468 func_output_bb_def(func, dd, opcodes, linum);
469 func_output_edges(func);