annotate dmd/CmpExp.d @ 114:e28b18c23469

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