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

Re: [f-cpu] Register allocation when calling a function



hello,

cedric wrote:
> Nobody reply to your post, but I think it's very important to include this
> recommandation into the manual for those who want to implement a compiler
> or code in F-CPU ASM.
<snip>
> > You overlooked the fact that `var' parameters in Pascal are actually
> > pointers, although they don't look that way. The same is true for
> > reference types in C++.
> That depend on your compiler, no ?
> 
> So who disagree with adding this recommandation into the manual ?

I don't disagree (if it is needed, then it's not a bad thing to put it).

However, i wouldn't make this mandatory.

My reasoning behind this is : call/return conventions are designed for
computers of the 80's and 90's with 16 or 32 registers, F-CPU has twice more.
It sounds simple to simply double all numbers but this sounds like using
old methods for new computers : you can't win much there.

Today's most advanced compilers can perform in-depth analysis of the programs
and find the (mostly) optimal register allocation : they examine the data life length
and their usage statistics, decide whether and how long to put (swap) them in memory
and even modify other parts of the program to enhance the register reuse.

If there was a mandatory allocation, these advanced compilers (something that
looks like a "synthesiser" in the ASIC world) won't be able to compile anything
more than leaf functions. That would be pretty useless.

I hope to be not too much misunderstood,

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