delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/18/06:41:12

From: dontmailme AT iname DOT com (Steamer)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: inefficiency of GCC output code & -O problem
Date: Tue, 18 Apr 2000 10:50:16 GMT
Organization: always disorganized
Lines: 24
Message-ID: <38fc3dd3.3376799@news.freeserve.net>
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>
NNTP-Posting-Host: modem-236.massachusetts.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 956055017 5207 62.137.72.236 (18 Apr 2000 10:50:17 GMT)
NNTP-Posting-Date: 18 Apr 2000 10:50:17 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Free Agent 1.11/32.235
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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?

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.

S.

- Raw text -


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