No register can be allocated for indirect call when it use regcall calling convention and passed 5/5+ args.
e.g.
call vreg (ag1, ag2, ag3, ag4, ag5, ...) --> 5 regs (EAX, ECX, EDX, ESI, EDI) used for pass args, 1 reg (EBX )used for hold GOT point,
so no regs can be allocated to vreg.
The Intel386 architecture provides 8 general purpose 32-bit registers. RA mostly
use 6 of them (EAX, EBX, ECX, EDX, ESI, EDI).
5 of this regs can be used to pass function arguments (EAX, ECX, EDX, ESI, EDI).
EBX used to hold the GOT pointer when making function calls via the PLT.
ESP and EBP usually be "reserved" in register allocation.
Reproduce case:
//clang -target i386-unknown-linux-gnu -S -fpic t.c #define REGCALL __attribute__((regcall)) int REGCALL func (int i1, int i2, int i3, int i4, int i5); int (REGCALL *fptr) (int, int, int, int, int) = func; int test() { return fptr(1,2,3,4,5); }
To be conservative, do you need to check if the argument number exceed 4 (>=5)?