This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Gfortran internal tree structure
- From: Daniel Kraft <domob1812 at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Date: Wed, 18 Jun 2008 17:15:26 +0200
- Subject: Gfortran internal tree structure
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:user-agent :mime-version:to:subject:content-type:content-transfer-encoding:from; bh=6wc6H0lZFc7dObhgmR0UVnnpPwFkKnhXMoY0ED7ioIk=; b=ispzSI2CpWlJRKMhkvADnWoOeMqSbNF9YT4i0JMzXarazcqE++JHi1C/8R19NRKrOk qnM57F8SJ8LnbWEgP/KKj8tidv9My0gaTjjR3O/Z/z3B9tDGQQZ7VSvkVNpqszwuhxY9 TVfezhLeaRitHqDDaBOivArGAN2TqWOwgR4+A=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:user-agent:mime-version:to:subject:content-type :content-transfer-encoding:from; b=IcRbcTvCykCFWi7vpwASFBho91RnmPevLYmQHM546IJoo7wQBK2zFU+Yh225ohjtMo +D0fglPwPIvU4v9VbiarTHNdlR9la/AQ/hB+prlxJlPRRRU4eDPaQmw91JddkzmIQzh3 Y1OR3zKi7bVW4sEOjqq5YZoipAEcsJpWaQ8dE=
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