Re: Memory Operand Performance




"cr88192" <cr88192@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4a523cf5$0$5643$9a6e19ea@xxxxxxxxxxxxxxxxxxxxxxxxxxxx

just, I can think of a better way to pass arguments in registers:
they are passed in registers AND space is reserved for them in the stack
frame.

this way, if needed, the registers could be spilled right back into where
they would have been, had they been passed on the stack.

this would give a little more flexibility to the code generation in the
caller, reduce the awkwardness of register spilling (no need to go and
allocate locals), and allow a simple and efficient implementation of
'va_list' (we can spill the registers to the stack, and do va_list as in
x86, namely, a pointer).

similarly, the stack layout would be 1:1 with the passed args list (as in
x86), ...

[...]

it also allows (relatively) efficient calling between stack-based and
register-based arg passing (a few 'mov' instructions, vs having to repack
the stack frame).


I like the idea. A simple stack adjustment for the arguments in registers
plus pushes for the remainder. Also, it might make it easier to get and use
the address of a variable which has been moved into a register. Let us know
how well that works.


Rod Pemberton


.



Relevant Pages

  • Re: C function return value?
    ... >"every invocation of a function causes a frame for that function to be ... >pushed on stack. ... its local variables fit in any registers left over after accounting ... or read the compiled code or the compiler code. ...
    (comp.lang.c)
  • Re: LPC900/80C51 Compiler Toolchain
    ... Although the fixed-size frame optimization is orthogonal to removing ... storing stack arguments is less important in such cases. ... storing data at (SP + offset) takes exactly the same time ... up and uses up another 2 registers. ...
    (comp.arch.embedded)
  • Re: Statement on Schildt submitted to wikipedia today
    ... you discover that Schildt was libeled. ... It turns out that, on this particular architecture, some registers are saved ... The problem is, even though indeed this implementation has "a stack", if you ... end up adjacent to one of our newest automatic variables. ...
    (comp.lang.c.moderated)
  • Re: Geriatric Pentium
    ... processor scavenging spare ram cycles to back it up to ram and restore ... Let's say I had hardware for 128 registers. ... Ditto for caching the stack. ... PUSHL P+2;; take parameter #2 and push it ...
    (comp.lang.java.advocacy)
  • Re: [OT] PostLisp, a language experiment
    ... >> that a C compiler generates code to arrange the parameters where it ... > value from the user stack. ... > can be simply passed in registers. ... common for the top stack item to reside in a register, ...
    (comp.lang.lisp)