This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
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="";
39         if (dst==null)
40             st+=method.getSymbol()+"(";
41         else
42             st+=dst+"="+method.getSymbol()+"(";
43         if (this_temp!=null) {
44             st+=this_temp;
45             if (args.length!=0)
46                 st+=", ";
47         }
48
49         for(int i=0;i<args.length;i++) {
50             st+=args[i].toString();
51             if ((i+1)<args.length)
52                 st+=", ";
53         }
54         return st+")";
55     }
56
57     public int kind() {
58         return FKind.FlatCall;
59     }
60
61     public TempDescriptor [] readsTemps() {
62         int size=args.length;
63         if (this_temp!=null)
64             size++;
65         TempDescriptor [] t=new TempDescriptor[size];
66         int offset=0;
67         if (this_temp!=null)
68             t[offset++]=this_temp;
69         for(int i=0;i<args.length;i++)
70             t[offset++]=args[i];
71         return t;
72     }
73
74     public TempDescriptor [] writesTemps() {
75         if (dst!=null)
76             return new TempDescriptor[] {dst};
77         else
78             return new TempDescriptor[0];
79     }
80 }