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: [gc-improv] Convert sese.c to use obstack


Hi,

On Mon, Nov 2, 2009 at 00:58, Laurynas Biveinis
<laurynas.biveinis@gmail.com> wrote:
> create_if_region_on_edge is called by move_sese_in_condition is called
> by gloog, where it is used to setup local variable if_region. I have
> created an obstack in gloog.
>
> Bootstrapped and regtested together with tree-ssa-structalias.c patch
> under x86_64-unknown-linux-gnu, committed to gc-improv.
>
> I am pleased to say that this completes the conversion of the middle
> end. The front ends have been already converted a while ago, the
> backends remain. The backend conversion looks like it is going to be
> straightforward, testing excepted.
>
> 2009-11-02 ÂLaurynas Biveinis Â<laurynas.biveinis@gmail.com>
>
> Â Â Â Â* sese.h: Include obstack.h.
> Â Â Â Â(create_if_region_on_edge): Remove prototype.
> Â Â Â Â(move_sese_in_condition): New parameter of type struct obstack *.
> Â Â Â Â* graphite-clast-to-gimple.c: Include obstack.h
> Â Â Â Â(gloog): New local variable graphite_obstack. ÂInitialize obstack,
> Â Â Â Âpass it to move_sese_in_condition, free.
> Â Â Â Â* sese.c (create_if_region_on_edge): Make static. New parameter
> Â Â Â Âgraphite_obstack. ÂUse obstack allocation.
> Â Â Â Â(move_sese_in_condition): New parameter graphite_obstack. ÂPass it
> Â Â Â Âto create_if_region_on_edge.
> Â Â Â Â* Makefile.in (SESE_H): New.
> Â Â Â Â(sese.o, graphite.o): Replace sese.h $(SESE_H) in dependencies.
> Â Â Â Â(graphite-poly.o, graphite-scop-detection.o): Likewise.
> Â Â Â Â(graphite-sese-to-poly.o): Likewise.
> Â Â Â Â(graphite-clast-to-gimple.o): Likewise. ÂAdd $(OBSTACK_H) to
> Â Â Â Âdependencies.
>
>

My question is why did we had to use GGC_NEW?  I just think that we
used GGC_NEW only out of laziness.

> -  sese sese_region = GGC_NEW (struct sese_s);
> -  sese true_region = GGC_NEW (struct sese_s);
> -  sese false_region = GGC_NEW (struct sese_s);
> -  ifsese if_region = GGC_NEW (struct ifsese_s);
> +  sese sese_region = (sese) obstack_alloc (graphite_obstack,
> +					   sizeof (struct sese_s));
> +  sese true_region = (sese) obstack_alloc (graphite_obstack,
> +					   sizeof (struct sese_s));
> +  sese false_region = (sese) obstack_alloc (graphite_obstack,
> +					    sizeof (struct sese_s));
> +  ifsese if_region = (ifsese) obstack_alloc (graphite_obstack,
> +					     sizeof (struct ifsese_s));

Couldn't we avoid the obstacks by replacing all these alloc with XNEW?

Sebastian


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