|
|||||||||
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.AASR
public class AASR
This class replaces array element address calculations in a loop with simple additions.
$Id: AASR.java,v 1.57 2007-10-04 19:58:35 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The array address strength reduction optimization attempts to replace the complex array element address calculation with a simple addition. For example, consider the loop
for (int i = 0; i < n; i++) a(i) =AASR transforms this to
int *add = &a[0]; for (int i = 0; i < n; i++) { *add = add = ((char *) add) + sizeof(int); }which eliminates the multiplication, of the loop induction variable by the size of the array element, which would normally occur on each iteration. Arrays of higher rank result in even more savings because their array element address calculation requires more multiplies and additions.
Note that if the array is referenced in the loop in some manner
that can't be transformed, then register pressure has been increased
by one register (e.g., add
). And, even though the
induction variable is no longer referenced for each array access,
it is still needed for the loop termination test.
A transformation is legal
if:
beneficial
if:
maxLoopSize
, and
Field Summary | |
---|---|
static boolean |
classTrace
True if traces are to be performed. |
static int |
maxLoopSize
Maximum loop size in CFG nodes. |
static boolean |
useHeuristics
If true, use heuristics that prune the cases where the optimization is applied. |
static boolean |
useSizeof
Set true to use the sizeof() instead of the machine
specific array element size in addressable units. |
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 | |
---|---|
AASR(Scribble scribble)
|
Method Summary | |
---|---|
static int |
newCFGNodes()
Return the number of new nodes created. |
void |
perform()
Do strength reduction of array accesses. |
static int |
replaced()
Return the current number of array loads replaced. |
Methods inherited from class scale.score.trans.Optimization |
---|
assertTrace, assertTrace, assertTrace, assertTrace, assertTrace, genTemp, insertStores, requiresSSA, 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 useSizeof
sizeof()
instead of the machine
specific array element size in addressable units.
public static int maxLoopSize
Constructor Detail |
---|
public AASR(Scribble scribble)
Method Detail |
---|
public static int replaced()
public static int newCFGNodes()
public void perform()
perform
in class Optimization
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |