This patch add a small silly function which dump the iterated dominance frontier of each individual node in the CFG. It's just there to show how to use the IDF API. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- dominate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dominate.c b/dominate.c index d7808119b..8085171d0 100644 --- a/dominate.c +++ b/dominate.c @@ -15,6 +15,7 @@ #include "flow.h" #include <assert.h> #include <stdlib.h> +#include <stdio.h> struct piggy { @@ -124,3 +125,29 @@ void idf_compute(struct entrypoint *ep, struct basic_block_list **idf, struct ba bank_free(bank, levels); } + +void idf_dump(struct entrypoint *ep) +{ + struct basic_block *bb; + + domtree_build(ep); + + printf("%s's IDF:\n", show_ident(ep->name->ident)); + FOR_EACH_PTR(ep->bbs, bb) { + struct basic_block_list *alpha = NULL; + struct basic_block_list *idf = NULL; + struct basic_block *df; + + add_bb(&alpha, bb); + idf_compute(ep, &idf, alpha); + + printf("\t%s\t<-", show_label(bb)); + FOR_EACH_PTR(idf, df) { + printf(" %s", show_label(df)); + } END_FOR_EACH_PTR(df); + printf("\n"); + + free_ptr_list(&idf); + free_ptr_list(&alpha); + } END_FOR_EACH_PTR(bb); +} -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html