[HN Gopher] A project to port LLVM to the MOS 6502
___________________________________________________________________
A project to port LLVM to the MOS 6502
Author : tempodox
Score : 11 points
Date : 2021-05-29 11:52 UTC (11 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| NobodyNada wrote:
| The 6502 is notoriously difficult to write a compiler for because
| it has only three general-purpose registers and it doesn't have a
| stack-relative addressing mode, meaning there's not really an
| efficient way to implement local variables.
|
| When writing 6502 assembly by hand, you usually just create a few
| global variables as "temporaries" for storage, parameter passing,
| etc. and you write your code carefully to make sure any
| subroutines you call don't try to use a temporary you're already
| using, or anything like that. Obviously, this doesn't look
| anything like idiomatic C.
|
| For this reason, I'm really interested in seeing what kind of
| code this generates and how it performs, especially compared to
| the dominant 6502 compiler cc65 (https://cc65.github.io/).
___________________________________________________________________
(page generated 2021-05-29 23:02 UTC)