Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hcr.UUCP Path: utzoo!hcr!mike From: mike@hcr.UUCP (Mike Tilson) Newsgroups: comp.lang.c Subject: Re: Porting PCC Message-ID: <2684@hcr.UUCP> Date: Fri, 19-Jun-87 09:57:01 EDT Article-I.D.: hcr.2684 Posted: Fri Jun 19 09:57:01 1987 Date-Received: Sat, 20-Jun-87 07:42:34 EDT References: <2082@dg_rtp.UUCP> <5975@brl-smoke.ARPA> <6604@ism780c.UUCP> <21214@sun.uucp> <801@omepd> Organization: HCR Corporation, Toronto Lines: 42 In a discussion of QCC and RCC, Steven McGeady (mcg@omepd.UUCP) writes: > ... > What V.3 *still* does not have, and would do the reputation of PCC-based > compilers a world of good, is a (mostly) machine-independent > intermediate code optimizer (between the first and second passes) > doing things like strength reduction, dead variable elimination, etc. > This would destroy the one-pass ("filter") aspect of PCC, but would > generate substantially better code. You may be interested to know that exactly such a thing has already been developed. An early version of HCR's "Portable Code Optimizer" (PCO) was described in the Portland USENIX/85 proceedings. PCO can be dropped in between "pass 1" and "pass 2" of the AT&T compilers, and it does most of the things that you would expect from a "globally optimizing" compiler. It also works for f77. (We recently ran a few benchmarks where UNIX V.2 f77 using PCO on a Vax 750 actually beat DEC's optimizing Vax/VMS Fortran.) Some "cutting and fitting" is required, so the technology is provided to OEMs rather than directly to end users. Every RT PC running AIX is shipped with PCO. It also runs on the CDC Cyber 180, the new Gould machines, and several others we can't talk about yet. (About the only thing we don't do is strength reduction -- it was a low payoff for C. But we do most everything else, including automatic in-lining of functions. Strength reduction will come in the future to improve Fortran.) Adding optimization to PCC (and successors) has several advantages: You don't change language semantics (a new optimizing compiler built from the ground up invariably seems to have a slightly different definition of C -- someday the ANSI standard may fix this, but not yet), existing engineering is retained (e.g. code generator, local optimizer), and PCC extensions such as "asm" can be retained (although functions using asm aren't globally optimized). One goal of the project was to be able to compile the UNIX kernel with PCO and still have it work, and this goal was met. (By the way, as most of you know, global optimization doesn't buy much on the kernel -- it has already been hand-tuned for years, and real "hot spots" are written in hand-coded assembler.) /Michael Tilson, {utzoo,ihnp4,...}!hcr!mike /HCR Corporation /130 Bloor St. West, 10th Floor /Toronto, Ontario, M5S 1N5 Canada /416-922-1937