Compiling for template-based run-time code generation

  • Authors:
  • Frederick Smith;Dan Grossman;Greg Morrisett;Luke Hornof;Trevor Jim

  • Affiliations:
  • Dept. of Computer Science, 4130 Upson Hall, Cornell University, Ithaca, NY 14853 (e-mail: fms@cs.cornell.edu);Dept. of Computer Science, 4130 Upson Hall, Cornell University, Ithaca, NY 14853 (e-mail: danieljg@cs.cornell.edu);Dept. of Computer Science, 4130 Upson Hall, Cornell University, Ithaca, NY 14853 (e-mail: jgm@cs.cornell.edu);Transmeta Corporation, 3940 Freedom Circle, Santa Clara, CA 95054 (e-mail: hornof@transmeta.com);AT&T Research, 180 Park Avenue, PO Box 971, Florham Park, NJ 07932 (e-mail: trevor@research.att.com)

  • Venue:
  • Journal of Functional Programming
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

Cyclone is a type-safe programming language that provides explicit run-time code generation. The Cyclone compiler uses a template-based strategy for run-time code generation in which pre-compiled code fragments are stitched together at run time. This strategy keeps the cost of code generation low, but it requires that optimizations, such as register allocation and code motion, are applied to templates at compile time. This paper describes a principled approach to implementing such optimizations. In particular, we generalize standard flow-graph intermediate representations to support templates, define a mapping from (a subset of) Cyclone to this representation, and describe a dataflow-analysis framework that supports standard optimizations across template boundaries.