From: pauld@cs.washington.edu (Paul Barton-Davis)
Subject: is an nargs() for the MIPS architecture possible ?
Date: 10 Jul 91 21:57:07 GMT [thread overview]
Message-ID: <1991Jul10.215707.18935@beaver.cs.washington.edu> (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
next reply other threads:[~1991-07-10 21:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-07-10 21:57 Paul Barton-Davis [this message]
1991-07-10 22:14 ` is an nargs() for the MIPS architecture possible ? Paul Barton-Davis
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox