f77 internals question

kurt%kong@gatech.edu (Erick Kurt Stirewalt)
Thu, 26 Jul 90 23:05:23 GMT

          From comp.compilers

Related articles
f77 internals question kurt%kong@gatech.edu (1990-07-26)
| List of all articles for this month |
Newsgroups: comp.compilers
From: kurt%kong@gatech.edu (Erick Kurt Stirewalt)
Keywords: Fortran, PCC
Organization: Compilers Central
Date: Thu, 26 Jul 90 23:05:23 GMT

Hello -


      I am using the f77 front end (derived from the pcc front end) to generate
a different type of intermediate code than normal from its internal expression
trees. My question relates to the characteristics of the tree nodes.


      Say we have the expression:
i = 1
This will result in a tree with the left subtree being an address node, the
right subtree being a constant type node, and the root an assignment operation.


      Now look at the expression:
j = i
This will result in a tree with the left subtree being an address node, the
right subtree being an address node, and the root an assignment operation.


      My question is, is there any way to know by looking *only at the address
node* to see if this node is a left hand side of an assignment operation,
or a right hand side?


      My first impression is that there probably is no difference in the first
pass, and that the second pass knows whether or not it is a lhs or an rhs
based on some tree walking procedure.


      This comes about because I am converting the f77 internal expression trees
into a stack based intermediate code, and i need to know whether to leave
the address of the operand on the stack (in the case of j in example 2),
or leave the value of the operand on the stack (in the case of i in example 2).


Thanks.


Kurt Stirewalt %
Georgia Tech Software Engineering Research Center. Atlanta, Georgia. %
uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!kong!kurt %
ARPA: kurt@kong.gatech.edu %
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.