home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.compilers:1389 comp.lang.c:12404
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!rutgers!faatcrl!iecc!compilers-sender
- From: markh@csd4.csd.uwm.edu (Hunk)
- Newsgroups: comp.compilers,comp.lang.c
- Subject: Re: Two-pass C compilers
- Keywords: C
- Message-ID: <92-08-088@comp.compilers>
- Date: 16 Aug 92 19:06:31 GMT
- References: <92-08-081@comp.compilers> <92-08-086@comp.compilers>
- Sender: compilers-sender@iecc.cambridge.ma.us
- Reply-To: markh@csd4.csd.uwm.edu (Hunk)
- Organization: Computing Services Division, University of Wisconsin - Milwaukee
- Lines: 31
- Approved: compilers@iecc.cambridge.ma.us
-
- behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens) writes:
- >Hmmm ... beat me if I something silly, but: Is there any way around
- >a two-pass compiler? (Or even more passes)
- >
- >First pass: Reading in the source, preprocessing it, building a symbol table.
- >Second pass: Generate p-Code
- >Third pass: Optimize p-Code (Note: Do not mix with 2nd pass or you are
- >in deep trouble)
- >Fourth pass: Generate native code in linkable object file
-
- Pass 1: Generate optimized binaries, into an object file.
- Back-patch forward references, Dump table of external and globals.
-
- The object file format is dictated by this method. All memory images must
- be written before the tables and after the header. The header must be
- fixed in size, and must contain all the needed pointers to access the
- tables.
-
- The code generation rules are carefully written with optimization built
- into them. For example, they can be derived by knowledge engineering
- techniques from an expert human compiler (presunably the person doing the
- compiler-writing would qualify).
-
- Global analysis, data flow, register allocation, control flow are all done
- on the fly during parsing. Whatever intermediate structures are needed
- are stored in memory.
-
- Pass 1.5: Linking object files and resolving the remaining unresolved objects.
- --
- Send compilers articles to compilers@iecc.cambridge.ma.us or
- {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
-