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 THREAD=false;
26 public boolean INSTRUCTIONFAILURE=false;
27 public String structfile;
29 public boolean CONSCHECK=false;
31 public SymbolTable classes;
32 public SymbolTable tasks;
33 public Set parsetrees;
34 public Hashtable treemethodmap;
35 public Hashtable flatmethodmap;
36 private HashSet arraytypes;
37 public Hashtable arraytonumber;
38 private int numclasses=0;
39 private int numtasks=0;
40 private int arraycount=0;
42 public void addArrayType(TypeDescriptor td) {
43 if (!arraytypes.contains(td)) {
45 arraytonumber.put(td,new Integer(arraycount++));
49 public Iterator getArrayIterator() {
50 return arraytypes.iterator();
53 public int getArrayNumber(TypeDescriptor td) {
54 return ((Integer)arraytonumber.get(td)).intValue();
57 public int numArrays() {
58 return arraytypes.size();
61 public static TypeDescriptor getTypeDescriptor(int t) {
62 TypeDescriptor td=new TypeDescriptor(t);
66 public static TypeDescriptor getTypeDescriptor(NameDescriptor n) {
67 TypeDescriptor td=new TypeDescriptor(n);
71 public void addClass(ClassDescriptor tdn) {
72 if (classes.contains(tdn.getSymbol()))
73 throw new Error("Class "+tdn.getSymbol()+" defined twice");
78 public int numClasses() {
82 public BlockNode getMethodBody(MethodDescriptor md) {
83 return (BlockNode)treemethodmap.get(md);
86 public BlockNode getMethodBody(TaskDescriptor td) {
87 return (BlockNode)treemethodmap.get(td);
90 public SymbolTable getClassSymbolTable() {
94 public SymbolTable getTaskSymbolTable() {
98 /** Returns Flat IR representation of MethodDescriptor md. */
100 public FlatMethod getMethodFlat(MethodDescriptor md) {
101 return (FlatMethod)flatmethodmap.get(md);
104 /** Returns Flat IR representation of TaskDescriptor td. */
106 public FlatMethod getMethodFlat(TaskDescriptor td) {
107 return (FlatMethod)flatmethodmap.get(td);
110 public void addTreeCode(MethodDescriptor md, BlockNode bn) {
111 treemethodmap.put(md,bn);
114 public void addTreeCode(TaskDescriptor td, BlockNode bn) {
115 treemethodmap.put(td,bn);
118 public void addFlatCode(MethodDescriptor md, FlatMethod bn) {
119 flatmethodmap.put(md,bn);
122 public void addFlatCode(TaskDescriptor td, FlatMethod bn) {
123 flatmethodmap.put(td,bn);
126 public void addTask(TaskDescriptor td) {
127 if (tasks.contains(td.getSymbol()))
128 throw new Error("Task "+td.getSymbol()+" defined twice");