Re: Two-pass C compilers

Gary Merrill <sasghm@unx.sas.com>
Mon, 17 Aug 1992 17:14:59 GMT

          From comp.compilers

Related articles
Two-pass C compilers maniattb@cs.rpi.edu (1992-08-15)
Re: Two-pass C compilers behrenss@Informatik.TU-Muenchen.DE (1992-08-16)
Re: Two-pass C compilers quanstro@stolaf.edu (1992-08-16)
Re: Two-pass C compilers markh@csd4.csd.uwm.edu (1992-08-16)
Re: Two-pass C compilers sasghm@unx.sas.com (Gary Merrill) (1992-08-17)
Re: Two-pass C compilers leichter@zodiac.rutgers.edu (1992-08-18)
Re: Two-pass C compilers mcrware!adam@uunet.UU.NET (1992-08-19)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Gary Merrill <sasghm@unx.sas.com>
Organization: Compilers Central
Date: Mon, 17 Aug 1992 17:14:59 GMT
Keywords: C, design
References: 92-08-081 92-08-086

As posed, this question is a pseudo-question and is unanswerable. The
answer hinges on what we mean by "pass". As John has pointed out, the
"classical" meaning of pass (as applied to assemblers) pertains to the
number of times the *source* is read. With high- level languages, the
concept of pass becomes a bit more murky, and even in the best texts there
is confusion.


For example, in _The_Theory_and_Practice_of_Compiler_Writing_, Tremblay
and Sorenson first define "separate pass" as meaning "examine the entire
source program". Yet two paragraphs later they conflate "phase" and
"pass" (using both terms) in such assertions as


[T]he optimization phase may require that several
                passes of the source program (or its intermediate
                form) be made.


and then


[T]he optimization phase is often spread throughout
the other pases of the compilation process ...


I find this second statement especially puzzling, but it is clear that
they intend to extend the idea of "pass" to include the processing of an
intermediate representation.


If we employ this broader notion of "pass", then every C compiler known to
me is multi-pass. Whether the intermediate representation is in a file on
the disk, in memory, or on my notepad is irrelevant. (Note that
frequently the intermediate representation is not textual in nature, but
is a binary representation of a tree or a set of quadruples. In fact,
there may be *several* intermediate representations, depending upon how
much and what kind of optimization is desired.) But if we employ the
narrower (classical) notion of "pass", then every C compiler known to me
is single pass since I know of none (there *may* be some, but I can't
imagine why) that read the original source more than once. Even those
compilers that first generate a file of tokenized input (at least the old
Whitesmith's compiler used to do this) are single pass since they read the
original source only once.


---
Gary H. Merrill [Principal Systems Developer, C Compiler Development]
SAS Institute Inc. / SAS Campus Dr. / Cary, NC 27513 / (919) 677-8000
sasghm@theseus.unx.sas.com ... !mcnc!sas!sasghm
--


Post a followup to this message

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