OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:33 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Retargeting compilers
PostPosted: Fri Sep 14, 2012 2:46 pm 
Offline

Joined: Sat Aug 29, 2009 3:33 pm
Posts: 7
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.


Top
 Profile  
 
 Post subject: Re: Retargeting compilers
PostPosted: Sun Sep 16, 2012 1:40 pm 
Offline
Member
Member
User avatar

Joined: Tue Jul 10, 2007 5:27 am
Posts: 2935
Location: York, United Kingdom
dozniak wrote:
Take LLVM, look at their targets implementation, write some tablegen templates. Then implement some lowering passes, but if you architecture is anywhere near standard, you will most probably just adopt the existing ones.


I'd suggest you don't even go there. LLVM does not and does not intend to support any architecture with a bitwidth of less than 32 bytes. An 8-bit microcontroller would be a pain in the arse to develop an LLVM backend for.

_________________
Horizon - a framework and language for SAS-OS development
Project 'Pedigree'
Practical x86 OSDev tutorials


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group