delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/18/15:46:48

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: inefficiency of GCC output code & -O problem
Date: 18 Apr 2000 13:23:14 -0700
Organization: InterWorld Communications
Lines: 35
Message-ID: <83og77rwel.fsf@mercury.st.hmc.edu>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000413112851 DOT 28180G-100000 AT is> <38F6137B DOT 47481761 AT mtu-net DOT ru> <8d76dk$dg5$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <38F74CD0 DOT 6987E15A AT mtu-net DOT ru> <8dep4b$g5f$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <38FAF400 DOT 1B7FE2E6 AT mtu-net DOT ru> <83snwktsse DOT fsf AT mercury DOT st DOT hmc DOT edu> <38fc3dd3 DOT 3376799 AT news DOT freeserve DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
Mime-Version: 1.0
X-Trace: nntp1.interworld.net 956089659 79306 134.173.45.219 (18 Apr 2000 20:27:39 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 18 Apr 2000 20:27:39 GMT
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

dontmailme AT iname DOT com (Steamer) writes:

> Nate Eldredge wrote:
> 
> >GCC can do this.  Look up `regparm' in the Function Attributes section
> >of the gcc manual.
> 
> Unfortunately, regparm is incompatible with profiling (at least in
> GCC 2.8.1, which I'm using) because the -pg option inserts code
> at the beginning of each function which trashes eax and edx (and
> maybe ecx, which I didn't look at) and therefore destroys the passed
> parameters - with inevitably gruesome results.
> 
> Has this been fixed in later versions?

Hmm, so it does.  Still present in 2.95.2.  Maybe you should report
this as a bug.

> Of course, it's possible to work around it with something like
> 
> #if defined __DJGPP__ && !defined PROFILING
> #define REGPARM(n) __attribute__ ((regparm(n)))
> #else
> #define REGPARM(n)
> #endif
> 
> but then it's necessary to remember -DPROFILING in addition to -pg.

And you'll get different profiling results, thus preventing you from
finding whether regparm actually sped up the code any.  Pity.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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