This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Difference between 'FOR_EACH_BB' and 'for (i=0; i<n_basic_blocks; i++){}'


Thanks. after reading expunge_block(), i am curious whether " 'for (i=0; i<n_basic_blocks; i++){}" even works: from one hand, as routines such as 'compute_defs_uses_and_gen()' uses it, it should work; from the other hand, from the code of expunge_block, BASIC_BLOCK[n_basic_blocks-1] may not be the last element in the BASIC_BLOCK array.
For example,
BASIC_BLOCK is like this, [b0, NULL, b1, NULL, b3 ]; aparently, n_basic_blocks ==3.


Shouldn't those code with 'for (i=0; i<n_basic_blocks; i++){}" be a problem? Maybe it did not cause a problem because all these code get executed before any basic_block cleanup.

Thanks,
Sean

---------------------------------------------
expunge_block (basic_block b)
{
unlink_block (b);
BASIC_BLOCK (b->index) = NULL;
n_basic_blocks--;
/* We should be able to ggc_free here, but we are not.
The dead SSA_NAMES are left pointing to dead statements that are pointing
to dead basic blocks making garbage collector to die.
We should be able to release all dead SSA_NAMES and at the same time we should
clear out BB pointer of dead statements consistently. */
}
-----------------------------------------------



From: Diego Novillo <dnovillo@redhat.com>
To: sean yang <seanatpurdue@hotmail.com>
CC: gcc@gcc.gnu.org
Subject: Re: Difference between 'FOR_EACH_BB' and 'for (i=0; i<n_basic_blocks; i++){}'
Date: Thu, 01 Jun 2006 14:51:54 -0400


sean yang wrote on 06/01/06 14:44:

> 'for (i=0; i<n_basic_blocks; i++){bb=BASIC_BLOCK(i);}' traverses accoring to the
> BB's index (because BASIC_BLOCK(i)->index ==i)
>
The first form may take you to a NULL basic block. See expunge_block.

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]