This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] / Robust / src / IR / Flat / FlatMethod.java
diff --git a/Robust/src/IR/Flat/FlatMethod.java b/Robust/src/IR/Flat/FlatMethod.java
deleted file mode 100644 (file)
index 6d05bee..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-package IR.Flat;
-import IR.MethodDescriptor;
-import IR.TaskDescriptor;
-import java.util.*;
-
-public class FlatMethod extends FlatNode {
-    MethodDescriptor method;
-    TaskDescriptor task;
-    Vector parameterTemps;
-    Vector tagTemps;
-    Hashtable tagtointmap;
-
-    FlatMethod(MethodDescriptor md) {
-       method=md;
-       task=null;
-       parameterTemps=new Vector();
-       tagTemps=new Vector();
-       tagtointmap=new Hashtable();
-    }
-
-    FlatMethod(TaskDescriptor td) {
-       task=td;
-       method=null;
-       parameterTemps=new Vector();
-       tagTemps=new Vector();
-       tagtointmap=new Hashtable();
-    }
-
-    public String toString() {
-       String ret = "FlatMethod_";
-       if( method != null ) {
-           ret += method.toString();
-       } else {
-           ret += task.toString();
-       }
-       return ret;
-    }
-
-    public MethodDescriptor getMethod() {
-       return method;
-    }
-
-    public TaskDescriptor getTask() {
-       return task;
-    }
-    
-    public int kind() {
-       return FKind.FlatMethod;
-    }
-
-    public void addParameterTemp(TempDescriptor t) {
-       parameterTemps.add(t);
-    }
-
-    public int numParameters() {
-       return parameterTemps.size();
-    }
-
-    public void addTagTemp(TempDescriptor t) {
-       tagtointmap.put(t, new Integer(tagTemps.size()));
-       tagTemps.add(t);
-    }
-
-    public int getTagInt(TempDescriptor t) {
-       return ((Integer)tagtointmap.get(t)).intValue();
-    }
-
-    public int numTags() {
-       return tagTemps.size();
-    }
-
-    public TempDescriptor getTag(int i) {
-       return (TempDescriptor) tagTemps.get(i);
-    }
-    
-    public TempDescriptor getParameter(int i) {
-       return (TempDescriptor) parameterTemps.get(i);
-    }
-
-    /** This method returns a set of the nodes in this flat representation */
-
-    public Set<FlatNode> getNodeSet() {
-       HashSet<FlatNode> tovisit=new HashSet<FlatNode>();
-       HashSet<FlatNode> visited=new HashSet<FlatNode>();
-       tovisit.add(this);
-       while(!tovisit.isEmpty()) {
-           FlatNode fn=tovisit.iterator().next();
-           tovisit.remove(fn);
-           visited.add(fn);
-           for(int i=0;i<fn.numNext();i++) {
-               FlatNode nn=fn.getNext(i);
-               if (!visited.contains(nn))
-                   tovisit.add(nn);
-           }
-       }
-       return visited;
-    }
-    
-    public String printMethod() {
-       return printMethod(null);
-    }
-
-    /** This method returns a string that is a human readable
-     * representation of this method. */
-
-    public String printMethod(Hashtable map) {
-       String st=method+" {\n";
-       HashSet tovisit=new HashSet();
-       HashSet visited=new HashSet();
-       int labelindex=0;
-       Hashtable nodetolabel=new Hashtable();
-       tovisit.add(this);
-       FlatNode current_node=null;
-       //Assign labels 1st
-       //Node needs a label if it is
-       while(!tovisit.isEmpty()) {
-           FlatNode fn=(FlatNode)tovisit.iterator().next();
-           tovisit.remove(fn);
-           visited.add(fn);
-
-           for(int i=0;i<fn.numNext();i++) {
-               FlatNode nn=fn.getNext(i);
-               if(i>0) {
-                   //1) Edge >1 of node
-                   nodetolabel.put(nn,new Integer(labelindex++));
-               }
-               if (!visited.contains(nn)&&!tovisit.contains(nn)) {
-                   tovisit.add(nn);
-               } else {
-                   //2) Join point
-                   nodetolabel.put(nn,new Integer(labelindex++));
-               }
-           }
-       }
-
-       //Do the actual printing
-       tovisit=new HashSet();
-       visited=new HashSet();
-       tovisit.add(this);
-       while(current_node!=null||!tovisit.isEmpty()) {
-           if (current_node==null) {
-               current_node=(FlatNode)tovisit.iterator().next();
-               tovisit.remove(current_node);
-           }
-           visited.add(current_node);
-           if (nodetolabel.containsKey(current_node))
-               st+="L"+nodetolabel.get(current_node)+":\n";
-           if (current_node.numNext()==0) {
-               if (map==null)
-                   st+="   "+current_node.toString()+"\n";
-               else
-                   st+="   "+current_node.toString()+"["+map.get(current_node)+"]\n";
-               current_node=null;
-           } else if(current_node.numNext()==1) {
-               if (map==null)
-                   st+="   "+current_node.toString()+"\n";
-               else
-                   st+="   "+current_node.toString()+"["+map.get(current_node)+"]\n";
-               FlatNode nextnode=current_node.getNext(0);
-               if (visited.contains(nextnode)) {
-                   st+="goto L"+nodetolabel.get(nextnode)+"\n";
-                   current_node=null;
-               } else
-                   current_node=nextnode;
-           } else if (current_node.numNext()==2) {
-               /* Branch */
-               st+="   "+((FlatCondBranch)current_node).toString("L"+nodetolabel.get(current_node.getNext(1)))+"\n";
-               if (!visited.contains(current_node.getNext(1)))
-                   tovisit.add(current_node.getNext(1));
-               if (visited.contains(current_node.getNext(0))) {
-                   st+="goto L"+nodetolabel.get(current_node.getNext(0))+"\n";
-                   current_node=null;
-               } else
-                   current_node=current_node.getNext(0);
-           } else throw new Error();
-       }
-       return st+"}\n";
-    }
-    
-    public TempDescriptor [] writesTemps() {
-       return (TempDescriptor[]) parameterTemps.toArray(new TempDescriptor[ parameterTemps.size()]);
-    }
-}