[patch, fortran] Make frontend walker more general

Jakub Jelinek jakub@redhat.com
Sat Sep 11 21:00:00 GMT 2010


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.

	Jakub



More information about the Fortran mailing list