harpoon.Analysis.Tree
Class Simplification

java.lang.Object
  extended by harpoon.Analysis.Tree.Simplification
Direct Known Subclasses:
AlgebraicSimplification, Canonicalize, DeadCodeElimination, DynamicWBTreePass, GCTraceStore, HeapCheckAdder, InsertWriteBarrier, JumpOptimization, MakeGCThreadSafe, MemHoisting, WriteBarrierConstElim, WriteBarrierPostPass, WriteBarrierTreePass

public abstract class Simplification
extends Object

Simplification is a general-purpose simplification engine for trees. Warning: this performs modifications on the tree form in place.

Version:
$Id: Simplification.java,v 1.4 2002/04/10 03:02:06 cananian Exp $
Author:
Duncan Bryce <duncan@lcs.mit.edu>

Nested Class Summary
static class Simplification.Rule
          A simplification rule for use with the tree simplifier.
 
Field Summary
protected static int _ADD
           
protected static int _ALIGN
           
protected static int _AND
           
protected static int _BINOP
           
protected static int _CALL
           
protected static int _CJUMP
           
protected static int _CMPEQ
           
protected static int _CMPGE
           
protected static int _CMPGT
           
protected static int _CMPLE
           
protected static int _CMPLT
           
protected static int _CMPNE
           
protected static int _CONST
           
protected static int _CONST0
           
protected static int _CONST1
           
protected static int _CONSTm1
           
protected static int _CONSTNULL
           
protected static int _DATUM
           
protected static int _DIV
           
protected static int _ESEQ
           
protected static int _EXPR
           
protected static int _JUMP
           
protected static int _LABEL
           
protected static int _MEM
           
protected static int _METHOD
           
protected static int _MOVE
           
protected static int _MUL
           
protected static int _NAME
           
protected static int _NATIVECALL
           
protected static int _OR
           
protected static int _REM
           
protected static int _RETURN
           
protected static int _SEGMENT
           
protected static int _SEQ
           
protected static int _SHL
           
protected static int _SHR
           
protected static int _TEMP
           
protected static int _THROW
           
protected static int _UNOP
           
protected static int _USHR
           
protected static int _XOR
           
 
Constructor Summary
protected Simplification()
           
 
Method Summary
protected static int _KIND(Tree t)
           
protected static int _OP(int op)
           
static HCodeFactory codeFactory(HCodeFactory parent, List<Simplification.Rule> rules)
          Code factory for applying a set of simplification rules to tree form.
protected static boolean contains(int val, int mask)
          Convenience function to test whether any of the bits in mask are set in val.
static void simplify(Tree root, DerivationGenerator dg, List<Simplification.Rule> rules)
          Performs simplification on root, using the specified set of simplification rules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_CMPLT

protected static final int _CMPLT
See Also:
Constant Field Values

_CMPLE

protected static final int _CMPLE
See Also:
Constant Field Values

_CMPEQ

protected static final int _CMPEQ
See Also:
Constant Field Values

_CMPNE

protected static final int _CMPNE
See Also:
Constant Field Values

_CMPGE

protected static final int _CMPGE
See Also:
Constant Field Values

_CMPGT

protected static final int _CMPGT
See Also:
Constant Field Values

_ADD

protected static final int _ADD
See Also:
Constant Field Values

_MUL

protected static final int _MUL
See Also:
Constant Field Values

_DIV

protected static final int _DIV
See Also:
Constant Field Values

_REM

protected static final int _REM
See Also:
Constant Field Values

_SHL

protected static final int _SHL
See Also:
Constant Field Values

_SHR

protected static final int _SHR
See Also:
Constant Field Values

_USHR

protected static final int _USHR
See Also:
Constant Field Values

_AND

protected static final int _AND
See Also:
Constant Field Values

_OR

protected static final int _OR
See Also:
Constant Field Values

_XOR

protected static final int _XOR
See Also:
Constant Field Values

_ALIGN

protected static final int _ALIGN
See Also:
Constant Field Values

_BINOP

protected static final int _BINOP
See Also:
Constant Field Values

_CALL

protected static final int _CALL
See Also:
Constant Field Values

_CJUMP

protected static final int _CJUMP
See Also:
Constant Field Values

_CONST

protected static final int _CONST
See Also:
Constant Field Values

_DATUM

protected static final int _DATUM
See Also:
Constant Field Values

_ESEQ

protected static final int _ESEQ
See Also:
Constant Field Values

_EXPR

protected static final int _EXPR
See Also:
Constant Field Values

_JUMP

protected static final int _JUMP
See Also:
Constant Field Values

_LABEL

protected static final int _LABEL
See Also:
Constant Field Values

_MEM

protected static final int _MEM
See Also:
Constant Field Values

_METHOD

protected static final int _METHOD
See Also:
Constant Field Values

_MOVE

protected static final int _MOVE
See Also:
Constant Field Values

_NAME

protected static final int _NAME
See Also:
Constant Field Values

_NATIVECALL

protected static final int _NATIVECALL
See Also:
Constant Field Values

_RETURN

protected static final int _RETURN
See Also:
Constant Field Values

_SEGMENT

protected static final int _SEGMENT
See Also:
Constant Field Values

_SEQ

protected static final int _SEQ
See Also:
Constant Field Values

_TEMP

protected static final int _TEMP
See Also:
Constant Field Values

_THROW

protected static final int _THROW
See Also:
Constant Field Values

_UNOP

protected static final int _UNOP
See Also:
Constant Field Values

_CONSTNULL

protected static final int _CONSTNULL
See Also:
Constant Field Values

_CONSTm1

protected static final int _CONSTm1
See Also:
Constant Field Values

_CONST0

protected static final int _CONST0
See Also:
Constant Field Values

_CONST1

protected static final int _CONST1
See Also:
Constant Field Values
Constructor Detail

Simplification

protected Simplification()
Method Detail

codeFactory

public static HCodeFactory codeFactory(HCodeFactory parent,
                                       List<Simplification.Rule> rules)
Code factory for applying a set of simplification rules to tree form. Clones the tree before simplifying it in-place.


simplify

public static void simplify(Tree root,
                            DerivationGenerator dg,
                            List<Simplification.Rule> rules)
Performs simplification on root, using the specified set of simplification rules. Requires:
  1. root is a tree.
  2. Each element of rules is an implementation of the Simplification.Rule interface.
  3. The supplied set of rules monotonically reduces all possible Tree objects to some fixed point.

Parameters:
root - the tree to simplify
dg - a DerivationGenerator for the tree, or null to generate no type information.
rules - the set of simplification rules to apply to the elements of root.

contains

protected static boolean contains(int val,
                                  int mask)
Convenience function to test whether any of the bits in mask are set in val.


_KIND

protected static int _KIND(Tree t)

_OP

protected static int _OP(int op)