* is an nargs() for the MIPS architecture possible ?
@ 1991-07-10 21:57 Paul Barton-Davis
1991-07-10 22:14 ` Paul Barton-Davis
0 siblings, 1 reply; 2+ messages in thread
From: Paul Barton-Davis @ 1991-07-10 21:57 UTC (permalink / raw)
Before I begin, I should point out that I am aware that any
affirmative answer to this question will be highly non-portable, and very
compiler-implementation dependent. Please do not waste network
bandwidth to tell me or anyone else that what am I about to ask about
cannot be done portably - I already know that, and that's why I'm
posting.
I have so far come across two implementations of an nargs() function.
nargs() returns the number of arguments passed to the calling
function. Hence,
foo (int a, int b, int c)
{
printf ("%d\n", nargs())
}
when called correctly will display "3".
Both the implementations are rooted in knowing a lot about the
compiler's calling conventions for the stack. They are also both for
CISC architectures (Sequent Symmetry 386 and Sun 3 (68030)).
Now I'm faced with porting some code which uses nargs() to a MIPS
system. The rest of the port is done, and there are other methods I
can think of to circumvent the need for nargs, but neverthless, outof
intellectual curiosity, I'm wondering how difficult it would be to
write such a function for a MIPS compiler ? I remember some stuff
about how RISC compilers make much greater use of registers and so
forth, but I know so little about this stuff, that I can't begin to
guess.
Would anyone like to comment ? E-mail would be preferred, but I'll
watch these groups for a few days.
- paul
--
"When in some obscure country town, the farmers come together to a special town
meeting, to express their opinion on some subject that is vexing the land, that
I think is the true Congress, and the most respectable one that is ever
assembled in the United States." - Thoreau
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: is an nargs() for the MIPS architecture possible ?
1991-07-10 21:57 is an nargs() for the MIPS architecture possible ? Paul Barton-Davis
@ 1991-07-10 22:14 ` Paul Barton-Davis
0 siblings, 0 replies; 2+ messages in thread
From: Paul Barton-Davis @ 1991-07-10 22:14 UTC (permalink / raw)
OOPS, I forgot to mention that I'm asking this question about MIPS in
the context of DECstations in the 3000 and 5000 series, Ultrix 4.X and
the MIPS "RISC" C compiler (or gcc, the choice is yours). I know that
other implementations may exist as far as hardware, but not what
impact that has on the answer.
--
"When in some obscure country town, the farmers come together to a special town
meeting, to express their opinion on some subject that is vexing the land, that
I think is the true Congress, and the most respectable one that is ever
assembled in the United States." - Thoreau
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1991-07-10 22:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1991-07-10 21:57 is an nargs() for the MIPS architecture possible ? Paul Barton-Davis
1991-07-10 22:14 ` Paul Barton-Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox