|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.kjc.sir.lowering.StaticsProp
public class StaticsProp
StaticsProp propagates constants from 'static' sections.
StaticsProp.propagate does all the work.
This pass is expected to be run after lowering.RenameAll but before any other lowering pass.
This pass is currently written under the simplfying assumption that every static section can be unwound to be assignments of constants to fields -- so no field depends on the value of any other field. If this assumption does not hold, then we need to create a joint back-slice of the static code for each filter that we are propagating into.
We also make the (semantically correct, but possibly inefficient) decision to propagate the static information to each filter or combiner that uses it. If the static fields can not be removed by constant propagation, we should instead probably make one copy per physical location in the final program. This is difficult because we want StaticsProp run early in the backends, while physical locations are often not assigned until very late in the backends. We support cleaning up duplications of propagated static values in later phases by providing information relating the names of the propagated static fields. Later fusion of multiple filters and combiners for execution on a single computation node can take advantage of this information to remove duplicates.
Nested Class Summary | |
---|---|
static class |
StaticsProp.IterOverAllFieldsAndMethods
Methods to iterate a EmptyAttributeVisitor over all fields / methods / parameters of a stream, or of a subgraph of the stream graph. |
Method Summary | |
---|---|
static Map<String,Set<String>> |
propagate(SIRStream str,
Set<SIRGlobal> theStatics)
The top-level for propagating data from static sections into the stream graph. |
static void |
shareStaticVars(SIRCodeUnit codeUnit,
Map<String,Set<String>> prefixAssociations)
Share all propagated statics in a SIRCodeUnit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Map<String,Set<String>> propagate(SIRStream str, Set<SIRGlobal> theStatics)
Of course, for some static data -- using a static section to set parameters, or push, peek, or pop rates -- it is necessary that the static data be constants that can be propagated to place with FieldProp in the streams.
Warning: if fusing filters with control constructs, please note that information from static sections appears in filters as fields so that multiple phases (even just init and work) have access to the values. In containers the information appears as local variables. The reason for the difference is that field propagation does not propagate information far enough for containers, so we need to use constant prop based on constant values of local variables. This presents a non-uniform interface for using the returned map.
str
- The stream programtheStatics
- a set of static sections that need to be propagated through
the stream.
public static void shareStaticVars(SIRCodeUnit codeUnit, Map<String,Set<String>> prefixAssociations)
codeUnit
- A code unit that can refer to any static variable under several names.prefixAssociations
- The map returned from propagate
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |