Skip to content
Extraits de code Groupes Projets
Valider 4c8d48ca rédigé par Thomas DILASSER's avatar Thomas DILASSER
Parcourir les fichiers

basic pdf

parent a4c9b5df
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #1153 annulé
...@@ -6,6 +6,7 @@ void bitmap_pdf(function * fun) ...@@ -6,6 +6,7 @@ void bitmap_pdf(function * fun)
printf("\n---PDF---\n"); printf("\n---PDF---\n");
printf("---------\n"); printf("---------\n");
calculate_dominance_info(CDI_POST_DOMINATORS);
bitmap_head *pfrontiers; bitmap_head *pfrontiers;
basic_block bb; basic_block bb;
pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun)); pfrontiers = XNEWVEC (bitmap_head, last_basic_block_for_fn (fun));
...@@ -15,46 +16,16 @@ void bitmap_pdf(function * fun) ...@@ -15,46 +16,16 @@ void bitmap_pdf(function * fun)
bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack); bitmap_initialize (&pfrontiers[bb->index], &bitmap_default_obstack);
} }
td5_q1_bitmap_post_dominance_frontiers (pfrontiers, fun); bitmap_post_dominance_frontiers (pfrontiers, fun);
//FOR_ALL_BB_FN (bb, cfun) FOR_ALL_BB_FN (bb, cfun)
//{
// printf( "PDF Node %d: ", bb->index ) ;
// bitmap_print( stdout, &pfrontiers[bb->index], "", "\n" ) ;
//}
}
void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun)
{
edge p;
edge_iterator ei;
basic_block b;
FOR_EACH_BB_FN (b, fun)
{
if (EDGE_COUNT (b->succs) >= 2)
{
FOR_EACH_EDGE (p, ei, b->succs)
{
basic_block runner = p->dest;
basic_block pdomsb;
if (runner == EXIT_BLOCK_PTR_FOR_FN (fun))
continue;
pdomsb = get_immediate_dominator (CDI_POST_DOMINATORS, b);
while (runner != pdomsb)
{ {
if (!bitmap_set_bit (&frontiers[runner->index], b->index)) printf( "PDF Node %d: ", bb->index ) ;
break; bitmap_print( stdout, &pfrontiers[bb->index], "", "\n" ) ;
runner = get_immediate_dominator (CDI_POST_DOMINATORS, runner);
}
} }
free_dominance_info(fun, CDI_POST_DOMINATORS);
} }
} void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun)
}
void
td5_q1_bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun)
{ {
edge p; edge p;
edge_iterator ei; edge_iterator ei;
...@@ -64,40 +35,21 @@ td5_q1_bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun) ...@@ -64,40 +35,21 @@ td5_q1_bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun)
{ {
if (EDGE_COUNT (b->succs) >= 2) if (EDGE_COUNT (b->succs) >= 2)
// if (EDGE_COUNT (b->preds) >= 2)
{ {
FOR_EACH_EDGE (p, ei, b->succs) FOR_EACH_EDGE (p, ei, b->succs)
// FOR_EACH_EDGE (p, ei, b->preds)
{ {
basic_block runner = p->dest; basic_block runner = p->dest;
// basic_block runner = p->src;
basic_block pdomsb; basic_block pdomsb;
if (runner == EXIT_BLOCK_PTR_FOR_FN (fun)) if (runner == EXIT_BLOCK_PTR_FOR_FN (fun))
// if (runner == ENTRY_BLOCK_PTR_FOR_FN (fun))
continue; continue;
pdomsb = get_immediate_dominator (CDI_POST_DOMINATORS, b); pdomsb = get_immediate_dominator (CDI_POST_DOMINATORS, b);
// pdomsb = get_immediate_dominator (CDI_DOMINATORS, b);
while (runner != pdomsb) while (runner != pdomsb)
{ {
if (!bitmap_set_bit (&frontiers[runner->index], b->index)) if (!bitmap_set_bit (&frontiers[runner->index], b->index))
break; break;
/*
if (1 == bitmap_bit_p(&frontiers[runner->index], b->index))
{
break;
}
else
{
bitmap_set_bit (&frontiers[runner->index], b->index);
cpt++;
printf("%d\n", cpt);
}
*/
runner = get_immediate_dominator (CDI_POST_DOMINATORS, runner); runner = get_immediate_dominator (CDI_POST_DOMINATORS, runner);
// runner = get_immediate_dominator (CDI_DOMINATORS, runner);
} }
} }
} }
......
...@@ -2,5 +2,4 @@ ...@@ -2,5 +2,4 @@
#define __PDFDD__H #define __PDFDD__H
void bitmap_pdf(function * fun); void bitmap_pdf(function * fun);
void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun); void bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun);
void td5_q1_bitmap_post_dominance_frontiers (bitmap_head *frontiers, function * fun);
#endif #endif
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter