From 29a7156c6af8cf9d31cec4af250001fcf32e18ed Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 16 Apr 2009 17:28:32 +0000 Subject: [PATCH] another forward pass for mlp analysis --- Robust/src/Analysis/MLP/MLPAnalysis.java | 69 +++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 5abe02d7..f9c3a9ef 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -71,6 +71,15 @@ public class MLPAnalysis { computeReadAndWriteSetBackward( fsen ); } + seseItr = seseRoots.iterator(); + while( seseItr.hasNext() ) { + FlatSESEEnterNode fsen = seseItr.next(); + + // starting from roots do a forward, fixed-point + // variable analysis for refinement and stalls + variableAnalysisForward( fsen ); + } + 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 ); @@ -131,7 +140,6 @@ public class MLPAnalysis { // should already be analyzed and therefore can be skipped // because child SESE enter node has all necessary info Set flatNodesToVisit = new HashSet(); - //flatNodesToVisit.add( fsen ); FlatSESEExitNode fsexn = fsen.getFlatExit(); for( int i = 0; i < fsexn.numPrev(); i++ ) { @@ -191,6 +199,65 @@ public class MLPAnalysis { } + private void variableAnalysisForward( FlatSESEEnterNode fsen ) { + + Set flatNodesToVisit = new HashSet(); + flatNodesToVisit.add( fsen ); + + /* + while( !flatNodesToVisit.isEmpty() ) { + FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next(); + flatNodesToVisit.remove( fn ); + + if( fn.kind() == FKind.FlatSESEExitNode ) { + fn = ((FlatSESEExitNode)fn).getFlatEnter(); + } + + VarSrcTokTable prev = pointResults.get( fn ); + + // merge sets from control flow joins + VarSrcTokTable inUnion = new VarSrcTokTable(); + for( int i = 0; i < fn.numNext(); i++ ) { + FlatNode nn = fn.getNext( i ); + inUnion.merge( pointResults.get( nn ) ); + } + + VarSrcTokTable curr = analyzeFlatNodeBackward( fn, inUnion, fsen ); + + // if a new result, schedule backward nodes for analysis + if( !curr.equals( prev ) ) { + + pointResults.put( fn, curr ); + + // don't flow backwards past SESE enter + if( !fn.equals( fsen ) ) { + for( int i = 0; i < fn.numPrev(); i++ ) { + FlatNode nn = fn.getPrev( i ); + flatNodesToVisit.add( nn ); + } + } + } + } + + fsen.addInVarSet( pointResults.get( fsen ).get() ); + + if( state.MLPDEBUG ) { + System.out.println( "SESE "+fsen.getPrettyIdentifier()+" has in-set:" ); + Iterator tItr = fsen.getInVarSet().iterator(); + while( tItr.hasNext() ) { + System.out.println( " "+tItr.next() ); + } + System.out.println( "and out-set:" ); + tItr = fsen.getOutVarSet().iterator(); + while( tItr.hasNext() ) { + System.out.println( " "+tItr.next() ); + } + System.out.println( "" ); + } + */ + } + + private void analyzeFlatNodeForward( FlatNode fn, Stack seseStack ) { switch( fn.kind() ) { -- 2.34.1