[trans-mem] memory optimization pass

Richard Henderson rth@redhat.com
Fri Sep 25 22:19:00 GMT 2009


On 09/25/2009 02:45 PM, Aldy Hernandez wrote:
> The language specs for the transactional memory support provide for
> hints to the runtime regarding TM memory loads and stores.

For the record, that's the runtime ABI specs not the language specs.

Patch is ok.


> +  /* Put every block in the region on the worklist.  */
> +  for (i = 0; VEC_iterate (basic_block, blocks, i, bb); i++)
> +    {
> +      *qin++ = bb;
> +      AVAIL_IN_WORKLIST_P (bb) = true;
> +    }
...
> +      /* The entry block has nothing coming in.  */
> +      if (bb == region->entry_block)
> +	{
> +	  /* Do not clear AVAIL_IN_WORKLIST_P, so we never add the
> +	     entry block to the worklist again.  */
> +	  bitmap_clear (STORE_AVAIL_IN (bb));
> +	  bitmap_clear (READ_AVAIL_IN (bb));
> +	}

It occurred to me that we could avoid putting the entry block
into the worklist in the first place:

   AVAIL_IN_WORKLIST_P (region->entry_block) = 1;
   for (i = 1; ...)

> +  struct tm_memopt_bitmaps *b = XCNEWVEC (struct tm_memopt_bitmaps, 1);
> +  b->store_avail_in = BITMAP_ALLOC (NULL);
> +  b->store_avail_out = BITMAP_ALLOC (NULL);
> +  b->store_antic_in = BITMAP_ALLOC (NULL);
> +  b->store_avail_out = BITMAP_ALLOC (NULL);
> +  b->read_avail_in = BITMAP_ALLOC (NULL);
> +  b->read_avail_out = BITMAP_ALLOC (NULL);
> +  b->read_local = BITMAP_ALLOC (NULL);
> +  b->store_local = BITMAP_ALLOC (NULL);
> +  return b;

I do suggest allocating all of these off of an obstack.


r~



More information about the Gcc-patches mailing list