Top Up Prev Next Bottom Contents Index Search

Chapter 16. Base Code Generation Domain and Supporting Classes

Authors: Soonhoi Ha
Other Contributors: Michael C. Williamson
This chapter explains the base classes for code generation, which are found in the $PTOLEMY/src/domains/cg/kernel directory. Not all classes in that directory are covered in this document. We instead concentrate on how to generate and organize the code, and which methods to use. There is a basic code generation domain, designated CG, from which other code generation domains are derived. The CG domain can be used by itself for the purpose of studying issues in control constructs and scheduling, without needing to generate code in any particular programming language.

A segment of code is formed in an instance of class CodeStream. Each CGTarget will have a list of CodeStreams, and will assemble them to generate the final code. A CGStar uses instances of class CodeBlock to form a code segment, which can be added to a CodeStream of the CGTarget after some processing.

A set of macros are defined which a star programmer may use in order to refer to variables without being concerned about resource allocation. For example, we may refer to the portholes of a star without knowing what physical resources are allocated to them.

Top Up Prev Next Bottom Contents Index Search
Copyright © 1990-1997, University of California. All rights reserved.