This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Improve memory characteristics of VDEFs
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: 21 Nov 2003 15:40:48 -0500
- Subject: Re: [tree-ssa] Improve memory characteristics of VDEFs
- References: <200311212023.hALKNZgU001123@speedy.slc.redhat.com>
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