6 import Analysis.TaskStateAnalysis.*;
12 this.classes=new SymbolTable();
13 this.tasks=new SymbolTable();
14 this.treemethodmap=new Hashtable();
15 this.flatmethodmap=new Hashtable();
16 this.parsetrees=new HashSet();
17 this.arraytypes=new HashSet();
18 this.arraytonumber=new Hashtable();
19 this.tagmap=new Hashtable();
20 this.selfloops=new HashSet();
21 this.excprefetch=new HashSet();
22 this.classpath=new Vector();
26 public void addParseNode(ParseNode parsetree) {
27 parsetrees.add(parsetree);
30 public void storeAnalysisResult(Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults) {
31 this.analysisresults=analysisresults;
34 public Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> getAnalysisResult() {
35 return analysisresults;
39 public void storeOptionalTaskDescriptors(Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors) {
40 this.optionaltaskdescriptors=optionaltaskdescriptors;
43 public Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> getOptionalTaskDescriptors() {
44 return optionaltaskdescriptors;
48 /** Boolean flag which indicates whether compiler is compiling a task-based
50 public boolean WEBINTERFACE=false;
51 public boolean MINIMIZE=false;
52 public boolean TASK=false;
53 public boolean FASTCHECK=false;
54 public boolean DSM=false;
55 public boolean PREFETCH=false;
56 public boolean TASKSTATE=false;
57 public boolean TAGSTATE=false;
58 public boolean FLATIRGRAPH=false;
59 public boolean FLATIRGRAPHTASKS=false;
60 public boolean FLATIRGRAPHUSERMETHODS=false;
61 public boolean FLATIRGRAPHLIBMETHODS=false;
62 public boolean MULTICORE=false;
63 public boolean OWNERSHIP=false;
64 public int OWNERSHIPALLOCDEPTH=3;
65 public boolean OWNERSHIPWRITEDOTS=false;
66 public boolean OWNERSHIPWRITEALL=false;
67 public String OWNERSHIPALIASFILE=null;
68 public boolean OPTIONAL=false;
69 public boolean ARRAYBOUNDARYCHECK=true;
70 public boolean RAW=false;
71 public boolean ARRAYPAD=false;
72 public boolean SCHEDULING=false;
73 public boolean USEPROFILE=false;
74 public String profilename = null;
75 public boolean THREAD=false;
76 public boolean CONSCHECK=false;
77 public boolean INSTRUCTIONFAILURE=false;
78 public boolean MLP=false;
79 public boolean MLPDEBUG=false;
80 public int MLP_NUMCORES=0;
81 public int MLP_MAXSESEAGE=0;
82 public static double TRUEPROB=0.8;
83 public static boolean PRINTFLAT=false;
84 public static boolean PRINTSCHEDULING=false;
85 public static boolean PRINTSCHEDULESIM=false;
86 public static boolean PRINTCRITICALPATH=false;
87 public static boolean ABORTREADERS=false;
88 public static boolean SINGLETM=false;
89 public static boolean READSET=false;
90 public int CORENUM = 1;
91 public String structfile;
93 public String outputdir = "/scratch/";
94 public boolean INLINEATOMIC=false;
95 public int inlineatomicdepth;
96 public HashSet selfloops;
97 public HashSet excprefetch;
98 public Vector classpath;
99 public SymbolTable classes;
100 public SymbolTable tasks;
101 public Set parsetrees;
102 public Hashtable treemethodmap;
103 public Hashtable flatmethodmap;
104 private HashSet arraytypes;
105 public Hashtable arraytonumber;
106 private int numclasses=0;
107 private int numtasks=0;
108 private int arraycount=0;
109 public boolean OPTIMIZE=false;
110 public boolean DCOPTS=false;
111 public boolean DELAYCOMP=false;
114 private Hashtable<ClassDescriptor, Hashtable<OptionalTaskDescriptor, OptionalTaskDescriptor>> optionaltaskdescriptors;
115 private Hashtable<ClassDescriptor, Hashtable<FlagState, Set<OptionalTaskDescriptor>>> analysisresults;
117 private Hashtable tagmap;
118 private int numtags=0;
120 public void addArrayType(TypeDescriptor td) {
121 if (!arraytypes.contains(td)) {
123 arraytonumber.put(td,new Integer(arraycount++));
127 public Iterator getArrayIterator() {
128 return arraytypes.iterator();
131 public int getTagId(TagDescriptor tag) {
132 if (tagmap.containsKey(tag)) {
133 return ((Integer) tagmap.get(tag)).intValue();
135 tagmap.put(tag, new Integer(numtags));
140 public int getArrayNumber(TypeDescriptor td) {
141 if (arraytonumber.containsKey(td))
142 return ((Integer)arraytonumber.get(td)).intValue();
146 public int numArrays() {
147 return arraytypes.size();
150 public static TypeDescriptor getTypeDescriptor(int t) {
151 TypeDescriptor td=new TypeDescriptor(t);
155 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
156 TypeDescriptor td=new TypeDescriptor(n);
160 public void addClass(ClassDescriptor tdn) {
161 if (classes.contains(tdn.getSymbol()))
162 throw new Error("Class "+tdn.getSymbol()+" defined twice");
167 public int numClasses() {
171 public BlockNode getMethodBody(MethodDescriptor md) {
172 return (BlockNode)treemethodmap.get(md);
175 public BlockNode getMethodBody(TaskDescriptor td) {
176 return (BlockNode)treemethodmap.get(td);
179 public SymbolTable getClassSymbolTable() {
183 public SymbolTable getTaskSymbolTable() {
187 /** Returns Flat IR representation of MethodDescriptor md. */
189 public FlatMethod getMethodFlat(MethodDescriptor md) {
190 return (FlatMethod)flatmethodmap.get(md);
193 /** Returns Flat IR representation of TaskDescriptor td. */
195 public FlatMethod getMethodFlat(TaskDescriptor td) {
196 return (FlatMethod)flatmethodmap.get(td);
199 // The descriptor is either a method or task desc
200 // and should call one of the above methods
201 public FlatMethod getMethodFlat(Descriptor d) {
203 if( d instanceof MethodDescriptor ) {
204 fm = getMethodFlat( (MethodDescriptor) d);
206 assert d instanceof TaskDescriptor;
207 fm = getMethodFlat( (TaskDescriptor) d);
212 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
213 treemethodmap.put(md,bn);
216 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
217 treemethodmap.put(td,bn);
220 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
221 flatmethodmap.put(md,bn);
224 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
225 flatmethodmap.put(td,bn);
228 public void addTask(TaskDescriptor td) {
229 if (tasks.contains(td.getSymbol()))
230 throw new Error("Task "+td.getSymbol()+" defined twice");