Description
Programming tools business unit of acmet explored about the market requirement for GNU Compiler porting. We believe that GNU Compiler open source might have good market in future. So we have decided to upgrade our skill in GNU Compiler porting.
We have decided to acquire the following skills.
- Port the GNU Compiler to new architecture
- Fix defects identified in GNU Compiler
As a first step it is decided that to acquire the porting skill. We have already developed the compiler for 32-bit/16-bit MIPS like processor. Since we have familiarity in MIPS like architecture and compiler technologies, we have decided to port the GNU Compiler for MIPS like processor.
The project is developed in incremental development model.
GNU Compiler porting work is split into multiple defined increments. This division of task enables concentrating on a small defined set of tasks at a time. GNU Compiler machine descriptions and the correlation between them are not easy to understand. For someone new to GNU Compiler porting, unless a systematic approach is used, the progress on development of machine descriptions can be really slow.
Normally, if we have to take an incremental approach for the porting task; we would have split the features such that each increment adds more target architecture specific features. But interestingly, we found that for the case of GNU Compiler machine descriptions, it is the increment in the source language which results in understandable increments in machine descriptions rather than increments in the target architecture.
So the increments are split based on 'C' language constructs. For each increment, the machine descriptions will cover the 'C' source constructs for that level ensuring the following:
- Successful compilation of any program,
- Correctness of the generated assembly program (if any generated needs to be verified manually)
After writing the machine descriptions for each increment, tests are written to verify the machine descriptions based on the language constructs supported in that increment.
The following increments are defined for porting GNU Compiler.
-
Second Increment
This increment has three sublevels which involve defining the mandatory macros. Assembly output is not produced in these levels.
Level 2.0
Making GNU Compiler recognize new target, identifying the mandatory macros and filling them with dummy values.
Level 2.1
Filling the mandatory macros with actual values required for porting (excluding the macros that deal with RTLs) GNU Compiler to target architecture.
Level 2.2
Filling the mandatory macros that use RTLs with actual values
-
Third Increment
This increment involves writing machine descriptions. They produce assembly output which needs to be verified manually.
Level 3.0
Write machine descriptions that support unconditional jump and move operations.
Level 3.1
Write machine descriptions that support arithmetic and shift instructions
Level 3.2
Support function prologue, function epilogue, function calls, relational operators & conditional branch.