Change tabbing for everything....
[IRC.git] / Robust / src / IR / Flat / FlatCall.java
1 package IR.Flat;
2 import IR.MethodDescriptor;
3
4 public class FlatCall extends FlatNode {
5   TempDescriptor args[];
6   TempDescriptor this_temp;
7   TempDescriptor dst;
8   MethodDescriptor method;
9
10   public FlatCall(MethodDescriptor md, TempDescriptor dst, TempDescriptor this_temp, TempDescriptor[] args) {
11     this.method=md;
12     this.dst=dst;
13     this.this_temp=this_temp;
14     this.args=args;
15   }
16
17   public MethodDescriptor getMethod() {
18     return method;
19   }
20
21   public TempDescriptor getThis() {
22     return this_temp;
23   }
24
25   public TempDescriptor getReturnTemp() {
26     return dst;
27   }
28
29   public int numArgs() {
30     return args.length;
31   }
32
33   public TempDescriptor getArg(int i) {
34     return args[i];
35   }
36
37   public String toString() {
38     String st="FlatCall_";
39     if (dst==null) {
40       if (method==null)
41         st+="null(";
42       else
43         st+=method.getSymbol()+"(";
44     } else
45       st+=dst+"="+method.getSymbol()+"(";
46     if (this_temp!=null) {
47       st+=this_temp;
48       if (args.length!=0)
49         st+=", ";
50     }
51
52     for(int i=0; i<args.length; i++) {
53       st+=args[i].toString();
54       if ((i+1)<args.length)
55         st+=", ";
56     }
57     return st+")";
58   }
59
60   public int kind() {
61     return FKind.FlatCall;
62   }
63
64   public TempDescriptor [] readsTemps() {
65     int size=args.length;
66     if (this_temp!=null)
67       size++;
68     TempDescriptor [] t=new TempDescriptor[size];
69     int offset=0;
70     if (this_temp!=null)
71       t[offset++]=this_temp;
72     for(int i=0; i<args.length; i++)
73       t[offset++]=args[i];
74     return t;
75   }
76
77   public TempDescriptor [] writesTemps() {
78     if (dst!=null)
79       return new TempDescriptor[] {dst};
80     else
81       return new TempDescriptor[0];
82   }
83 }