From e19bd0fef6cde93800bf6b556fa7c4928a5ebff6 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 30 Jun 2009 03:47:31 +0000 Subject: [PATCH] more analysis flexibility --- Robust/src/Analysis/Liveness.java | 15 +++++++++++++++ Robust/src/Analysis/ReachingDefs.java | 13 +++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Robust/src/Analysis/Liveness.java b/Robust/src/Analysis/Liveness.java index 5e9c7d99..2b10f739 100644 --- a/Robust/src/Analysis/Liveness.java +++ b/Robust/src/Analysis/Liveness.java @@ -4,6 +4,7 @@ import IR.Flat.*; import java.util.Arrays; import java.util.HashSet; import java.util.Set; +import java.util.Iterator; import java.util.List; import java.util.Hashtable; @@ -41,4 +42,18 @@ public class Liveness { return nodetotemps; } + public static Hashtable> computeLiveOut(FlatMethod fm) { + Hashtable> liveinmap=computeLiveTemps(fm); + Hashtable> liveoutmap=new Hashtable>(); + + for(Iterator fnit=fm.getNodeSet().iterator(); fnit.hasNext();) { + FlatNode fn=fnit.next(); + liveoutmap.put(fn, new HashSet()); + for(int i=0;i>> computeReachingDefs(FlatMethod fm, Hashtable> livemap) { + /* liveintoset if true computes the reaching defs into the node and if false computes the reaching defs out of the node. */ + + public static Hashtable>> computeReachingDefs(FlatMethod fm, Hashtable> livemap, boolean liveintoset) { Hashtable>> nodetotemps=new Hashtable>>(); + + Hashtable>> liveinto=liveintoset?new Hashtable>>():null; + Set toprocess=fm.getNodeSet(); @@ -37,6 +42,10 @@ public class ReachingDefs { } } } + + if (liveintoset) { + liveinto.put(fn, new Hashtable>(tempset)); + } TempDescriptor writes[]=fn.writesTemps(); for(int i=0;i