Generating Code for High-Level Operations through Code Composition

Abstract

A traditional compiler translates each expression or statement in a high-level language into a sequence of lower-level target statements (e.g., operations in an intermediate representation, or machine instructions), in a manner fixed by the compiler writer. The output is then subject to further optimization. This compilation strategy is called custom code generation, as the compiler generates custom code for each input construct. An alternative strategy is to generate a call to a runtime library for each high-level language construct. This approach is attractive if the source language contains complex, powerful constructs, like the distributed array assignment statement in High Performance FORTRAN (HPF). The decision between custom code generation and use of a runtime library involves tradeoffs between efficiency (performance of the generated code), maintainability (ease of developing and maintaining the algorithm), and generality (implementation of the general case, rather than merely a simplified canonical case). I introduce a new compilation strategy, high-level code composition, which combines the advantages of custom code generation and runtime libraries. The compilation of each construct is controlled by code templates, which contain both target code to be generated and compile-time control instructions that specify how the templates are composed together. The templates are external to the compiler, making them easy to write and modify.

Open PDF

Document Details

Document Type
Technical Report
Publication Date
Aug 01, 1997
Accession Number
ADA329934

Entities

People

  • James M. Stichnoth

Organizations

  • Carnegie Mellon University

Tags

Communities of Interest

  • Energy and Power Technologies

DTIC Thesaurus Topics

  • Algorithms
  • Application Software
  • Basic Programming Language
  • C Programming Language
  • Computer Programming
  • Computer Programs
  • Computer Science
  • Computers
  • Control Systems
  • Debugging
  • Grammars
  • High Level Languages
  • Language
  • Linguistics
  • Programming Languages
  • Relational Databases
  • Three Dimensional

Fields of Study

  • Computer science
  • Engineering

Readers

  • Computational Linguistics
  • Parallel and Distributed Computing.