|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.score.trans.Optimization scale.score.trans.TreeHeight
public class TreeHeight
Perform expression tree height reduction on a Scribble graph.
$Id: TreeHeight.java,v 1.25 2007-02-28 18:00:38 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The tree height reduction optimization attempts to improve the
performance of individual expressions by allowing more operations
to be performed in parallel. For eample, consider the expression
(a + (b + (c + d)))
. Using this order of precedence,
the three addition operations must be performed sequentially. If
the expression is transformed to ((a + b) + (c + d))
then two of the additons may be performed simultaneously. This
will benefit superscalar architectures.
In this example, the two expressions are equivalent. However, on a digital computer using floating point operations, these two expressions may result in two different values because floating point addition is not associative.
Note also that to calculate the value of the first expression requires only five registers. One is used to hold the sum and the others hold the values of the variables. Six registers are required for the second expression as a partial sum must be kept while the other partial sum is calculated. (The number of registers required actually depends on which variables have been allocated to registers.) The net result is an increase in register pressure.
A transformation is legal
if:
beneficial
if
it is legal.
Field Summary | |
---|---|
static boolean |
classTrace
True if traces are to be performed. |
static boolean |
doHuffman
Use Huffman coding weight balancing. |
static boolean |
useHeuristics
If true, use heuristics that prune the cases where the optimization is applied. |
Fields inherited from class scale.score.trans.Optimization |
---|
dChanged, fpReorder, hasDummyAliases, IN_SSA, minimumExecutionCost, NA_SSA, NO_SSA, rChanged, scribble, signedIntsWrapOnOverflow, trace, un, unsafe, unsignedIntsWrapOnOverflow, VALID_SSA |
Constructor Summary | |
---|---|
TreeHeight(Scribble scribble)
|
Method Summary | |
---|---|
void |
perform()
Find and reduce the height of expression trees |
int |
requiresSSA()
Return whether this optimization requires that the CFG be in SSA form. |
static int |
treesReduced()
Return the number of expression trees found |
Methods inherited from class scale.score.trans.Optimization |
---|
assertTrace, assertTrace, assertTrace, assertTrace, assertTrace, genTemp, insertStores, setTrace, sort |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean classTrace
public static boolean useHeuristics
public static boolean doHuffman
Constructor Detail |
---|
public TreeHeight(Scribble scribble)
scribble
- is the CFG transformed by tree height reductionMethod Detail |
---|
public static int treesReduced()
public void perform()
perform
in class Optimization
public int requiresSSA()
requiresSSA
in class Optimization
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |