Sujet : Re: Computer architects leaving Intel...
De : david.brown (at) *nospam* hesbynett.no (David Brown)
Groupes : comp.archDate : 16. Sep 2024, 17:59:21
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vc9o5a$2uqam$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Mozilla Thunderbird
On 16/09/2024 17:34, Thomas Koenig wrote:
David Brown <david.brown@hesbynett.no> schrieb:
The GCC community would be quite happy to support such targets, but
someone would need to make the port. And the architecture of the gcc
compiler suite is best suited to processors with reasonably regular and
orthogonal ISAs with plenty of registers and at least 16-bit width -
getting good results for a cpu like the 6502 from gcc would be an
extraordinary level of effort. It makes a lot more sense to look at
tools like SDCC with an architecture that fits better.
Native compilation of gcc on a 6502 would be... interesting.
The 6502 would be a target, rather than a host!
Of course there were C compilers, and many other languages, running on the 6502 BBC Micro and BBC Master computers. But those tools were a bit more compact that gcc :-)
But I think an adaption of gcc to a 6502 could actually work if
the zero page was treated as 128 16-bit registers. Not going
there, though :-)
That would be a starting point, yes. But I would not use the whole zero page there - perhaps just the first 32 bytes (and therefore 16 16-bit registers). Having a huge register bank would make function calls tough when you have to stack all the callee-saved registers in your one-page stack!
With 16 register pairs, you would get you close to how the AVR is treated in gcc - it has 32 8-bit registers which are, for many purposes, handled in pairs by the compiler. (Lowering ALU operations on 16-bit register pairs to 8-bit operations on single registers is done mostly as peephole optimisations at the backend.)
Someone did manage to get Linux running on an 8-bit AVR (by having the AVR run an ARM emulator, and using ARM Linux). I'm sure the same technique could be used to host Linux on a 6502 and run gcc on it, though you might not consider that "native". And "run" might be a bit of a misnomer - the AVR was a lot faster than a 6502, and it took 6 hours to boot to login.
<
https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bit>