Retargeting compilers
Posted: Fri Sep 14, 2012 2:46 pm
Short story: How would I retarget a C/C++ compiler (any will do, but GCC to take the whole cake), to compile machine code that would run on a completely new CPU architecture?
Thing is, I like designing microprocessors, and I can make a (relatively) complete, albeit possibly inefficient, 8-bit one. I have complete understanding of it's instruction set and what can or cannot be done with the registers.
But how would I get an existing compiler to make code for it?
I tried looking for materials online about retargetting GCC, but it only confused me further. Apparently I need to make a "machine description" file (.md), and the code generator could handle it from there, but I have no idea how. Maybe I just suck at reading.
Any help on getting me started?
Thanks in advance.
Thing is, I like designing microprocessors, and I can make a (relatively) complete, albeit possibly inefficient, 8-bit one. I have complete understanding of it's instruction set and what can or cannot be done with the registers.
But how would I get an existing compiler to make code for it?
I tried looking for materials online about retargetting GCC, but it only confused me further. Apparently I need to make a "machine description" file (.md), and the code generator could handle it from there, but I have no idea how. Maybe I just suck at reading.
Any help on getting me started?
Thanks in advance.