[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rep:Re: [f-cpu] Stack handling



hi,

Christophe Avoinne wrote:
<snip>
> I tell you, your stack design is bad or incomplete, should I say at least.
it is simple and you do whatever you want with it, even waste cycles
if you feel like it's necessary.

> Post-increment/decrement is a no use without pre-decrement/increment.
pre-modification is not possible, as you know.
but use your imagination.

> Hummm... i think we can remove one instruction.
> 
> // pushing r1..r5
> store -8,r62,r1
> store -8,r62,r2
> store -8,r62,r3
> store -8,r62,r4
> store -8,r62,r5
> ...
> addi +8,r62,r62 // we still need to adjust the stack pointer

don't do that, unless you like to waste cycles.
The add will flush the "pointer" flag, which means that
the result will be checked inside the TLB.
If you don't check the TLB, you will have at least
several "dead" cycles, during which the CPU will
refresh the flags.


Furthermore, F-CPU is well adapted to contain a part
of the stack in the registers. that is : it can be
viewed as a "cache", though this must be managed by
the compiler. Why waste at least 2 cycles (push and
pop of a data, for its creation and consumption)
when you can ask the compiler to keep data in the
register set for a limited time ? Since the compiler
can know the data lifelength, it can decide if it must
be pushed/popped to memory (long lifelength) or kept
in the registers.


WHYGEE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/