more changes toward compiler DSM support
[IRC.git] / Robust / src / IR / Flat / TempDescriptor.java
1 package IR.Flat;
2 import IR.*;
3
4 public class TempDescriptor extends Descriptor {
5     static int currentid=0;
6     int id;
7     //    String safename;
8     TypeDescriptor type;
9     TagDescriptor tag;
10
11     public TempDescriptor(String name) {
12         super(name);
13         id=currentid++;
14     }
15
16     public TempDescriptor(String name, TypeDescriptor td) {
17         this(name);
18         type=td;
19     }
20
21     public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) {
22         this(name);
23         this.type=type;
24         tag=td;
25     }
26
27     public TempDescriptor createNew() {
28         if (tag==null)
29             return new TempDescriptor(name, type);
30         else
31             return new TempDescriptor(name, type, tag);
32     }
33     
34     public static TempDescriptor tempFactory() {
35         return new TempDescriptor("temp_"+currentid);
36     }
37
38     public static TempDescriptor tempFactory(String name) {
39         return new TempDescriptor(name+currentid);
40     }
41
42     public static TempDescriptor tempFactory(String name, TypeDescriptor td) {
43         return new TempDescriptor(name+currentid,td);
44     }
45
46     public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) {
47         return new TempDescriptor(name+currentid,type,tag);
48     }
49
50     public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) {
51         return new TempDescriptor(name,td);
52     }
53
54     public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) {
55         return new TempDescriptor(name, tagtype, tag);
56     }
57
58     public String toString() {
59         return safename;
60     }
61
62     public void setType(TypeDescriptor td) {
63         type=td;
64     }
65
66     public TypeDescriptor getType() {
67         return type;
68     }
69
70     public TagDescriptor getTag() {
71         return tag;
72     }
73
74     public void setTag(TagDescriptor tag) {
75         this.tag=tag;
76     }
77 }