}
- // 4th pass
+ // 4th pass, compute liveness contribution from
+ // virtual reads discovered in variable pass
+ livenessResults = new Hashtable< FlatNode, Set<TempDescriptor> >();
+ livenessAnalysisBackward( rootSESE );
+
+
+ // 5th pass
methItr = ownAnalysis.descriptorsToAnalyze.iterator();
while( methItr.hasNext() ) {
Descriptor d = methItr.next();
FlatMethod fm = state.getMethodFlat( d );
+ // compute a plan for code injections
computeStallsForward( fm );
}
- // 5th pass, compute liveness contribution from
- // virtual reads discovered in stall pass
- livenessResults = new Hashtable< FlatNode, Set<TempDescriptor> >();
- livenessAnalysisBackward( rootSESE );
-
-
double timeEndAnalysis = (double) System.nanoTime();
double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) );
String treport = String.format( "The mlp analysis took %.3f sec.", dt );
assert currentSESE.getChildren().contains( fsen );
vstTable.remapChildTokens( fsen );
- Set<TempDescriptor> liveIn = livenessResults.get( fn );
+ Set<TempDescriptor> liveIn = currentSESE.getInVarSet();
Set<TempDescriptor> virLiveIn = vstTable.removeParentAndSiblingTokens( fsen, liveIn );
- Set<TempDescriptor> virLiveInNew = livenessVirtualReads.get( fn );
- if( virLiveInNew == null ) {
- virLiveInNew = new HashSet<TempDescriptor>();
+ Set<TempDescriptor> virLiveInOld = livenessVirtualReads.get( fn );
+ if( virLiveInOld != null ) {
+ virLiveIn.addAll( virLiveInOld );
}
- virLiveInNew.addAll( virLiveIn );
- livenessVirtualReads.put( fn, virLiveInNew );
+ livenessVirtualReads.put( fn, virLiveIn );
} break;
case FKind.FlatOpNode: {
} break;
default: {
- Set<VariableSourceToken> stallSet = vstTable.getStallSet( currentSESE );
-
-
- Set<TempDescriptor> liveIn = livenessResults.get( fn );
+ Set<VariableSourceToken> stallSet = vstTable.getStallSet( currentSESE );
+ Set<TempDescriptor> liveIn = currentSESE.getInVarSet();
if( liveIn != null ) {
stallSet.retainAll( liveIn );
// there is nothing live, clear all
stallSet.clear();
}
-
if( !stallSet.isEmpty() ) {
s = "STALL for:";
// of A as a source for that variable: s is virtual reads\r
protected void remove_A_if_B( FlatSESEEnterNode a, \r
FlatSESEEnterNode b,\r
- Set<TempDescriptor> liveIn,\r
+ Set<TempDescriptor> liveInCurrentSESE,\r
Set<TempDescriptor> virtualLiveIn ) {\r
\r
Set<VariableSourceToken> forRemoval = new HashSet<VariableSourceToken>();\r
forRemoval.add( vst );\r
\r
// mark this variable as a virtual read as well\r
- if( liveIn.contains( varLive ) ) {\r
- virtualLiveIn.add( varLive );\r
- }\r
+ //if( liveInCurrentSESE.contains( varLive ) ) { ???????????\r
+ virtualLiveIn.add( varLive );\r
+ //}\r
}\r
}\r
\r
+ /*\r
+ System.out.println( "remove "+a.getPrettyIdentifier()+" if "+b.getPrettyIdentifier() );\r
+ System.out.println( "THIS "+toStringPretty() );\r
+ System.out.println( "for removal="+forRemoval );\r
+ */\r
+\r
vstItr = forRemoval.iterator();\r
while( vstItr.hasNext() ) {\r
VariableSourceToken vst = vstItr.next();\r
public String toStringPretty() {\r
String tokHighlighter = "o";\r
\r
+ String str = "VarSrcTokTable\n";\r
+ Iterator<VariableSourceToken> vstItr = trueSet.iterator(); \r
+ while( vstItr.hasNext() ) {\r
+ str += " "+tokHighlighter+" "+vstItr.next()+"\n";\r
+ }\r
+ return str;\r
+ }\r
+\r
+ public String toStringPrettyVerbose() {\r
+ String tokHighlighter = "o";\r
+\r
String str = "VarSrcTokTable\n";\r
\r
Set s;\r