}
+ // 4th pass
+ methItr = ownAnalysis.descriptorsToAnalyze.iterator();
+ while( methItr.hasNext() ) {
+ Descriptor d = methItr.next();
+
+ FlatMethod fm = state.getMethodFlat( d );
+
+ computeStallsForward( fm );
+ }
+
+
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 );
return vstTable;
}
+
+
+ private void computeStallsForward( FlatMethod fm ) {
+
+ // start from flat method top, visit every node in
+ // method exactly once
+ Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
+ flatNodesToVisit.add( fm );
+
+ Set<FlatNode> visited = new HashSet<FlatNode>();
+
+ while( !flatNodesToVisit.isEmpty() ) {
+ Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
+ FlatNode fn = fnItr.next();
+
+ flatNodesToVisit.remove( fn );
+ visited.add( fn );
+
+ Stack<FlatSESEEnterNode> seseStack = seseStacks.get( fn );
+ assert seseStack != null;
+
+ VarSrcTokTable vstTable = variableResults.get( fn );
+
+ computeStalls_nodeActions( fn, vstTable, seseStack.peek() );
+
+ for( int i = 0; i < fn.numNext(); i++ ) {
+ FlatNode nn = fn.getNext( i );
+
+ if( !visited.contains( nn ) ) {
+ flatNodesToVisit.add( nn );
+ }
+ }
+ }
+ }
+
+ private void computeStalls_nodeActions( FlatNode fn,
+ VarSrcTokTable vstTable,
+ FlatSESEEnterNode currentSESE ) {
+ switch( fn.kind() ) {
+
+ case FKind.FlatSESEEnterNode: {
+ FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
+ } break;
+
+ case FKind.FlatSESEExitNode: {
+ FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
+ } break;
+
+ default: {
+ Set<VariableSourceToken> stallSet =
+ vstTable.getStallSet( currentSESE );
+
+ System.out.println( fn+" should stall on\n "+stallSet+"\n" );
+ } break;
+
+ } // end switch
+ }
}
} \r
\r
\r
+ public Set<VariableSourceToken> getStallSet( FlatSESEEnterNode curr ) {\r
+\r
+ Set<VariableSourceToken> out = new HashSet<VariableSourceToken>();\r
+\r
+ Iterator<FlatSESEEnterNode> cItr = curr.getChildren().iterator();\r
+ while( cItr.hasNext() ) {\r
+ FlatSESEEnterNode child = cItr.next();\r
+ out.addAll( get( child ) );\r
+ }\r
+\r
+ return out;\r
+ }\r
+\r
+\r
public boolean equals( Object o ) {\r
if( o == null ) {\r
return false;\r