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
25 public boolean WEBINTERFACE;
27 public boolean TASKSTATE=false;
29 public boolean OPTIONAL=false;
31 public boolean THREAD=false;
32 public boolean INSTRUCTIONFAILURE=false;
33 public String structfile;
35 public boolean CONSCHECK=false;
37 public SymbolTable classes;
38 public SymbolTable tasks;
39 public Set parsetrees;
40 public Hashtable treemethodmap;
41 public Hashtable flatmethodmap;
42 private HashSet arraytypes;
43 public Hashtable arraytonumber;
44 private int numclasses=0;
45 private int numtasks=0;
46 private int arraycount=0;
48 private Hashtable tagmap;
49 private int numtags=0;
51 public void addArrayType(TypeDescriptor td) {
52 if (!arraytypes.contains(td)) {
54 arraytonumber.put(td,new Integer(arraycount++));
58 public Iterator getArrayIterator() {
59 return arraytypes.iterator();
62 public int getTagId(TagDescriptor tag) {
63 if (tagmap.containsKey(tag)) {
64 return ((Integer) tagmap.get(tag)).intValue();
66 tagmap.put(tag, new Integer(numtags));
71 public int getArrayNumber(TypeDescriptor td) {
72 return ((Integer)arraytonumber.get(td)).intValue();
75 public int numArrays() {
76 return arraytypes.size();
79 public static TypeDescriptor getTypeDescriptor(int t) {
80 TypeDescriptor td=new TypeDescriptor(t);
84 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
85 TypeDescriptor td=new TypeDescriptor(n);
89 public void addClass(ClassDescriptor tdn) {
90 if (classes.contains(tdn.getSymbol()))
91 throw new Error("Class "+tdn.getSymbol()+" defined twice");
96 public int numClasses() {
100 public BlockNode getMethodBody(MethodDescriptor md) {
101 return (BlockNode)treemethodmap.get(md);
104 public BlockNode getMethodBody(TaskDescriptor td) {
105 return (BlockNode)treemethodmap.get(td);
108 public SymbolTable getClassSymbolTable() {
112 public SymbolTable getTaskSymbolTable() {
116 /** Returns Flat IR representation of MethodDescriptor md. */
118 public FlatMethod getMethodFlat(MethodDescriptor md) {
119 return (FlatMethod)flatmethodmap.get(md);
122 /** Returns Flat IR representation of TaskDescriptor td. */
124 public FlatMethod getMethodFlat(TaskDescriptor td) {
125 return (FlatMethod)flatmethodmap.get(td);
128 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
129 treemethodmap.put(md,bn);
132 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
133 treemethodmap.put(td,bn);
136 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
137 flatmethodmap.put(md,bn);
140 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
141 flatmethodmap.put(td,bn);
144 public void addTask(TaskDescriptor td) {
145 if (tasks.contains(td.getSymbol()))
146 throw new Error("Task "+td.getSymbol()+" defined twice");