www.delorie.com/archives/browse.cgi   search  
Mail Archives: pgcc/1998/07/07/01:29:00

X-pop3-spooler: POP3MAIL 2.1.0 b 4 980420 -bs-
Message-ID: <19980706234103.04834@cerebro.laendle>
Date: Mon, 6 Jul 1998 23:41:03 +0200
From: Marc Lehmann <pcg AT goof DOT com>
To: beastium-list <beastium-list AT Desk DOT nl>
Cc: linux-c-programming AT tower DOT itis DOT com, linuxprog AT geeky1 DOT ebtech DOT net
Subject: Re: passing args in regs speed (was:something else)
Mail-Followup-To: beastium-list <beastium-list AT Desk DOT nl>,
linux-c-programming AT tower DOT itis DOT com, linuxprog AT geeky1 DOT ebtech DOT net
References: <Pine DOT LNX DOT 3 DOT 96 DOT 980705003927 DOT 170A-100000 AT dragon DOT bogus> <Pine DOT SOL DOT 3 DOT 96 DOT 980706180936 DOT 11646B-100000 AT stekt3>
Mime-Version: 1.0
In-Reply-To: <Pine.SOL.3.96.980706180936.11646B-100000@stekt3>; from Tuukka Toivonen on Mon, Jul 06, 1998 at 06:35:32PM +0300
X-Operating-System: Linux version 2.1.108 (root AT cerebro) (gcc version pgcc-2.91.43 19980628 (gcc2 ss-980502 experimental))
Status: RO
Lines: 79

On Mon, Jul 06, 1998 at 06:35:32PM +0300, Tuukka Toivonen wrote:
> 
> Yes, except that I happen to hate AT&T syntax ;)

we all have our cross to bear . . .

> >true since for example the eax register has not to be preserved at all. It
> >would be nice to pass the last parameter of the function call in the eax
> >register and the other parameters across the stack as usual. I think it
> >would help a lot in performance. I' ll try to discover the improvement. 

I tried (a loong time ago) to get global inlining ready. The reason behind
this was not really inlining, but the possibility to do certain
optimizations automatically (like regparm). This, unfortunately, is quite
impossible.

this also wouldn't help with inter-file dependencies. But wait, I just got a
nice idea (Bernd: if you are listening, what about this?). One could compile
every function (or most) in two (three, four..) versions, one without
regparm, one with regparm, and then call the right one.

Hmm, but this cloning wouldn't help, as we would need global knowledge about
which functions are cloned and qwhich are not (is there sth. like negative
weak symbols? we could probably embed weak symbols linking from the
non-regparm function to the regparm functions?)

Of course, doubling compile time doesn't matter ;->

Another idea: we could add a project-local database where gcc can store
information about compiled objects. We could store "really static functions"
tags for functions we compile, so gcc is able to optimize better on the next
run without seperating tree from rtl). The disadvantage is that we would,
again, have two passes over each file.

(But having this implemented, saving rtl (or better: tree code) would
be a logical next step).

So much ideas.. so little time..

> Question: why gcc doesn't allow more than 3 registers
> to be used?? x86 would have 7 or at least 6 free registers.

as somebody else already pointed out, gcc will run into problems when we use
caller saved registers, also, register 3 (counted from zero), is %ebx, which
is used for pic code, and definitely can't be used for sth. else)

(hehehe, we could use mmx registers..)

> Considerations: 
> - All libc calls used conventional stack parameter passing 
>   convention. This could be changed by breaking compatibility.

yeah. as well as double argument aligning *sigh*.

> - Why kernel doesn't use register parameters?? It would be
>   ideal since it wouldn't break compatibility!

somebody once tried it, you might find sth. in the linux-kernel
archives.

bzip2 is, imho, a bad benchmark. yet all people (including me) are using it
for this. but I'm sure its much less representative for general usage
than other programs.

> ( I'm CCing this to pgcc list since I think those people
> could be interested; maybe they could implement automatic
> register passing for static functions?)

Almost, we would need to know wether the address of that functions is taken
somewhere else. "static" is not "used only in this file". We also carefully
use rtd, use totally different calling conventions &c.. if only we knew..

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg AT goof DOT com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019