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]

Gfortran internal tree structure


Hi,

while working on finalization, I'm at some places building expressions and statements to insert in the gfortran-internal tree (not the generic GIMPLE tree but gfc_code/gfc_expr and friends).

Sometimes I had to give it quite a few tries to get it right, as there are some minor details that I found non-intuitive or not perfectly clear.

For instance, that an IF statement consists of two gfc_code-parts with EXEC_IF, one being the block-member of the other, and that the condition is in the expr-member of the *inner* member. (At least that's what my tests suggested and what's working for me at the moment.)

It would surely be helpful to have some support here for anyone not familar with these details, but AFAIK there's no real documentation around (maybe a bit in the dump-tree.c file or what it's called, but that's not perfect). What do you think about writing a (maybe just quite summarizing) documentation about how gfc_code statements and gfc_expr expressions have to be structured for IF, DO, things like "a+5" or "ALLOCATED(arr)" and whatever comes to mind? Or is there already such documentation and I missed it?

If you want and I find time, I volunteer to start this in parallel to my coding; but I think for that I need at least a good reviewer as I'm not myself a guru on this topic :) Additionally, if you think that's a good idea, I could write builder-functions (maybe in a new code file build-tree.c); for instance, given a code-block and a condition, build a complete (resolved?) IF-gfc_code block; and similar for other constructs and expressions (build a less-than expression given two operands or a function-call given the list of actual argument expressions and the symbl/symtree/name. These could serve both as a secondary documentation on how such an expression really looks like and be used to combine this logic where it's used in the code (during parsing and at places like my finalization routines during resolution).

What do you think about this idea? I can't promise I'll really find time to work on this soon, but at least for me these ideas sound reasonable and useful.

Daniel

--
Done:     Bar-Sam-Val-Wiz, Dwa-Elf-Hum-Orc, Cha-Law, Fem-Mal
Underway: Ran-Gno-Neu-Fem
To go:    Arc-Cav-Hea-Kni-Mon-Pri-Rog-Tou


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