harpoon.Tools.PatMat
Class MaximalMunchCGG

java.lang.Object
  extended by harpoon.Tools.PatMat.CodeGeneratorGenerator
      extended by harpoon.Tools.PatMat.MaximalMunchCGG

public class MaximalMunchCGG
extends CodeGeneratorGenerator

MaximalMunchCGG finds an optimal tiling of instructions on a Tree-IR. This Code Generator Generator produces Code Generators that use the Maximal Munch algorithm to find an optimal tiling for an input tree. See Appel "Modern Compiler Implementation in Java", Section 9.1 for a description of Maximal Munch.

Version:
$Id: MaximalMunchCGG.java,v 1.4 2002/04/10 03:06:53 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Field Summary
 
Fields inherited from class harpoon.Tools.PatMat.CodeGeneratorGenerator
spec
 
Constructor Summary
MaximalMunchCGG(Spec s, String className)
          Creates a MaximalMunchCGG.
 
Method Summary
 void outputSelectionMethod(PrintWriter out, boolean isData)
          Writes the Instruction Selection Method to out.
protected  String producedClassType()
          Returns the fully qualified name of the superclass of the generated CodeGen.
 
Methods inherited from class harpoon.Tools.PatMat.CodeGeneratorGenerator
outputJavaFile, returnCodeStatements, returnDataStatements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MaximalMunchCGG

public MaximalMunchCGG(Spec s,
                       String className)
Creates a MaximalMunchCGG.
requires:
  1. s follows the standard template for defining a machine specification.
  2. className is a legal Java identifier string for a class.
  3. For each node-type in the Tree IR, there exists a single-node tile pattern (TODO: I took this 'requirement' straight from Appel, but it can't REALLY be that strict. Find a tighter requirement that we can actually satisfy)
  4. if s contains Java statements that rely on knowledge about the class to be produced (such as a Constructor implementation) then the class named must match the className parameter.

effects: Creates a new MaximalMunchCGG and associates the machine specification s with the newly constructed MaximalMunchCGG.

See Also:
Standard Specification Template
Method Detail

producedClassType

protected String producedClassType()
Description copied from class: CodeGeneratorGenerator
Returns the fully qualified name of the superclass of the generated CodeGen. The superclass should be a subclass of Generic.CodeGen (or Generic.CodeGen itself.

Specified by:
producedClassType in class CodeGeneratorGenerator

outputSelectionMethod

public void outputSelectionMethod(PrintWriter out,
                                  boolean isData)
Writes the Instruction Selection Method to out.
modifies: out
effects: Generates Java source for a MaximalMunch instruction selection method, not including method signature or surrounding braces. Outputs generated source to out.

Specified by:
outputSelectionMethod in class CodeGeneratorGenerator
Parameters:
out - Target output device for the Java source code.
isData - indicates if we're pattern matching code or data tables