Re: Three Address Code

"Travers Naran" <tnaran@direct.ca>
15 Sep 2000 01:35:52 -0400

          From comp.compilers

Related articles
Three Address Code smitha_chandran@yahoo.com (2000-09-11)
Re: Three Address Code Sid-Ahmed-Ali.TOUATI@inria.fr (Sid Ahmed Ali TOUATI) (2000-09-13)
Re: Three Address Code tnaran@direct.ca (Travers Naran) (2000-09-13)
Re: Three Address Code tnaran@direct.ca (Travers Naran) (2000-09-15)
Re: Three Address Code dancohen@nospam.canuck.com (Dan Cohen) (2000-09-15)
Re: Three Address Code leupers@ls12.cs.uni-dortmund.de (Rainer Leupers) (2000-09-17)
| List of all articles for this month |
From: "Travers Naran" <tnaran@direct.ca>
Newsgroups: comp.compilers
Date: 15 Sep 2000 01:35:52 -0400
Organization: Look Communications - http://www.look.ca
References: 00-09-088 00-09-094
Keywords: design

"Travers Naran" <tnaran@direct.ca> wrote in message
> <smitha_chandran@yahoo.com> wrote in message
> > I would like to know if Three Address Code can be implemented in some
> > way other then quadruple or triples.
>
> I don't get it: isn't three address code inherently a n-tuple of
> addresses? Finding another implementation is looking for something
> other than three address code, isn't it? I am curious about this
> because I've only ever used n-tuples (quadruple or triples) and I too
> would be interested if there was another way.
> --------
> Travers Naran: Computer Programmer & P/T Meddler In Time & Space
> New Westminster, British Columbia, Canada, North America, Earth, yada,
yada


Then the moderator added:
> [It's true, three address code is inherently quads, but you can mechanically
> translate it to trees of triples, RPN, or anything else you want. -John]


Actually, you are right. I forgot I had asked almost this same
question many, many moons ago on this newsgroup when I was a second
year comp-sci student (1992!?). Here is the most interesting posted
reply I got on the subject:


http://compilers.iecc.com/comparch/article/92-07-083


Now, this does not completely address the original question: what data
structures can be used to represent Quad code. One of the e-mail replies I
got suggested using a tree to create very complex address build ups. This
would involve a root node that represents the main structure of the quad
(e.g., if-then, arithmetic op) and then each child could either be a
terminal (e.g., symbol) or another tree (e.g., an array de-reference).


This procedure was great for creating really complex array de-references,
but really makes it difficult to create efficient code generation. I found
it better to do most of the array calculation in quad code and then have a
simple de-reference operation (i.e., a[x] := y). It maps really well to a
RISC instruction set like R/x000.


--
Travers Naran: Computer Programmer & P/T Meddler In Time & Space
New Westminster, British Columbia, Canada, North America, Earth, yada, yada


Post a followup to this message

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