Mail Archives: djgpp/1998/08/31/21:09:55
> The following C/C++ code when compiled:
> gxx example9.cc -S -O2
> results in the .s file below it. It is plain that the arguments
> of zadd are passed on the stack. Eli Zareteskii has told me that
> passing them in registers requires
> __attribute__((regparm=2))
Actually, you can make gcc pass up to three arguments in registers with
__attribute__((regparm=3)).
> and that the information about this is in the GCC docs. Please:
> someone expert in searching these docs tell me exactly where this
>attribute statement goes in the C++ code below and exactly what the
>correct syntax is.
_____The C/C++ source code_(Modified)______________________________
int zadd(int m,int n) __attribute__((regparm=3)); /* This should work */
int i,j,k;
main()
{i=2; /* ------> adds 2 and 3. */
j=3;
k=zadd(i,j);
return 0;
}
int zadd(int m,int n) /* --------> one wishes to place the attriute
statement */
{return m+n;} /* in this subroutine */
----------------
Troy Van Horn
- Raw text -