9 this.classes=new SymbolTable();
10 this.tasks=new SymbolTable();
11 this.treemethodmap=new Hashtable();
12 this.flatmethodmap=new Hashtable();
13 this.parsetrees=new HashSet();
14 this.arraytypes=new HashSet();
15 this.arraytonumber=new Hashtable();
16 this.tagmap=new Hashtable();
19 public void addParseNode(ParseNode parsetree) {
20 parsetrees.add(parsetree);
23 /** Boolean flag which indicates whether compiler is compiling a task-based
26 public boolean THREAD=false;
27 public boolean INSTRUCTIONFAILURE=false;
28 public String structfile;
30 public boolean CONSCHECK=false;
32 public SymbolTable classes;
33 public SymbolTable tasks;
34 public Set parsetrees;
35 public Hashtable treemethodmap;
36 public Hashtable flatmethodmap;
37 private HashSet arraytypes;
38 public Hashtable arraytonumber;
39 private int numclasses=0;
40 private int numtasks=0;
41 private int arraycount=0;
43 private Hashtable tagmap;
44 private int numtags=0;
46 public void addArrayType(TypeDescriptor td) {
47 if (!arraytypes.contains(td)) {
49 arraytonumber.put(td,new Integer(arraycount++));
53 public Iterator getArrayIterator() {
54 return arraytypes.iterator();
57 public int getTagId(TagDescriptor tag) {
58 if (tagmap.containsKey(tag)) {
59 return ((Integer) tagmap.get(tag)).intValue();
61 tagmap.put(tag, new Integer(numtags));
66 public int getArrayNumber(TypeDescriptor td) {
67 return ((Integer)arraytonumber.get(td)).intValue();
70 public int numArrays() {
71 return arraytypes.size();
74 public static TypeDescriptor getTypeDescriptor(int t) {
75 TypeDescriptor td=new TypeDescriptor(t);
79 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
80 TypeDescriptor td=new TypeDescriptor(n);
84 public void addClass(ClassDescriptor tdn) {
85 if (classes.contains(tdn.getSymbol()))
86 throw new Error("Class "+tdn.getSymbol()+" defined twice");
91 public int numClasses() {
95 public BlockNode getMethodBody(MethodDescriptor md) {
96 return (BlockNode)treemethodmap.get(md);
99 public BlockNode getMethodBody(TaskDescriptor td) {
100 return (BlockNode)treemethodmap.get(td);
103 public SymbolTable getClassSymbolTable() {
107 public SymbolTable getTaskSymbolTable() {
111 /** Returns Flat IR representation of MethodDescriptor md. */
113 public FlatMethod getMethodFlat(MethodDescriptor md) {
114 return (FlatMethod)flatmethodmap.get(md);
117 /** Returns Flat IR representation of TaskDescriptor td. */
119 public FlatMethod getMethodFlat(TaskDescriptor td) {
120 return (FlatMethod)flatmethodmap.get(td);
123 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
124 treemethodmap.put(md,bn);
127 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
128 treemethodmap.put(td,bn);
131 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
132 flatmethodmap.put(md,bn);
135 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
136 flatmethodmap.put(td,bn);
139 public void addTask(TaskDescriptor td) {
140 if (tasks.contains(td.getSymbol()))
141 throw new Error("Task "+td.getSymbol()+" defined twice");