6 import Analysis.TaskStateAnalysis.*;
10 this.classes=new SymbolTable();
11 this.tasks=new SymbolTable();
12 this.treemethodmap=new Hashtable();
13 this.flatmethodmap=new Hashtable();
14 this.parsetrees=new HashSet();
15 this.arraytypes=new HashSet();
16 this.arraytonumber=new Hashtable();
17 this.tagmap=new Hashtable();
18 this.selfloops=new HashSet();
21 public void addParseNode(ParseNode parsetree) {
22 parsetrees.add(parsetree);
25 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
26 this.analysisresults=analysisresults;
29 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
30 return analysisresults;
34 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors){
35 this.optionaltaskdescriptors=optionaltaskdescriptors;
38 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors(){
39 return optionaltaskdescriptors;
42 /** Boolean flag which indicates whether compiler is compiling a task-based
44 public boolean WEBINTERFACE=false;
45 public boolean TASK=false;
46 public boolean DSM=false;
47 public boolean PREFETCH=false;
48 public boolean TASKSTATE=false;
49 public boolean FLATIRGRAPH=false;
50 public boolean FLATIRGRAPHTASKS=false;
51 public boolean FLATIRGRAPHUSERMETHODS=false;
52 public boolean FLATIRGRAPHLIBMETHODS=false;
53 public boolean OWNERSHIP=false;
54 public boolean OPTIONAL=false;
55 public boolean THREAD=false;
56 public boolean CONSCHECK=false;
57 public boolean INSTRUCTIONFAILURE=false;
58 public String structfile;
61 public HashSet selfloops;
62 public SymbolTable classes;
63 public SymbolTable tasks;
64 public Set parsetrees;
65 public Hashtable treemethodmap;
66 public Hashtable flatmethodmap;
67 private HashSet arraytypes;
68 public Hashtable arraytonumber;
69 private int numclasses=0;
70 private int numtasks=0;
71 private int arraycount=0;
74 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
75 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
77 private Hashtable tagmap;
78 private int numtags=0;
80 public void addArrayType(TypeDescriptor td) {
81 if (!arraytypes.contains(td)) {
83 arraytonumber.put(td,new Integer(arraycount++));
87 public Iterator getArrayIterator() {
88 return arraytypes.iterator();
91 public int getTagId(TagDescriptor tag) {
92 if (tagmap.containsKey(tag)) {
93 return ((Integer) tagmap.get(tag)).intValue();
95 tagmap.put(tag, new Integer(numtags));
100 public int getArrayNumber(TypeDescriptor td) {
101 return ((Integer)arraytonumber.get(td)).intValue();
104 public int numArrays() {
105 return arraytypes.size();
108 public static TypeDescriptor getTypeDescriptor(int t) {
109 TypeDescriptor td=new TypeDescriptor(t);
113 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
114 TypeDescriptor td=new TypeDescriptor(n);
118 public void addClass(ClassDescriptor tdn) {
119 if (classes.contains(tdn.getSymbol()))
120 throw new Error("Class "+tdn.getSymbol()+" defined twice");
125 public int numClasses() {
129 public BlockNode getMethodBody(MethodDescriptor md) {
130 return (BlockNode)treemethodmap.get(md);
133 public BlockNode getMethodBody(TaskDescriptor td) {
134 return (BlockNode)treemethodmap.get(td);
137 public SymbolTable getClassSymbolTable() {
141 public SymbolTable getTaskSymbolTable() {
145 /** Returns Flat IR representation of MethodDescriptor md. */
147 public FlatMethod getMethodFlat(MethodDescriptor md) {
148 return (FlatMethod)flatmethodmap.get(md);
151 /** Returns Flat IR representation of TaskDescriptor td. */
153 public FlatMethod getMethodFlat(TaskDescriptor td) {
154 return (FlatMethod)flatmethodmap.get(td);
157 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
158 treemethodmap.put(md,bn);
161 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
162 treemethodmap.put(td,bn);
165 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
166 flatmethodmap.put(md,bn);
169 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
170 flatmethodmap.put(td,bn);
173 public void addTask(TaskDescriptor td) {
174 if (tasks.contains(td.getSymbol()))
175 throw new Error("Task "+td.getSymbol()+" defined twice");