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 boolean INSTRUCTIONFAILURE=false;
26 public String structfile;
28 public boolean CONSCHECK=false;
30 public SymbolTable classes;
31 public SymbolTable tasks;
32 public Set parsetrees;
33 public Hashtable treemethodmap;
34 public Hashtable flatmethodmap;
35 private HashSet arraytypes;
36 public Hashtable arraytonumber;
37 private int numclasses=0;
38 private int numtasks=0;
39 private int arraycount=0;
41 public void addArrayType(TypeDescriptor td) {
42 if (!arraytypes.contains(td)) {
44 arraytonumber.put(td,new Integer(arraycount++));
48 public Iterator getArrayIterator() {
49 return arraytypes.iterator();
52 public int getArrayNumber(TypeDescriptor td) {
53 return ((Integer)arraytonumber.get(td)).intValue();
56 public int numArrays() {
57 return arraytypes.size();
60 public static TypeDescriptor getTypeDescriptor(int t) {
61 TypeDescriptor td=new TypeDescriptor(t);
65 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
66 TypeDescriptor td=new TypeDescriptor(n);
70 public void addClass(ClassDescriptor tdn) {
71 if (classes.contains(tdn.getSymbol()))
72 throw new Error("Class "+tdn.getSymbol()+" defined twice");
77 public int numClasses() {
81 public BlockNode getMethodBody(MethodDescriptor md) {
82 return (BlockNode)treemethodmap.get(md);
85 public BlockNode getMethodBody(TaskDescriptor td) {
86 return (BlockNode)treemethodmap.get(td);
89 public SymbolTable getClassSymbolTable() {
93 public SymbolTable getTaskSymbolTable() {
97 /** Returns Flat IR representation of MethodDescriptor md. */
99 public FlatMethod getMethodFlat(MethodDescriptor md) {
100 return (FlatMethod)flatmethodmap.get(md);
103 /** Returns Flat IR representation of TaskDescriptor td. */
105 public FlatMethod getMethodFlat(TaskDescriptor td) {
106 return (FlatMethod)flatmethodmap.get(td);
109 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
110 treemethodmap.put(md,bn);
113 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
114 treemethodmap.put(td,bn);
117 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
118 flatmethodmap.put(md,bn);
121 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
122 flatmethodmap.put(td,bn);
125 public void addTask(TaskDescriptor td) {
126 if (tasks.contains(td.getSymbol()))
127 throw new Error("Task "+td.getSymbol()+" defined twice");