-
-
Save bryant/386ede314223f21279162c9be301e5f6 to your computer and use it in GitHub Desktop.
GCC's linear-time DF calculation, pasted by Dan Berlin.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void | |
compute_dominance_frontiers_1 (bitmap_head *frontiers) | |
{ | |
edge p; | |
edge_iterator ei; | |
basic_block b; | |
FOR_EACH_BB_FN (b, cfun) | |
{ | |
if (EDGE_COUNT (b->preds) >= 2) | |
{ | |
FOR_EACH_EDGE (p, ei, b->preds) | |
{ | |
basic_block runner = p->src; | |
basic_block domsb; | |
if (runner == ENTRY_BLOCK_PTR_FOR_FN (cfun)) | |
continue; | |
domsb = get_immediate_dominator (CDI_DOMINATORS, b); | |
while (runner != domsb) | |
{ | |
if (!bitmap_set_bit (&frontiers[runner->index], | |
b->index)) | |
break; | |
runner = get_immediate_dominator (CDI_DOMINATORS, | |
runner); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment