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();
18 public void addParseNode(ParseNode parsetree) {
19 parsetrees.add(parsetree);
22 /** Boolean flag which indicates whether compiler is compiling a task-based
25 public String structfile;
27 public boolean CONSCHECK=false;
29 public SymbolTable classes;
30 public SymbolTable tasks;
31 public Set parsetrees;
32 public Hashtable treemethodmap;
33 public Hashtable flatmethodmap;
34 private HashSet arraytypes;
35 public Hashtable arraytonumber;
36 private int numclasses=0;
37 private int numtasks=0;
38 private int arraycount=0;
40 public void addArrayType(TypeDescriptor td) {
41 if (!arraytypes.contains(td)) {
43 arraytonumber.put(td,new Integer(arraycount++));
47 public Iterator getArrayIterator() {
48 return arraytypes.iterator();
51 public int getArrayNumber(TypeDescriptor td) {
52 return ((Integer)arraytonumber.get(td)).intValue();
55 public int numArrays() {
56 return arraytypes.size();
59 public static TypeDescriptor getTypeDescriptor(int t) {
60 TypeDescriptor td=new TypeDescriptor(t);
64 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
65 TypeDescriptor td=new TypeDescriptor(n);
69 public void addClass(ClassDescriptor tdn) {
70 if (classes.contains(tdn.getSymbol()))
71 throw new Error("Class "+tdn.getSymbol()+" defined twice");
76 public int numClasses() {
80 public BlockNode getMethodBody(MethodDescriptor md) {
81 return (BlockNode)treemethodmap.get(md);
84 public BlockNode getMethodBody(TaskDescriptor td) {
85 return (BlockNode)treemethodmap.get(td);
88 public SymbolTable getClassSymbolTable() {
92 public SymbolTable getTaskSymbolTable() {
96 /** Returns Flat IR representation of MethodDescriptor md. */
98 public FlatMethod getMethodFlat(MethodDescriptor md) {
99 return (FlatMethod)flatmethodmap.get(md);
102 /** Returns Flat IR representation of TaskDescriptor td. */
104 public FlatMethod getMethodFlat(TaskDescriptor td) {
105 return (FlatMethod)flatmethodmap.get(td);
108 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
109 treemethodmap.put(md,bn);
112 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
113 treemethodmap.put(td,bn);
116 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
117 flatmethodmap.put(md,bn);
120 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
121 flatmethodmap.put(td,bn);
124 public void addTask(TaskDescriptor td) {
125 if (tasks.contains(td.getSymbol()))
126 throw new Error("Task "+td.getSymbol()+" defined twice");