A Simple and a Retargetable Code Generator for TCGS
Theo C. Ruys
Abstract
Theo C. Ruys
Abstract
The Twente Compiler Generator System (TCGS) is a parser-generator system which is typically used to generate a compiler that, given an input program, generates abstract stack code. A code generator for TCGS translates this stack code generated by a TCGS compiler to assembler code for a particular target machine. This thesis discusses two code generators for TCGS: GUMP and COGGEN. The simplest strategy to translate stack code into assembler code is to macro expand each stack code instruction to an equivalent sequence of assembler code instructions. This simple strategy is used in the code generator GUMP. COGGEN, which stands for Code-Generator Generator, is a retargetable code generator. The intermediate language used in COGGEN modules is the Register Transfer Language (RTL). COGGEN consists of several modules. COGGEN’s expander translates abstract stack code of the TCGS compiler to RTL-code. COGGEN’s assigner maps the temporaries in the RTL-code upon machine registers of the target machine. From a machine description, COGGEN’s transformer builds the transducer, an automaton which translates RTL-code to assembler code for the target machine. Both code generators are implemented for Intel’s 8086 microprocessor. Code generated with GUMP86 is 40 times faster than TCGS’ interpreter and code generated with COGGEN86 is roughly 65 times faster than TCGS’ interpreter.
A significance statement is not available in the OpenAlex record.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
The Twente Compiler Generator System (TCGS) is a parser-generator system which is typically used to generate a compiler that, given an input program, generates abstract stack code. A code generator for TCGS translates this stack code generated by a TCGS compiler to assembler code for a particular target machine. This thesis discusses two code generators for TCGS: GUMP and COGGEN. The simplest strategy to translate stack code into assembler code is to macro expand each stack code instruction to an equivalent sequence of assembler code instructions. This simple strategy is used in the code generator GUMP. COGGEN, which stands for Code-Generator Generator, is a retargetable code generator. The intermediate language used in COGGEN modules is the Register Transfer Language (RTL). COGGEN consists of several modules. COGGEN’s expander translates abstract stack code of the TCGS compiler to RTL-code. COGGEN’s assigner maps the temporaries in the RTL-code upon machine registers of the target machine. From a machine description, COGGEN’s transformer builds the transducer, an automaton which translates RTL-code to assembler code for the target machine. Both code generators are implemented for Intel’s 8086 microprocessor. Code generated with GUMP86 is 40 times faster than TCGS’ interpreter and code generated with COGGEN86 is roughly 65 times faster than TCGS’ interpreter.
Key concepts: Computer science, Object code, Unreachable code, Code generation, Dead code, Programming language, Compiler, Redundant code