On Mon, Nov 01, 2010 at 09:21:14PM +0800, Hui Yan Cheah wrote:
> Hi,
> 
> We are working on a new project which requires a retargetting a
> compiler to a small cpu on FPGA.
> The cpu is hand-coded and it supports only a limited number of instruction 
> sets.
> 
> My questions are:
> 
> 1. Since I have very limited experience with compilers (this is my
> first compiler project), is it wise to begin with gcc? I have
> googled-up smaller compilers like pcc, lcc and small-c and they seem
> like very good candidates. However, I would like to listen to the
> opinions of programmers who have worked with gcc or retargetted gcc.
> 
> 2. How much is the effort in retargetting compilers? I heard it took
> months but it all depends on the level of experience of the
> programmer. So if an experienced programmer took 2 month, it might
> have taken a beginner 6 months or so.

It really depends on the complexity of the machine and how much you know about
the RTL interface to the compiler.  It also depends on whether you also have to
do the assembler, linker, library and debugger, or if it is just the compiler
work.

Back in the day when I was doing new ports, I tended to estimate 3 months for
an initial port of a normal machine generating reasonable code that is passing
all of the test suites, etc.  However, generally within 1 month, I would be
generating code, but not all of the features targetted.  That assumes somebody
else did the assembler/linker/debugger/library.  However, note that I have been
working on GCC for quite some time, and have done at least 5 ports from
scratch, so you probably don't want to use my time estimates :-)

The more irregular/limited the machine is, the more it takes to get reasonable
code generation.

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meiss...@linux.vnet.ibm.com

Reply via email to