Question on function-at-a-time and GC

Zack Weinberg zack@codesourcery.com
Fri Apr 16 17:49:00 GMT 2004


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

> The problem is that I don't know (or, more precisely don't want to have to
> check) for every call to convert a tree whether or not there's a nested
> subprogram someplace in there.  So these calls would basically have to be for
> every tree node, which is very expensive.

Here's another idea: have a prescan over the front end's private tree
structure which flattens out the subprogram nesting, i.e. transforms

int sub1 (int i)
{
  return ({int sub2 (int j) { return j + 7;}; sub2 (12);}) + i;
}

into

static [inline?] int __sub2_from_sub1(int j) { return j + 7; }

int sub1(int i) { return __sub2_from_sub1(12) + i; }

The only tricky bit is when the nested subprogram refers to the
enclosing subprogram's variables.

rth was trying to do something similar for C as I recall.  
However, add me to the set of people who think we should 
drop the nested-functions extension from the C front end.

zw



More information about the Gcc mailing list