[cfe-dev] Re-targeting clang to a new architecture

Douglas Gregor dgregor at apple.com
Wed Apr 28 07:50:16 PDT 2010


On Apr 28, 2010, at 12:09 AM, Ned Gill wrote:

> 
> Hi all.
> 
> I'm contemplating re-targeting clang to a new architecture.  Initially I'd  
> like to just port the front end as a static analysis tool to use alongside  
> our existing GCC based toolchain, but ultimately I'd like to write a code  
> generator too.  Unfortunately my architecture has a couple of wrinkles  
> that sometimes make life hard for compilers:
> 
> CHAR_BIT is 16 (i.e. the minimum addressable unit of memory is 16 bits)
> It's a Harvard architecture with 16 bit data pointers and 24 bit function  
> pointers.
> 
> Does anyone have any thoughts on how difficult it would be to target clang  
> to this sort of architecture - just as a front end (for now)?


This came up on the list about 6 months ago, and the consensus was that it would be fairly tricky to do, since the "8 bits per char/byte" assumption pervades Clang and LLVM:

	http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-September/006349.html

Since then, there has been some work to make Clang depend on the target's character width rather than assuming it is 8 bits, so the situation has improved. I still expect it to be fairly tricky, but you aren't the only one interested in working on this particular issue in Clang.

	- Doug



More information about the cfe-dev mailing list