This is the mail archive of the gcc-patches@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: [tree-ssa] Improve memory characteristics of VDEFs


On Fri, 2003-11-21 at 15:23, law@redhat.com wrote:

> Previously you did something like
> 
> for (i = 0; i < VARRAY_ACTIVE_SIZE (vdefs); i++)
>   {
>     vdef = VARRAY_TREE (vdefs, i);
>     result = VDEF_RESULT (vdef);
>     source = VDEF_OP (vdef);
>   }
> 
> Now the code looks like
> 
> for (i = 0; i < VARRAY_ACTIVE_SIZE (vdefs) / 2; i++)
>   {
>     result = VARRAY_RESULT (vdefs, i);
>     source = VARRAY_OP (vdefs, i);
>   }

Assuming you use VDEF_RESULT and VDEF_OP like in that patch, rather that
VARRAY_RESULT and VARRAY_OP like in your example :-)

How about adding the NUM_VDEFS() though to make the loop more natural,
and to remove the dependence on client code from knowing its a VARRAY? 


#define NUM_VDEFS(vdef)		(VARRAY_ACTIVE_SIZE (vdefs) / 2)

for (i = 0; i < NUM_VDEFS (vdefs); i++)
  {
    result = VDEF_RESULT (vdef, i);
    source = VDEF_OP (vdef, i);
  }

Andrew


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