|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.score.trans.Inlining
public final class Inlining
This class performs inlining.
$Id: Inlining.java,v 1.84 2007-10-04 19:58:36 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Inlining replaces routine calls by the code of the routine called. It ranks all routine calls across all routines and replaces the calls with inlined code in the order of that ranking.
The ranking depends on the nested loop depth of the call and the "cost" of the inlined code. The deeper the call is in a loop nest the more likely the call will be replaced by inlined code. The smaller the routine is the more likely it will be inlined. These metrics can be over-ridden by using profile-guided inlining.
Not all calls are replaced that satisfy the above criteria. No routine is inlined if the resultant module code size will exceed the bloat factor. No routine is inlined if a heuristic determines that the call is a poor choice to be replaced by an inlined routine.
Code Bloat: A floating point value, called the bloat factor, is used. This value is multiplied by the current module size prior to inlining to give the maximum size to which that the resultant module is allowed to grow. No routine call is replaced with an inlined routine if the result will cause the module to exceed the maximum size. Values for the bloat factor can be greater than or equal to 1.0. (If the value specified is less than 1.0, the value of 1.0 is used. Note - this may still allow some inlining if the inlined routine is smaller than the call overhead.)
Heuristics: The following heuristics are used to inhibit the replacement of a call by an inlined routine:
static
routines or variables is inlined. (Note: when
multi-compilation is used, the compiler converts all
static
routines and variables to globals.)
va_start()
.
int (*abc)()[2] = {ftn1, ftn2};
Field Summary | |
---|---|
static int |
callOverhead
Assumed cost, in instructions, of a subroutine call. |
static boolean |
classTrace
|
static boolean |
ignoreComplexityHeuristic
True if "complexity" heuristic for inhibiting the inlining of a routine should be ignored. |
static int |
simpleFtnLimit
Maximum size in instructions of a "simple" function. |
Constructor Summary | |
---|---|
Inlining(Suite suite,
boolean allowCrossModuleInlining)
Prepare for an inlining batch. |
Method Summary | |
---|---|
void |
displayStatus(java.io.PrintWriter cout)
|
protected VariableDecl |
genTemp(Type t,
Scribble scribble)
Create a new temporary variable for use by the optimized code. |
static int |
inlined()
Return the number of times inlining was performed. |
static int |
newCFGNodes()
Return the number of new nodes created. |
void |
optimize(double bloatFactor)
This is the main function for this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int callOverhead
public static int simpleFtnLimit
public static boolean ignoreComplexityHeuristic
public static boolean classTrace
Constructor Detail |
---|
public Inlining(Suite suite, boolean allowCrossModuleInlining)
suite
- the suite containing the procedures that will be
inlined and the list of globals that might be modifiedMethod Detail |
---|
public static int inlined()
public static int newCFGNodes()
public void optimize(double bloatFactor)
In order of decreasing priority, each call that can be inlined within the given code-bloat maximum is, until we run out of candidates or reach our minimum priority bound.
bloatFactor
- the level of inlining to be performed --
higher levels allow for more code bloatpublic void displayStatus(java.io.PrintWriter cout)
protected VariableDecl genTemp(Type t, Scribble scribble)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |