2 import IR.TypeDescriptor;
4 public class FlatNew extends FlatNode {
11 public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) {
17 this.isglobal=isglobal;
21 public void rewriteUse(TempMap t) {
24 public void rewriteDef(TempMap t) {
28 public FlatNode clone(TempMap t) {
29 return new FlatNew(type, t.tempMap(dst), t.tempMap(size), isglobal, disjointId);
32 public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, String disjointId) {
38 this.isglobal=isglobal;
39 this.disjointId=disjointId;
42 public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) {
48 this.isglobal=isglobal;
52 public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, String disjointId) {
58 this.isglobal=isglobal;
59 this.disjointId=disjointId;
62 public boolean isGlobal() {
66 public boolean isScratch() {
70 public String getDisjointId() {
74 public String toString() {
75 String str = "FlatNew_"+dst.toString()+"= NEW "+type.toString();
77 int numEmptyBrackets = type.getArrayCount();
81 for( int i = 0; i < numEmptyBrackets; ++i ) {
85 str += "["+size.toString()+"]";
95 public TempDescriptor [] writesTemps() {
96 return new TempDescriptor[] {dst};
99 public TempDescriptor [] readsTemps() {
101 return new TempDescriptor[] {size};
103 return new TempDescriptor[0];
106 public TempDescriptor getDst() {
110 public TempDescriptor getSize() {
114 public TypeDescriptor getType() {