The BUILDER Library
A tool to construct or modify SUIF code within the SUIF compiler
Stanford Compiler Group
Overview
Builder Basics
Building Blocks
A Simple Example of What the Builder Can Do
main.cc
Makefile
Building the Compiler Pass
Testing the Compiler Pass
The Input File test.c
Test Session
The Output File test.sfx.c
Types
Type Creation
The Syntax of Type Strings
Base Types
Pointer Types
Array Types
Function Types
Structure and Union Types
Using Existing Type Structures
Examples
Example: Defining a Simple Array
Example: Defining Types for Functions and Structures
Type Grammar
Creating and Using Variables
Using Constant Values and Literals
Using Existing Variables from SUIF
Accessing a Field of a Structure
Pointer Operations
Array Accesses
Defining New Variables
Lables
Creating Expressions and Statements
Different Approaches to Creating Expression Trees
Using the Parser of the C++ Compiler.
Using Builder Functions and Operator Symbols
Using Builder Functions and the Builder's Operator Enumerations
Examples
A Simple Example
Example: In a Single Line
Example: A Single Composition at Each Step
Example: No Operator Overloading
Example: Using Operator Symbols
Example: Yet Another Method
Creating Code with Control Flow
FOR Loops
WHILE and DO Loops
Conditionals
Returning from a Function
Unstructured Control Flow
Examples
Creating and Initializing an Array
A Simple Sort
Searching a Linked List
Using Existing SUIF Code
Example of Mixing SUIF with Builder
Cloning
Creating SUIF Code
Example of Creating SUIF
Destination of the Results
Definitions in Include Files
Block Operations and Initialization
Constructing Expressions Using Operator Overloading
Constructing Expressions Using Explicit Function Calls
Operators
Values and Literals
Using Variables
Defining Variables and Generating New Type Definitions
Generating New Type Definitions
Defining Variables
Structured and Unstructured Control Flow
Incorporating Existing SUIF When Building New Structures
Generating SUIF Code
Miscellaneous Functions
Advanced Topics
Support for Debugging
Compile-time Error Checking
Run-Time Error Checking
Syntax and Semantic checking
Checking the Generated Code
Efficiency
Execution Efficiency
Memory Utilization and Memory Leaks
Function, Variable, and Type Index
Example Index
Concept Index