2 import IR.FlagDescriptor;
3 import java.util.Hashtable;
4 import java.util.HashSet;
5 import java.util.Iterator;
7 public class FlatFlagActionNode extends FlatNode {
8 Hashtable tempflagpairs;
10 public FlatFlagActionNode() {
11 tempflagpairs=new Hashtable();
14 public void addFlagAction(TempDescriptor td, FlagDescriptor fd, boolean status) {
15 TempFlagPair tfp=new TempFlagPair(td,fd);
16 if (tempflagpairs.containsKey(tfp)) {
17 throw new Error("Temp/Flag combination used twice: "+tfp);
19 tempflagpairs.put(tfp, new Boolean(status));
23 return FKind.FlatFlagActionNode;
26 public TempDescriptor [] readsTemps() {
27 if (tempflagpairs.size()==0)
28 return new TempDescriptor [0];
30 HashSet temps=new HashSet();
31 for(Iterator it=tempflagpairs.keySet().iterator();it.hasNext();) {
32 TempFlagPair tfp=(TempFlagPair)it.next();
33 temps.add(tfp.getTemp());
35 return (TempDescriptor[]) temps.toArray(new TempDescriptor [temps.size()]);