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: [tree-ssa] How to increase PHI capacity?


Op ma 04-08-2003, om 21:43 schreef Diego Novillo:
> On Mon, 2003-08-04 at 15:22, Steven Bosscher wrote:
> 
> > Well, wouldn't that would break stuff all over if things are pointing to
> > the PHI?
> > 
> No, it shouldn't.  Why do you think it would?  You're not changing the
> address of the PHI node itself, only its vector of arguments.

Huh!?  What vector of arguments???  I believe you're mistaken.

>   We don't
> (shouldn't) cache the addresses of each element in the array.

AFAICT we allocate the phi args array as an integral part of the phi
node itself, similar to how we allocate ops for tree_expr nodes:

struct tree_phi_node GTY(())
{
  struct tree_common common;
  tree result;
  int num_args;
  int capacity;
  struct phi_arg_d GTY ((length ("((tree)&%h)->phi.capacity"))) a[1];
};

To increase the phi's capacity, you have to give a[] more elements.  But
you cannot reallocate just a[], you have to ggc_realloc() a whole new
phi node.  And ggc_realloc() always re-allocates the whole thing when
the new node is larger than the old one.

I would say this always changes the address of the phi node.

Gr.
Steven


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