03f2892dabc253df97d65556c51317b3e83f6870
[IRC.git] / Robust / src / IR / Flat / FlatNew.java
1 package IR.Flat;
2 import IR.TypeDescriptor;
3
4 public class FlatNew extends FlatNode {
5   TempDescriptor dst;
6   TypeDescriptor type;
7   TempDescriptor size;
8   boolean isglobal;
9   boolean isdisjoint;
10
11   public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) {
12     this.type=type;
13     this.dst=dst;
14     this.size=null;
15     this.isglobal=isglobal;
16     this.isdisjoint=false;
17   }
18
19   public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, boolean isdisjoint) {
20     this.type=type;
21     this.dst=dst;
22     this.size=null;
23     this.isglobal=isglobal;
24     this.isdisjoint=isdisjoint;
25   }
26
27   public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) {
28     this.type=type;
29     this.dst=dst;
30     this.size=size;
31     this.isglobal=isglobal;
32     this.isdisjoint=false;
33   }
34
35   public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, boolean isdisjoint) {
36     this.type=type;
37     this.dst=dst;
38     this.size=size;
39     this.isglobal=isglobal;
40     this.isdisjoint=isdisjoint;
41   }
42
43   public boolean isGlobal() {
44     return isglobal;
45   }
46
47   public boolean isDisjoint() {
48     return isdisjoint;
49   }
50
51   public String toString() {
52     String str = "FlatNew_"+dst.toString()+"= NEW "+type.toString();
53     if (size!=null)
54       str += "["+size.toString()+"]";
55     return str;
56   }
57
58   public int kind() {
59     return FKind.FlatNew;
60   }
61
62   public TempDescriptor [] writesTemps() {
63     return new TempDescriptor[] {dst};
64   }
65
66   public TempDescriptor [] readsTemps() {
67     if (size!=null)
68       return new TempDescriptor[] {size};
69     else
70       return new TempDescriptor[0];
71   }
72
73   public TempDescriptor getDst() {
74     return dst;
75   }
76
77   public TempDescriptor getSize() {
78     return size;
79   }
80
81   public TypeDescriptor getType() {
82     return type;
83   }
84 }