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;
44 /** Boolean flag which indicates whether compiler is compiling a task-based
46 public boolean WEBINTERFACE=false;
47 public boolean TASK=false;
48 public boolean FASTCHECK=false;
49 public boolean DSM=false;
50 public boolean PREFETCH=false;
51 public boolean TASKSTATE=false;
52 public boolean TAGSTATE=false;
53 public boolean FLATIRGRAPH=false;
54 public boolean FLATIRGRAPHTASKS=false;
55 public boolean FLATIRGRAPHUSERMETHODS=false;
56 public boolean FLATIRGRAPHLIBMETHODS=false;
57 public boolean MULTICORE=false;
58 public boolean OWNERSHIP=false;
59 public int OWNERSHIPALLOCDEPTH=3;
60 public boolean OWNERSHIPWRITEDOTS=false;
61 public boolean OWNERSHIPWRITEALL=false;
62 public String OWNERSHIPALIASFILE=null;
63 public boolean OPTIONAL=false;
64 public boolean ARRAYBOUNDARYCHECK=true;
65 public boolean RAW=false;
66 public boolean SCHEDULING=false;
67 public boolean USEPROFILE=false;
68 public boolean THREAD=false;
69 public boolean CONSCHECK=false;
70 public boolean INSTRUCTIONFAILURE=false;
71 public static double TRUEPROB=0.8;
72 public static boolean PRINTFLAT=false;
73 public static boolean PRINTSCHEDULING=false;
74 public static boolean PRINTSCHEDULESIM=false;
75 public static boolean ABORTREADERS=false;
76 public int CORENUM = 1;
77 public String structfile;
80 public HashSet selfloops;
81 public HashSet excprefetch;
82 public SymbolTable classes;
83 public SymbolTable tasks;
84 public Set parsetrees;
85 public Hashtable treemethodmap;
86 public Hashtable flatmethodmap;
87 private HashSet arraytypes;
88 public Hashtable arraytonumber;
89 private int numclasses=0;
90 private int numtasks=0;
91 private int arraycount=0;
95 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
96 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
98 private Hashtable tagmap;
99 private int numtags=0;
101 public void addArrayType(TypeDescriptor td) {
102 if (!arraytypes.contains(td)) {
104 arraytonumber.put(td,new Integer(arraycount++));
108 public Iterator getArrayIterator() {
109 return arraytypes.iterator();
112 public int getTagId(TagDescriptor tag) {
113 if (tagmap.containsKey(tag)) {
114 return ((Integer) tagmap.get(tag)).intValue();
116 tagmap.put(tag, new Integer(numtags));
121 public int getArrayNumber(TypeDescriptor td) {
122 if (arraytonumber.containsKey(td))
123 return ((Integer)arraytonumber.get(td)).intValue();
124 else throw new Error("Could not find array type:" + td.toPrettyString());
127 public int numArrays() {
128 return arraytypes.size();
131 public static TypeDescriptor getTypeDescriptor(int t) {
132 TypeDescriptor td=new TypeDescriptor(t);
136 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
137 TypeDescriptor td=new TypeDescriptor(n);
141 public void addClass(ClassDescriptor tdn) {
142 if (classes.contains(tdn.getSymbol()))
143 throw new Error("Class "+tdn.getSymbol()+" defined twice");
148 public int numClasses() {
152 public BlockNode getMethodBody(MethodDescriptor md) {
153 return (BlockNode)treemethodmap.get(md);
156 public BlockNode getMethodBody(TaskDescriptor td) {
157 return (BlockNode)treemethodmap.get(td);
160 public SymbolTable getClassSymbolTable() {
164 public SymbolTable getTaskSymbolTable() {
168 /** Returns Flat IR representation of MethodDescriptor md. */
170 public FlatMethod getMethodFlat(MethodDescriptor md) {
171 return (FlatMethod)flatmethodmap.get(md);
174 /** Returns Flat IR representation of TaskDescriptor td. */
176 public FlatMethod getMethodFlat(TaskDescriptor td) {
177 return (FlatMethod)flatmethodmap.get(td);
180 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
181 treemethodmap.put(md,bn);
184 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
185 treemethodmap.put(td,bn);
188 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
189 flatmethodmap.put(md,bn);
192 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
193 flatmethodmap.put(td,bn);
196 public void addTask(TaskDescriptor td) {
197 if (tasks.contains(td.getSymbol()))
198 throw new Error("Task "+td.getSymbol()+" defined twice");