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

Re: [f-cpu] Stack handling



> Please take into account that a SW-managed stack is an excellent
> place for doing optimisations. What is written in the last manual
> is a big issue for F-CPU : the unique function return address
> register is a critical "bottleneck" because a pointer can't
> be moved to another register (the value can, but the hidden
> flags won't be moved, so the next use will create a stall
> during maybe 5 or 10 cycles).

Ok, but this call convention was only for inter-language call, so not 
the most common, generally most of the call was made inside the programm 
and the compiler could optimize register allocation for return address.

> I think and know that there are several "inconsistencies".
> but the key is to NOT think like with usual CPUs.
> Ask yourself : what the CPU has to do and what is the simplest,
> fastest way to perform the task.

If you want to make thing in the simplest way you need a stack, because 
most compiler was based on a stack and if you have few function call 
imbricated with some expression evaluation you quickly overflow a 
register stack and you need to store data in memory and stack is the 
simplest way to do this.

> F-CPU is not MIPS : r63 is not hardwired in the instructions
> when a call or return is performed. We have the choice of using
> 63 registers for storing the return address. 8 of them can be used
> "statically", whatever their number, to reduce the re-fetching overhead.
> Same for data. It is simpler and faster to allocate 8 data and
> 8 instruction pointers, rather than trying to reuse the scheme
> used by other CPUs "because that's all people are used to".

I'm ok, but I don't want to remake thing made in other cpu, I just want 
to make a call convention that will be easy to use for most languages.
But I'll agree with you for internal call in programs.

> If somebody cares...

Yes I care...

Tom


-- 
Thomas Lavergne                       "Le vrai rêveur est celui qui rêve
                                        de l'impossible."  (Elsa Triolet)
thomas.lavergne@laposte.net
d-12@laposte.net    ICQ:#137121910     http://assoc.wanadoo.fr/thallium/

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