Messages in this thread | | | Date | Thu, 9 Jul 1998 11:56:41 +0100 | From | Jamie Lokier <> | Subject | Re: -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
| |