Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!unido!mpirbn!p554mve From: p554mve@mpirbn.UUCP (Michael van Elst) Newsgroups: comp.unix.wizards Subject: Re: Should optimizing compilers automatically assign registers? Message-ID: <952@mpirbn.UUCP> Date: 6 May 90 21:02:05 GMT References: <512@hhb.UUCP> Reply-To: p554mve@mpirbn.UUCP (Michael van Elst) Organization: Max-Planck-Institut fuer Radioastronomie, Bonn Lines: 24 In article <512@hhb.UUCP> istvan@hhb.UUCP (Istvan Mohos) writes: >Prog1 and prog2 are identical except that prog1 requests the >assignment of the auto variable p to a hardware register. >I mistakenly assumed that by using the -O flag, the compiler >would optimize prog2, and generate identical objects from >prog1 and prog2. Of the systems I tried this on, the Pyramid90X, >the Sparcstation1, and a SystemV 6300+ PC, proved this to be true. >A VAX Ultrix and a Sun3 proved me wrong. Here are some execution I've simply checked this by looking at the cc -S output. The Sun C compiler does not allocate registers when run with optimizer level 1 but it does so with level 2. The -O option just invokes a peephole optimizer. The difference between Sparc and Sun-3 systems is that the Sparc compiler will run -O2 if invoked with just -O while the Sun-3 defaults to -O1. Under SunOS 4.1, both systems will use -O2. -- Michael van Elst UUCP: universe!local-cluster!milky-way!sol!earth!uunet!unido!mpirbn!p554mve Internet: p554mve@mpirbn.mpifr-bonn.mpg.de "A potential Snark may lurk in every tree."