From 42949358a3b6d574838d4d490d8c9eb0fb23a315 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 27 Jun 2009 00:04:15 +0000 Subject: [PATCH] improve code generation --- .../Analysis/Locality/DelayComputation.java | 27 ++++++++++--------- .../Analysis/Locality/DiscoverConflicts.java | 3 ++- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Robust/src/Analysis/Locality/DelayComputation.java b/Robust/src/Analysis/Locality/DelayComputation.java index 3a6b7196..058d336e 100644 --- a/Robust/src/Analysis/Locality/DelayComputation.java +++ b/Robust/src/Analysis/Locality/DelayComputation.java @@ -313,8 +313,8 @@ public class DelayComputation { } if (fn.numNext()>1) { //We have a conditional branch...need to handle this carefully - Set set0=getNext(fn, 0, delayedset); - Set set1=getNext(fn, 1, delayedset); + Set set0=getNext(fn, 0, delayedset, lb, locality); + Set set1=getNext(fn, 1, delayedset, lb, locality); if (!set0.equals(set1)||set0.size()>1) { //This branch is important--need to remember how it goes livenodes.add(fn); @@ -332,11 +332,13 @@ public class DelayComputation { } - public static Set getBranchNodes(FlatNode fn, int i, Set delayset) { + public static Set getBranchNodes(FlatNode fn, int i, Set delayset, LocalityBinding lb, LocalityAnalysis locality) { FlatNode fnnext=fn.getNext(i); + Hashtable atomictable=locality.getAtomic(lb); + HashSet reachable=new HashSet(); - if (delayset.contains(fnnext)) { + if (delayset.contains(fnnext)||atomictable.get(fnnext).intValue()==0) { reachable.add(fnnext); return reachable; } @@ -353,7 +355,7 @@ public class DelayComputation { visited.add(fn2); for (int j=0;j getNext(FlatNode fn, int i, Set delayset) { + public static Set getNext(FlatNode fn, int i, Set delayset, LocalityBinding lb, LocalityAnalysis locality) { + Hashtable atomictable=locality.getAtomic(lb); FlatNode fnnext=fn.getNext(i); HashSet reachable=new HashSet(); - if (delayset.contains(fnnext)) { + if (delayset.contains(fnnext)||atomictable.get(fnnext).intValue()==0) { reachable.add(fnnext); return reachable; } @@ -376,12 +379,12 @@ public class DelayComputation { while(!nodes.isEmpty()) { FlatNode fn2=nodes.pop(); - if (visited.contains(fn2)) + if (visited.contains(fn2)) continue; visited.add(fn2); for (int j=0;j leftset=getBranchNodes(fn, 0, cannotdelay); - Set rightset=getBranchNodes(fn, 1, cannotdelay); + Set leftset=getBranchNodes(fn, 0, cannotdelay, lb, locality); + Set rightset=getBranchNodes(fn, 1, cannotdelay, lb, locality); if (leftset.size()>0&&rightset.size()>0&& - !leftset.equals(rightset)) + !leftset.equals(rightset)||leftset.size()>1) isnodelay=true; } diff --git a/Robust/src/Analysis/Locality/DiscoverConflicts.java b/Robust/src/Analysis/Locality/DiscoverConflicts.java index e1399289..f382143c 100644 --- a/Robust/src/Analysis/Locality/DiscoverConflicts.java +++ b/Robust/src/Analysis/Locality/DiscoverConflicts.java @@ -292,12 +292,13 @@ public class DiscoverConflicts { for(Iterator fnit=fm.getNodeSet().iterator();fnit.hasNext();) { FlatNode fn=fnit.next(); - Hashtable atomictable=locality.getAtomic(lb); //Check whether this node matters for delayed computation if (cannotdelaymap!=null&&cannotdelaymap.containsKey(lb)&&!cannotdelaymap.get(lb).contains(fn)) continue; + Hashtable atomictable=locality.getAtomic(lb); + if (atomictable.get(fn).intValue()>0) { Hashtable> tmap=fnmap.get(fn); switch(fn.kind()) { -- 2.34.1