Subject: -mregparm=X (for X > 0)
To: None <current-users@NetBSD.ORG>
From: Craig M. Chase <email@example.com>
Date: 07/06/1995 11:47:46
While poking through the info pages of gcc-2.7.0, I discovered the
flag -mregparm=X for the i386.
With this flag you can tell gcc to pass parameters in registers.
Without the flag, all parameters are passed on the stack. Since the
386 is woefully short on registers, at most 3 parameters can be passed
in registers. They appear to be passed as follows:
parameter 1: eax
parameter 2: edx
parameter 3: ecx
parameter 4: mem[ebp+8]
parameter 5: mem[ebp+12]
Obviously, the calling conventions for parameters passing must be a
standard across the entire port. You can't just start compiling
hello_world with -mregparm=3 and expect it to work (you'd have to
recompile all the libraries first).
Has anyone thought of doing this?
Any idea what kinda performance improvement we might see?
Craig Chase --- Assistant Professor
Electrical and Computer Engineering
The University of Texas at Austin
Austin, TX 78721 --- (512) 471-7457