stable, something still wrong with calculating out-sets
authorjjenista <jjenista>
Wed, 29 Apr 2009 23:59:09 +0000 (23:59 +0000)
committerjjenista <jjenista>
Wed, 29 Apr 2009 23:59:09 +0000 (23:59 +0000)
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/IR/Flat/FlatSESEEnterNode.java

index ec22eb0b1825defaea8ce1de7c100b5ee9bed827..17ed7a27b2d62867967b192d19929e7754837947 100644 (file)
@@ -71,8 +71,10 @@ public class MLPAnalysis {
     }
 
 
-    // 2nd pass
+    // 2nd pass, results are saved in FlatSESEEnterNode, so
+    // intermediate results, for safety, are discarded
     livenessAnalysisBackward( rootSESE );
+    livenessResults = null;
 
 
     // 3rd pass
@@ -90,7 +92,8 @@ public class MLPAnalysis {
     // 4th pass, compute liveness contribution from
     // virtual reads discovered in variable pass
     livenessResults = new Hashtable< FlatNode, Set<TempDescriptor> >();
-    livenessAnalysisBackward( rootSESE );
+    livenessAnalysisBackward( rootSESE );        
+    livenessResults = null;
 
 
     // 5th pass
@@ -265,6 +268,11 @@ public class MLPAnalysis {
       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( "" );
     }
   }
@@ -275,10 +283,24 @@ public class MLPAnalysis {
     switch( fn.kind() ) {
       
     default: {
+      VarSrcTokTable table = variableResults.get( fn );
+
       // handle effects of statement in reverse, writes then reads
       TempDescriptor [] writeTemps = fn.writesTemps();
       for( int i = 0; i < writeTemps.length; ++i ) {
        liveIn.remove( writeTemps[i] );
+
+        if( table != null ) {
+          Iterator<VariableSourceToken> vstItr = table.get( writeTemps[i] ).iterator();
+          while( vstItr.hasNext() ) {
+            VariableSourceToken vst = vstItr.next();
+
+            if( !vst.getSESE().equals( currentSESE ) ) {
+              currentSESE.addOutVar( writeTemps[i] );
+              break;
+            }
+          }
+        }
       }
 
       TempDescriptor [] readTemps = fn.readsTemps();
index b1f81e92cfa677f04780bd73c2d6d6a127e3e747..11da4cb8c10e4246334edaf563c64b52807840a6 100644 (file)
@@ -11,7 +11,7 @@ public class FlatSESEEnterNode extends FlatNode {
   protected FlatSESEEnterNode parent;
   protected Set<FlatSESEEnterNode> children;
   protected Set<TempDescriptor> inVars;
-  protected Set<VariableSourceToken> outVars;
+  protected Set<TempDescriptor> outVars;
   protected FlatMethod enclosing;
 
   public FlatSESEEnterNode( SESENode sn ) {
@@ -19,7 +19,7 @@ public class FlatSESEEnterNode extends FlatNode {
     treeNode = sn;
     children = new HashSet<FlatSESEEnterNode>();
     inVars   = new HashSet<TempDescriptor>();
-    outVars  = new HashSet<VariableSourceToken>();
+    outVars  = new HashSet<TempDescriptor>();
   }
 
   public void rewriteUse() {
@@ -48,15 +48,15 @@ public class FlatSESEEnterNode extends FlatNode {
     inVars.add( td );
   }
 
-  public void addOutVar( VariableSourceToken vst ) {
-    outVars.add( vst );
+  public void addOutVar( TempDescriptor td ) {
+    outVars.add( td );
   }
 
   public void addInVarSet( Set<TempDescriptor> s ) {
     inVars.addAll( s );
   }
 
-  public void addOutVarSet( Set<VariableSourceToken> s ) {
+  public void addOutVarSet( Set<TempDescriptor> s ) {
     outVars.addAll( s );
   }
 
@@ -64,7 +64,7 @@ public class FlatSESEEnterNode extends FlatNode {
     return inVars;
   }
 
-  public Set<VariableSourceToken> getOutVarSet() {
+  public Set<TempDescriptor> getOutVarSet() {
     return outVars;
   }