Re: Folk Theorem: Assemblers are superior to Compilers

Danny Thomas <vthrc@mailbox.uq.oz.au>
Fri, 5 Nov 1993 08:57:34 GMT

          From comp.compilers

Related articles
[24 earlier articles]
Re: Folk Theorem: Assemblers are superior to Compilers henry@zoo.toronto.edu (1993-10-31)
Re: Folk Theorem: Assemblers are superior to Compilers drraymon@watdragon.uwaterloo.ca (1993-11-01)
Re: Folk Theorem: Assemblers are superior to Compilers dmr@alice.att.com (1993-11-02)
Re: Folk Theorem: Assemblers are superior to Compilers steven.parker@acadiau.ca (1993-11-02)
Re: Folk Theorem: Assemblers are superior to Compilers pardo@cs.washington.edu (1993-11-03)
Re: Folk Theorem: Assemblers are superior to Compilers kanze@us-es.sel.de (James Kanze) (1993-11-03)
Re: Folk Theorem: Assemblers are superior to Compilers vthrc@mailbox.uq.oz.au (Danny Thomas) (1993-11-05)
Re: Folk Theorem: Assemblers are superior to Compilers lenngray@netcom.com (1993-11-07)
Re: Folk Theorem: Assemblers are superior to Compilers rfg@netcom.com (1993-11-13)
Re: Folk Theorem: Assemblers are superior to Compilers synaptx!thymus!daveg@uunet.UU.NET (Dave Gillespie) (1993-11-15)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Danny Thomas <vthrc@mailbox.uq.oz.au>
Keywords: C, optimize, comment
Organization: VTHRC, The Uni of Queensland
References: 93-10-129 93-10-150
Date: Fri, 5 Nov 1993 08:57:34 GMT

>At least for C, what makes the compiler (relatively) inefficient is that
>the functions are compiled independently. It forbids register allocation
>across function calls. It constrains the compiler to make pessimistic
>assumptions on the register usage by the called functions.


Prototype declarations were included in ANSI C partly with the idea of
allowing parameter passing through registers, at least for functions with
a fixed number of arguments. To quote from p42 of the Rationale
accompanying X3.159-1989 which isn't part of the standard proper but does
provide interesting background:


"This provision constrains the latitude of an implementor because the
parameter passing conventions of a prototype and non-prototype function
calls must be the same for functions accepting a fixed number of
arguments. Implementations in environments where efficient function
calling mechanisms are available must, in effect, use the efficient
calling sequence either in all "fixed argument list" calls or in none.
Since efficient calling sequences often do not allow for variable argument
functions, the fixed part of a variable argument list may be passed in a
completely different fashion than in a fixed argument list with the same
number and type of arguments."


I agree that register passing is an effective optimization but one of the
major problems with C is handling pointers, or more particularly
determining which pointer operations have side-effects on other variables.


cheers,
Danny Thomas
[P.J. Plauger has told me that during most of the standardization discussions,
prototyped and non-prototyped functions weren't supposed to be interchangable.
I don't know when that changed. -John]
--


Post a followup to this message

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