}
- // 2nd pass
+ // 2nd pass, results are saved in FlatSESEEnterNode, so
+ // intermediate results, for safety, are discarded
livenessAnalysisBackward( rootSESE );
+ livenessResults = null;
// 3rd pass
// 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
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( "" );
}
}
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();
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 ) {
treeNode = sn;
children = new HashSet<FlatSESEEnterNode>();
inVars = new HashSet<TempDescriptor>();
- outVars = new HashSet<VariableSourceToken>();
+ outVars = new HashSet<TempDescriptor>();
}
public void rewriteUse() {
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 );
}
return inVars;
}
- public Set<VariableSourceToken> getOutVarSet() {
+ public Set<TempDescriptor> getOutVarSet() {
return outVars;
}