This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [patch, fortran] Make frontend walker more general


Am Samstag, den 11.09.2010, 22:09 +0200 schrieb Jakub Jelinek:
> On Sat, Sep 11, 2010 at 09:51:57PM +0200, Steven Bosscher wrote:
> > To make the walker really generally usable, I would do a few things extra:
> > 
> > > +/* A struct for holding the pass-specific functions.  */
> > > +typedef struct process_functions
> > > +{
> > > +  void (*process_assignment) (gfc_code *);
> > > +  void (*process_expr) (gfc_expr *);
> > 
> > I'd pass the gfc_code where the expr is in also:
> 
> Furthermore, I think having process_pointer_assign etc. special hooks
> is not the right thing for a walker.  IMNSHO you should look e.g. at
> walk_tree or perhaps better walk_gimple_stmt.
> The walker should call one hook (which takes gfc_code *) at each gfc_code
> node, and another hook at each gfc_expr node.  The API should have a way
> to stop processing and return some value to the caller, have some void *
> pointer passed to the callbacks in which the caller can keep some state,
> and have a way how to say that subtrees shouldn't be traversed.

Why would this be better?

Given the complexity of Fortran, wouldn't this lead to lots of code
duplication, with a big switch statement both in the statement walker
and the handler for the individual statements?

	Thomas


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