lkml.org 
[lkml]   [1998]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: -mregparm=3
I've used -mregparm=1 for a fairly complex C++ program (a video game,
approx. 300kloc), including extended `asm' statements, virtual functions
and so on and didn't have any problems. I hit a number of other
compiler bugs, which I fixed or got someone to fix, but nothing from
-mregparm=1.

I did some tests and found 1 was the value that produced the smallest
code. This makes sense with C++ as the same `this' pointer is passed to
a lot of functions called.

I did find that with -mrtd as well, `__attribute__ ((regparm (0),
cdecl))' to get traditional function calls ignored all but the last
attribute (whichever way around I wrote them), so I couldn't use that
and call system libraries. So I didn't.

I never timed the differences, just looked at the code and decided which
looked best. -mregparm=1 was a clear winner in some cases because both
the pushing and popping of stack arguments were eliminated around many
function calls. > 1 caused too much register pressure in the caller,
making the code larger. The code I was examining may have been unusual:
critical functions tended to be inlines with many parameters, with most
parameters constant folding, or simply being stored in a structure,
followed by a call to an out of line function with fewer parameters,
often only the `this' pointer.
-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site