annotate dmd/CmpExp.d @ 178:e3afd1303184

Many small bugs fixed Made all classes derive from TObject to detect memory leaks (functionality is disabled for now) Began work on overriding backend memory allocations (to avoid memory leaks)
author korDen
date Sun, 17 Oct 2010 07:42:00 +0400
parents 6caaf0256da1
children b0d41ff5e0df
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
1 module dmd.CmpExp;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 79
diff changeset
3 import dmd.common;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
4 import dmd.Expression;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
5 import dmd.Identifier;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
6 import dmd.backend.elem;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
7 import dmd.InterState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
8 import dmd.Loc;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
9 import dmd.TOK;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
10 import dmd.Scope;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
11 import dmd.IRState;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.Id;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.ErrorExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.IntegerExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.MATCH;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.BinExp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.WANT;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.GlobalExpressions;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.expression.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.codegen.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 import dmd.expression.Cmp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 import dmd.backend.RTLSYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 import dmd.backend.TYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 import dmd.backend.OPER;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
30 import dmd.backend.rel;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
31
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 class CmpExp : BinExp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 this(TOK op, Loc loc, Expression e1, Expression e2)
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
35 {
178
e3afd1303184 Many small bugs fixed
korDen
parents: 115
diff changeset
36 register();
e3afd1303184 Many small bugs fixed
korDen
parents: 115
diff changeset
37
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 super(loc, op, CmpExp.sizeof, e1, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
41 override Expression semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 version (LOGSEMANTIC) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 printf("CmpExp.semantic('%s')\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 if (type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 BinExp.semanticp(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52
79
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
53 Type t1 = e1.type.toBasetype();
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
54 Type t2 = e2.type.toBasetype();
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
55 if (t1.ty == Tclass && e2.op == TOKnull ||
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
56 t2.ty == Tclass && e1.op == TOKnull)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 error("do not use null when comparing class types");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 e = op_overload(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 if (!e.type.isscalar() && e.type.equals(e1.type))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 error("recursive opCmp expansion");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 e = new ErrorExp();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 e = new CmpExp(op, loc, e, new IntegerExp(loc, 0, Type.tint32));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 e = e.semantic(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76
79
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
77 // Disallow comparing T[]==T and T==T[]
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
78 if (e1.op == TOKslice && t1.ty == Tarray && e2.implicitConvTo(t1.nextOf()) ||
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
79 e2.op == TOKslice && t2.ty == Tarray && e1.implicitConvTo(t2.nextOf()))
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
80 {
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
81 incompatibleTypes();
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
82 return new ErrorExp();
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
83 }
43073c7c7769 updated to 2.035
Trass3r
parents: 72
diff changeset
84
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 typeCombine(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 type = Type.tboolean;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 // Special handling for array comparisons
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 t1 = e1.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 t2 = e2.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 if ((t1.ty == Tarray || t1.ty == Tsarray || t1.ty == Tpointer) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 (t2.ty == Tarray || t2.ty == Tsarray || t2.ty == Tpointer))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 if (t1.nextOf().implicitConvTo(t2.nextOf()) < MATCHconst &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 t2.nextOf().implicitConvTo(t1.nextOf()) < MATCHconst &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 (t1.nextOf().ty != Tvoid && t2.nextOf().ty != Tvoid))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 error("array comparison type mismatch, %s vs %s", t1.nextOf().toChars(), t2.nextOf().toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 else if (t1.ty == Tstruct || t2.ty == Tstruct ||
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 (t1.ty == Tclass && t2.ty == Tclass))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 if (t2.ty == Tstruct)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 error("need member function opCmp() for %s %s to compare", t2.toDsymbol(sc).kind(), t2.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 error("need member function opCmp() for %s %s to compare", t1.toDsymbol(sc).kind(), t1.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 /// static if (true) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 else if (t1.iscomplex() || t2.iscomplex())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112 error("compare not defined for complex operands");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 e = new ErrorExp();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 /// }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 e1.rvalue();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119 e2.rvalue();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 //printf("CmpExp: %s, type = %s\n", e.toChars(), e.type.toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
127 override Expression optimize(int result)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131 //printf("CmpExp::optimize() %s\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 e1 = e1.optimize(WANTvalue | (result & WANTinterpret));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 e2 = e2.optimize(WANTvalue | (result & WANTinterpret));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 Expression e1 = fromConstInitializer(result, this.e1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 Expression e2 = fromConstInitializer(result, this.e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 e = Cmp(op, type, e1, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 if (e is EXP_CANT_INTERPRET)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
144 override Expression interpret(InterState istate)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 {
115
6caaf0256da1 + interpretation of (non-assign) binary expressions
Trass3r
parents: 114
diff changeset
146 return interpretCommon2(istate, &Cmp);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
149 override int isBit()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
154 override bool isCommutative()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 return true;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
159 override Identifier opId()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 return Id.cmp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
164 override elem* toElem(IRState* irs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 elem *e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 OPER eop;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 Type t1 = e1.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 Type t2 = e2.type.toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 switch (op)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 case TOKlt: eop = OPlt; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 case TOKgt: eop = OPgt; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 case TOKle: eop = OPle; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 case TOKge: eop = OPge; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 case TOKequal: eop = OPeqeq; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 case TOKnotequal: eop = OPne; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 // NCEG floating point compares
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 case TOKunord: eop = OPunord; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 case TOKlg: eop = OPlg; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 case TOKleg: eop = OPleg; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 case TOKule: eop = OPule; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 case TOKul: eop = OPul; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 case TOKuge: eop = OPuge; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 case TOKug: eop = OPug; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 case TOKue: eop = OPue; break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 default:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 dump(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 assert(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 if (!t1.isfloating())
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 // Convert from floating point compare to equivalent
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 // integral compare
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 eop = cast(OPER)rel_integral(eop);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 if (cast(int)eop > 1 && t1.ty == Tclass && t2.ty == Tclass)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 static if (true) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 assert(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 elem *ec1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 elem *ec2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 ec1 = e1.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 ec2 = e2.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 e = el_bin(OPcall,TYint,el_var(rtlsym[RTLSYM_OBJ_CMP]),el_param(ec1, ec2));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 e = el_bin(eop, TYint, e, el_long(TYint, 0));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 else if (cast(int)eop > 1 &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 (t1.ty == Tarray || t1.ty == Tsarray) &&
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 (t2.ty == Tarray || t2.ty == Tsarray))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 elem* ea1;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 elem* ea2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 elem* ep;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 Type telement = t1.nextOf().toBasetype();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 int rtlfunc;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223 ea1 = e1.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 ea1 = array_toDarray(t1, ea1);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 ea2 = e2.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 ea2 = array_toDarray(t2, ea2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 version (DMDV2) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 ep = el_params(telement.arrayOf().getInternalTypeInfo(null).toElem(irs),
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 ea2, ea1, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 rtlfunc = RTLSYM_ARRAYCMP2;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 ep = el_params(telement.getInternalTypeInfo(null).toElem(irs), ea2, ea1, null);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 rtlfunc = RTLSYM_ARRAYCMP;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 e = el_bin(OPcall, TYint, el_var(rtlsym[rtlfunc]), ep);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 e = el_bin(eop, TYint, e, el_long(TYint, 0));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 el_setLoc(e,loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 if (cast(int)eop <= 1)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 /* The result is determinate, create:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 * (e1 , e2) , eop
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 e = toElemBin(irs,OPcomma);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 e = el_bin(OPcomma,e.Ety,e,el_long(e.Ety,cast(int)eop));
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 e = toElemBin(irs,eop);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256