LANCE C Compiler System

Motivation

  • Designing a C compiler from scratch requires huge manpower
  • Existing compiler systems are frequently restricted to certain processors or are difficult to adapt to new processors

 

Objectives

  • Provide a light-weight, extensible and easy-to-use C compiler development system for
    • Research
    • Teaching
  • Retargetable code generation

 

Project description

LANCE comprises a C++ class library with basic data structures and algorithms (e.g. flow analysis) needed in compilers as well as several tools. The ANSI C frontend compiles source code into a simple three address code intermediate representation (IR). A modular suite of IR optimization tools can be used to improve code quality. The backend interface converts the IR into a data flow graph representation for assembly code generation.

IR format

The LANCE three address code IR is defined as a subset of ANSI C. The IR format is common to all LANCE optimization tools which work in a "plug-and-play" fashion. By inheriting the IR semantics from ANSI C, the IR gets easy to understand and thus enables extensions of the system with custom optimizations. Since the IR can be compiled by any ANSI C compiler, validation of new IR optimization tools can be performed on a host machine without the need for a target specific backend or instruction set simulator.

For more information concerning this project, please visit: