This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Post Dominator II
- To: gcc at gcc dot gnu dot org
- Subject: Post Dominator II
- From: Marcio de Oliveira Buss <ra990898 at ic dot unicamp dot br>
- Date: Tue, 4 Jul 2000 15:07:10 -0300 (EST)
Could you please tell me if the sequence below is correct?
It must compute the immediate post-dominators relationship.
sbitmap *Dominators;
sbitmap *PostDominators;
int_list_ptr *S_Preds;
int_list_ptr *S_Succs;
int *Num_Preds;
int *Num_Succs;
int *Ipdom;
Dominators = sbitmap_vector_alloc(n_basic_blocks,n_basic_blocks);
PostDominators = sbitmap_vector_alloc(n_basic_blocks,n_basic_blocks);
S_Preds = malloc( n_basic_blocks * sizeof(int_list_ptr));
S_Succs = malloc( n_basic_blocks * sizeof(int_list_ptr));
Num_Preds = malloc( n_basic_blocks * sizeof(int));
Num_Succs = malloc( n_basic_blocks * sizeof(int));
Ipdom = malloc( n_basic_blocks * sizeof(int));
compute_preds_succs(S_Preds, S_Succs, Num_Preds, Num_Succs);
compute_dominators(Dominators, PostDominators, S_Preds, S_Succs);
compute_immediate_dominators(Ipdom, PostDominators);
Meaning that, after the computation, Ipdom[bb] contains the index of
the basic block that would be the unique parent of 'bb' in the
post-dominator tree. Of course, this parent could have many children.