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

Re: Re: [f-cpu] New suggestion about call convention



Not very clear...

I did program with Z80 (I have a very old SHARP MZ-80K) not least 18 years
ago. Even if it has two exemplars of register set, it has only one stack at
once. So what is the meaning to sort recursive or non-recursive functions ?
it makes a sense to use a normal stack for recursive-stack but what about
non-recursive function ? due to the limit of register (8bit : A, B, C, D, E,
H, L; 16-bit : BC, DE, HL) it is very hard not to be forced to save those
registers into stacks. A push/pop rr takes 3 cycles and one instruction. A
ld rr,(nn)/ld (nn),rr takes 6 cycles and 4 instructions. And a ld r,(nn)/ld
(nn),r takes 4 cycles and. So you'd better to do "push bc" instead of doing
"ld bc,(nn)" or "ld b,(nn); ld c,(nn+1)" when possible. But because the
instruction set is rather restrictive about the use of each register, it was
very difficult for using them as callee-saver registers and not very
efficient comparing with the static global memory. But using static global
memory with F-CPU is nothing comprarable with a Z80 !?

It makes me crasy to think we can compare the power of a 64x64-bit registers
cpu with those poor registers of a Z80 (saying that, i keep a good souvenir
for it).

----- Original Message -----
From: <whygee@club-internet.fr>
To: <f-cpu@seul.org>
Sent: Wednesday, November 06, 2002 8:20 PM
Subject: Re: Re: [f-cpu] New suggestion about call convention


>De: ben franchuk <bfranchuk@jetnet.ab.ca>
>A: f-cpu@seul.org
>Sujet: Re: [f-cpu] New suggestion about call convention
>
>Michael Riepe wrote:
>
>> I have to admit that static (link-time) allocation and register masking
>> together will probably do even better. It also depends very much on the
>> code - the linker may have to take loops etc. into account when it
selects
>> the save/restore points. But in general, the `lazy save' algorithm
>> I outlined above should work pretty well.
>
>BYTE or Dr Dobb's  magazine a few years ago had a good idea when the
>Z80 was still a popular computer. Sort all subroutines into recursive
>and non-recursive piles. Recursive routines use normal stack addressing.
>Non-recursive routines would be sorted into the level of subroutine
>calls made, and static global memory would be alloted for the variables.
>Since the Z80/8080 does not have easy stack addresssing this idea could
>save time and space.

Makes a lot of sense. but ....
how many years ago was it ? ....
does gcc use this now ?

just curious,
YG

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

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