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();
19 this.excprefetch=new HashSet();
22 public void addParseNode(ParseNode parsetree) {
23 parsetrees.add(parsetree);
26 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
27 this.analysisresults=analysisresults;
30 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
31 return analysisresults;
35 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors){
36 this.optionaltaskdescriptors=optionaltaskdescriptors;
39 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors(){
40 return optionaltaskdescriptors;
43 /** Boolean flag which indicates whether compiler is compiling a task-based
45 public boolean WEBINTERFACE=false;
46 public boolean TASK=false;
47 public boolean DSM=false;
48 public boolean PREFETCH=false;
49 public boolean TASKSTATE=false;
50 public boolean TAGSTATE=false;
51 public boolean FLATIRGRAPH=false;
52 public boolean FLATIRGRAPHTASKS=false;
53 public boolean FLATIRGRAPHUSERMETHODS=false;
54 public boolean FLATIRGRAPHLIBMETHODS=false;
55 public boolean MULTICORE=false;
56 public boolean OWNERSHIP=false;
57 public boolean OPTIONAL=false;
58 //public boolean RAW=false;
59 public boolean SCHEDULING=false;
60 public boolean THREAD=false;
61 public boolean CONSCHECK=false;
62 public boolean INSTRUCTIONFAILURE=false;
63 public static double TRUEPROB=0.8;
64 public static boolean PRINTFLAT=false;
65 public int CORENUM = 1;
66 public String structfile;
69 public HashSet selfloops;
70 public HashSet excprefetch;
71 public SymbolTable classes;
72 public SymbolTable tasks;
73 public Set parsetrees;
74 public Hashtable treemethodmap;
75 public Hashtable flatmethodmap;
76 private HashSet arraytypes;
77 public Hashtable arraytonumber;
78 private int numclasses=0;
79 private int numtasks=0;
80 private int arraycount=0;
83 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
84 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
86 private Hashtable tagmap;
87 private int numtags=0;
89 public void addArrayType(TypeDescriptor td) {
90 if (!arraytypes.contains(td)) {
92 arraytonumber.put(td,new Integer(arraycount++));
96 public Iterator getArrayIterator() {
97 return arraytypes.iterator();
100 public int getTagId(TagDescriptor tag) {
101 if (tagmap.containsKey(tag)) {
102 return ((Integer) tagmap.get(tag)).intValue();
104 tagmap.put(tag, new Integer(numtags));
109 public int getArrayNumber(TypeDescriptor td) {
110 return ((Integer)arraytonumber.get(td)).intValue();
113 public int numArrays() {
114 return arraytypes.size();
117 public static TypeDescriptor getTypeDescriptor(int t) {
118 TypeDescriptor td=new TypeDescriptor(t);
122 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
123 TypeDescriptor td=new TypeDescriptor(n);
127 public void addClass(ClassDescriptor tdn) {
128 if (classes.contains(tdn.getSymbol()))
129 throw new Error("Class "+tdn.getSymbol()+" defined twice");
134 public int numClasses() {
138 public BlockNode getMethodBody(MethodDescriptor md) {
139 return (BlockNode)treemethodmap.get(md);
142 public BlockNode getMethodBody(TaskDescriptor td) {
143 return (BlockNode)treemethodmap.get(td);
146 public SymbolTable getClassSymbolTable() {
150 public SymbolTable getTaskSymbolTable() {
154 /** Returns Flat IR representation of MethodDescriptor md. */
156 public FlatMethod getMethodFlat(MethodDescriptor md) {
157 return (FlatMethod)flatmethodmap.get(md);
160 /** Returns Flat IR representation of TaskDescriptor td. */
162 public FlatMethod getMethodFlat(TaskDescriptor td) {
163 return (FlatMethod)flatmethodmap.get(td);
166 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
167 treemethodmap.put(md,bn);
170 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
171 treemethodmap.put(td,bn);
174 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
175 flatmethodmap.put(md,bn);
178 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
179 flatmethodmap.put(td,bn);
182 public void addTask(TaskDescriptor td) {
183 if (tasks.contains(td.getSymbol()))
184 throw new Error("Task "+td.getSymbol()+" defined twice");