Mercurial > projects > ldc
annotate dmd/expression.h @ 1146:1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
* Added #if IN_DMD versioning around DMD backend specific code in the D1 frontend, D2 is currently broken.
* All part of a greater cleanup scheme.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 26 Mar 2009 20:45:53 +0100 |
parents | b30fe7e1dbb9 |
children | 3cf0066e6faf |
rev | line source |
---|---|
159 | 1 |
2 // Compiler implementation of the D programming language | |
336 | 3 // Copyright (c) 1999-2008 by Digital Mars |
159 | 4 // All Rights Reserved |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_EXPRESSION_H | |
12 #define DMD_EXPRESSION_H | |
13 | |
14 #include "mars.h" | |
15 #include "identifier.h" | |
16 #include "lexer.h" | |
17 #include "arraytypes.h" | |
18 | |
19 struct Type; | |
20 struct Scope; | |
21 struct TupleDeclaration; | |
22 struct VarDeclaration; | |
23 struct FuncDeclaration; | |
24 struct FuncLiteralDeclaration; | |
25 struct Declaration; | |
26 struct CtorDeclaration; | |
27 struct NewDeclaration; | |
28 struct Dsymbol; | |
29 struct Import; | |
30 struct Module; | |
31 struct ScopeDsymbol; | |
32 struct InlineCostState; | |
33 struct InlineDoState; | |
34 struct InlineScanState; | |
35 struct Expression; | |
36 struct Declaration; | |
37 struct AggregateDeclaration; | |
38 struct StructDeclaration; | |
39 struct TemplateInstance; | |
40 struct TemplateDeclaration; | |
41 struct ClassDeclaration; | |
42 struct HdrGenState; | |
43 struct BinExp; | |
44 struct InterState; | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
45 struct OverloadSet; |
159 | 46 |
47 enum TOK; | |
48 | |
49 // Back end | |
50 struct IRState; | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
51 |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
52 #if IN_DMD |
159 | 53 struct dt_t; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
54 struct elem; |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
55 struct Symbol; // back end symbol |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
56 #endif |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
57 |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
58 #ifdef IN_GCC |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
59 union tree_node; typedef union tree_node elem; |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
60 #endif |
159 | 61 |
62 #if IN_LLVM | |
63 struct DValue; | |
64 typedef DValue elem; | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
65 |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
66 namespace llvm |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
67 { |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
68 class Constant; |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
69 class ConstantInt; |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
70 } |
159 | 71 #endif |
72 | |
73 void initPrecedence(); | |
74 | |
75 Expression *resolveProperties(Scope *sc, Expression *e); | |
76 void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d); | |
77 Dsymbol *search_function(AggregateDeclaration *ad, Identifier *funcid); | |
78 void inferApplyArgTypes(enum TOK op, Arguments *arguments, Expression *aggr); | |
79 void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); | |
80 void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); | |
81 void expandTuples(Expressions *exps); | |
82 FuncDeclaration *hasThis(Scope *sc); | |
83 Expression *fromConstInitializer(int result, Expression *e); | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
876
diff
changeset
|
84 int arrayExpressionCanThrow(Expressions *exps); |
159 | 85 |
86 struct Expression : Object | |
87 { | |
88 Loc loc; // file location | |
89 enum TOK op; // handy to minimize use of dynamic_cast | |
90 Type *type; // !=NULL means that semantic() has been run | |
91 int size; // # of bytes in Expression so we can copy() it | |
92 | |
93 Expression(Loc loc, enum TOK op, int size); | |
94 Expression *copy(); | |
95 virtual Expression *syntaxCopy(); | |
96 virtual Expression *semantic(Scope *sc); | |
97 | |
98 int dyncast() { return DYNCAST_EXPRESSION; } // kludge for template.isExpression() | |
99 | |
100 void print(); | |
101 char *toChars(); | |
102 virtual void dump(int indent); | |
103 void error(const char *format, ...); | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
876
diff
changeset
|
104 void warning(const char *format, ...); |
159 | 105 virtual void rvalue(); |
106 | |
107 static Expression *combine(Expression *e1, Expression *e2); | |
108 static Expressions *arraySyntaxCopy(Expressions *exps); | |
109 | |
110 virtual integer_t toInteger(); | |
111 virtual uinteger_t toUInteger(); | |
112 virtual real_t toReal(); | |
113 virtual real_t toImaginary(); | |
114 virtual complex_t toComplex(); | |
115 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
116 virtual void toMangleBuffer(OutBuffer *buf); | |
117 virtual Expression *toLvalue(Scope *sc, Expression *e); | |
118 virtual Expression *modifiableLvalue(Scope *sc, Expression *e); | |
119 Expression *implicitCastTo(Scope *sc, Type *t); | |
120 virtual MATCH implicitConvTo(Type *t); | |
121 virtual Expression *castTo(Scope *sc, Type *t); | |
122 virtual void checkEscape(); | |
123 void checkScalar(); | |
124 void checkNoBool(); | |
125 Expression *checkIntegral(); | |
126 Expression *checkArithmetic(); | |
127 void checkDeprecated(Scope *sc, Dsymbol *s); | |
128 virtual Expression *checkToBoolean(); | |
129 Expression *checkToPointer(); | |
130 Expression *addressOf(Scope *sc); | |
131 Expression *deref(); | |
132 Expression *integralPromotions(Scope *sc); | |
133 | |
134 Expression *toDelegate(Scope *sc, Type *t); | |
135 virtual void scanForNestedRef(Scope *sc); | |
136 | |
137 virtual Expression *optimize(int result); | |
138 #define WANTflags 1 | |
139 #define WANTvalue 2 | |
140 #define WANTinterpret 4 | |
141 | |
142 virtual Expression *interpret(InterState *istate); | |
143 | |
144 virtual int isConst(); | |
145 virtual int isBool(int result); | |
146 virtual int isBit(); | |
147 virtual int checkSideEffect(int flag); | |
336 | 148 virtual int canThrow(); |
159 | 149 |
150 virtual int inlineCost(InlineCostState *ics); | |
151 virtual Expression *doInline(InlineDoState *ids); | |
152 virtual Expression *inlineScan(InlineScanState *iss); | |
153 | |
154 // For operator overloading | |
155 virtual int isCommutative(); | |
156 virtual Identifier *opId(); | |
157 virtual Identifier *opId_r(); | |
158 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
159 // For array ops |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
160 virtual void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
161 virtual Expression *buildArrayLoop(Arguments *fparams); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
162 |
159 | 163 // Back end |
164 virtual elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
165 #if IN_DMD |
159 | 166 virtual dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
167 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
168 // LDC |
159 | 169 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
170 #endif |
159 | 171 }; |
172 | |
173 struct IntegerExp : Expression | |
174 { | |
175 integer_t value; | |
176 | |
177 IntegerExp(Loc loc, integer_t value, Type *type); | |
178 IntegerExp(integer_t value); | |
179 int equals(Object *o); | |
180 Expression *semantic(Scope *sc); | |
181 Expression *interpret(InterState *istate); | |
182 char *toChars(); | |
183 void dump(int indent); | |
184 integer_t toInteger(); | |
185 real_t toReal(); | |
186 real_t toImaginary(); | |
187 complex_t toComplex(); | |
188 int isConst(); | |
189 int isBool(int result); | |
190 MATCH implicitConvTo(Type *t); | |
191 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
192 void toMangleBuffer(OutBuffer *buf); | |
193 Expression *toLvalue(Scope *sc, Expression *e); | |
194 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
195 #if IN_DMD |
159 | 196 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
197 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
198 // LDC |
159 | 199 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
200 #endif |
159 | 201 }; |
202 | |
203 struct RealExp : Expression | |
204 { | |
205 real_t value; | |
206 | |
207 RealExp(Loc loc, real_t value, Type *type); | |
208 int equals(Object *o); | |
209 Expression *semantic(Scope *sc); | |
210 Expression *interpret(InterState *istate); | |
211 char *toChars(); | |
212 integer_t toInteger(); | |
213 uinteger_t toUInteger(); | |
214 real_t toReal(); | |
215 real_t toImaginary(); | |
216 complex_t toComplex(); | |
217 Expression *castTo(Scope *sc, Type *t); | |
218 int isConst(); | |
219 int isBool(int result); | |
220 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
221 void toMangleBuffer(OutBuffer *buf); | |
222 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
223 #if IN_DMD |
159 | 224 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
225 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
226 // LDC |
159 | 227 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
228 #endif |
159 | 229 }; |
230 | |
231 struct ComplexExp : Expression | |
232 { | |
233 complex_t value; | |
234 | |
235 ComplexExp(Loc loc, complex_t value, Type *type); | |
236 int equals(Object *o); | |
237 Expression *semantic(Scope *sc); | |
238 Expression *interpret(InterState *istate); | |
239 char *toChars(); | |
240 integer_t toInteger(); | |
241 uinteger_t toUInteger(); | |
242 real_t toReal(); | |
243 real_t toImaginary(); | |
244 complex_t toComplex(); | |
245 Expression *castTo(Scope *sc, Type *t); | |
246 int isConst(); | |
247 int isBool(int result); | |
248 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
249 void toMangleBuffer(OutBuffer *buf); | |
250 #ifdef _DH | |
251 OutBuffer hexp; | |
252 #endif | |
253 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
254 #if IN_DMD |
159 | 255 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
256 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
257 // LDC |
159 | 258 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
259 #endif |
159 | 260 }; |
261 | |
262 struct IdentifierExp : Expression | |
263 { | |
264 Identifier *ident; | |
265 Declaration *var; | |
266 | |
267 IdentifierExp(Loc loc, Identifier *ident); | |
268 IdentifierExp(Loc loc, Declaration *var); | |
269 Expression *semantic(Scope *sc); | |
270 char *toChars(); | |
271 void dump(int indent); | |
272 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
273 Expression *toLvalue(Scope *sc, Expression *e); | |
274 }; | |
275 | |
276 struct DollarExp : IdentifierExp | |
277 { | |
278 DollarExp(Loc loc); | |
279 }; | |
280 | |
281 struct DsymbolExp : Expression | |
282 { | |
283 Dsymbol *s; | |
284 | |
285 DsymbolExp(Loc loc, Dsymbol *s); | |
286 Expression *semantic(Scope *sc); | |
287 char *toChars(); | |
288 void dump(int indent); | |
289 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
290 Expression *toLvalue(Scope *sc, Expression *e); | |
291 }; | |
292 | |
293 struct ThisExp : Expression | |
294 { | |
295 Declaration *var; | |
296 | |
297 ThisExp(Loc loc); | |
298 Expression *semantic(Scope *sc); | |
299 int isBool(int result); | |
300 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
301 Expression *toLvalue(Scope *sc, Expression *e); | |
302 void scanForNestedRef(Scope *sc); | |
303 | |
304 int inlineCost(InlineCostState *ics); | |
305 Expression *doInline(InlineDoState *ids); | |
306 //Expression *inlineScan(InlineScanState *iss); | |
307 | |
308 elem *toElem(IRState *irs); | |
309 }; | |
310 | |
311 struct SuperExp : ThisExp | |
312 { | |
313 SuperExp(Loc loc); | |
314 Expression *semantic(Scope *sc); | |
315 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
316 void scanForNestedRef(Scope *sc); | |
317 | |
318 int inlineCost(InlineCostState *ics); | |
319 Expression *doInline(InlineDoState *ids); | |
320 //Expression *inlineScan(InlineScanState *iss); | |
321 }; | |
322 | |
323 struct NullExp : Expression | |
324 { | |
325 unsigned char committed; // !=0 if type is committed | |
326 | |
327 NullExp(Loc loc); | |
328 Expression *semantic(Scope *sc); | |
329 int isBool(int result); | |
330 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
331 void toMangleBuffer(OutBuffer *buf); | |
332 MATCH implicitConvTo(Type *t); | |
333 Expression *castTo(Scope *sc, Type *t); | |
334 Expression *interpret(InterState *istate); | |
335 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
336 #if IN_DMD |
159 | 337 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
338 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
339 // LDC |
159 | 340 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
341 #endif |
159 | 342 }; |
343 | |
344 struct StringExp : Expression | |
345 { | |
346 void *string; // char, wchar, or dchar data | |
347 size_t len; // number of chars, wchars, or dchars | |
348 unsigned char sz; // 1: char, 2: wchar, 4: dchar | |
349 unsigned char committed; // !=0 if type is committed | |
350 unsigned char postfix; // 'c', 'w', 'd' | |
351 | |
352 StringExp(Loc loc, char *s); | |
353 StringExp(Loc loc, void *s, size_t len); | |
354 StringExp(Loc loc, void *s, size_t len, unsigned char postfix); | |
355 //Expression *syntaxCopy(); | |
356 int equals(Object *o); | |
357 char *toChars(); | |
358 Expression *semantic(Scope *sc); | |
359 Expression *interpret(InterState *istate); | |
360 StringExp *toUTF8(Scope *sc); | |
361 MATCH implicitConvTo(Type *t); | |
362 Expression *castTo(Scope *sc, Type *t); | |
363 int compare(Object *obj); | |
364 int isBool(int result); | |
365 unsigned charAt(size_t i); | |
366 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
367 void toMangleBuffer(OutBuffer *buf); | |
368 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
369 #if IN_DMD |
159 | 370 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
371 #elif IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
372 // LDC |
159 | 373 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
374 #endif |
159 | 375 }; |
376 | |
377 // Tuple | |
378 | |
379 struct TupleExp : Expression | |
380 { | |
381 Expressions *exps; | |
382 | |
383 TupleExp(Loc loc, Expressions *exps); | |
384 TupleExp(Loc loc, TupleDeclaration *tup); | |
385 Expression *syntaxCopy(); | |
386 int equals(Object *o); | |
387 Expression *semantic(Scope *sc); | |
388 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
389 void scanForNestedRef(Scope *sc); | |
390 void checkEscape(); | |
391 int checkSideEffect(int flag); | |
392 Expression *optimize(int result); | |
393 Expression *interpret(InterState *istate); | |
394 Expression *castTo(Scope *sc, Type *t); | |
395 elem *toElem(IRState *irs); | |
396 | |
397 int inlineCost(InlineCostState *ics); | |
398 Expression *doInline(InlineDoState *ids); | |
399 Expression *inlineScan(InlineScanState *iss); | |
400 }; | |
401 | |
402 struct ArrayLiteralExp : Expression | |
403 { | |
404 Expressions *elements; | |
405 | |
406 ArrayLiteralExp(Loc loc, Expressions *elements); | |
407 ArrayLiteralExp(Loc loc, Expression *e); | |
408 | |
409 Expression *syntaxCopy(); | |
410 Expression *semantic(Scope *sc); | |
411 int isBool(int result); | |
412 elem *toElem(IRState *irs); | |
413 int checkSideEffect(int flag); | |
414 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
415 void toMangleBuffer(OutBuffer *buf); | |
416 void scanForNestedRef(Scope *sc); | |
417 Expression *optimize(int result); | |
418 Expression *interpret(InterState *istate); | |
419 MATCH implicitConvTo(Type *t); | |
420 Expression *castTo(Scope *sc, Type *t); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
421 #if IN_DMD |
159 | 422 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
423 #elif IN_LLVM |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
424 // LDC |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
425 virtual llvm::Constant *toConstElem(IRState *irs); |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
426 #endif |
159 | 427 |
428 int inlineCost(InlineCostState *ics); | |
429 Expression *doInline(InlineDoState *ids); | |
430 Expression *inlineScan(InlineScanState *iss); | |
431 }; | |
432 | |
433 struct AssocArrayLiteralExp : Expression | |
434 { | |
435 Expressions *keys; | |
436 Expressions *values; | |
437 | |
438 AssocArrayLiteralExp(Loc loc, Expressions *keys, Expressions *values); | |
439 | |
440 Expression *syntaxCopy(); | |
441 Expression *semantic(Scope *sc); | |
442 int isBool(int result); | |
443 elem *toElem(IRState *irs); | |
444 int checkSideEffect(int flag); | |
445 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
446 void toMangleBuffer(OutBuffer *buf); | |
447 void scanForNestedRef(Scope *sc); | |
448 Expression *optimize(int result); | |
449 Expression *interpret(InterState *istate); | |
450 MATCH implicitConvTo(Type *t); | |
451 Expression *castTo(Scope *sc, Type *t); | |
452 | |
453 int inlineCost(InlineCostState *ics); | |
454 Expression *doInline(InlineDoState *ids); | |
455 Expression *inlineScan(InlineScanState *iss); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
456 #if IN_LLVM |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
457 // LDC |
159 | 458 virtual llvm::Constant *toConstElem(IRState *irs); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
459 #endif |
159 | 460 }; |
461 | |
462 struct StructLiteralExp : Expression | |
463 { | |
464 StructDeclaration *sd; // which aggregate this is for | |
465 Expressions *elements; // parallels sd->fields[] with | |
466 // NULL entries for fields to skip | |
467 | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
468 #if IN_DMD |
159 | 469 Symbol *sym; // back end symbol to initialize with literal |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
470 #endif |
159 | 471 size_t soffset; // offset from start of s |
472 int fillHoles; // fill alignment 'holes' with zero | |
473 | |
474 StructLiteralExp(Loc loc, StructDeclaration *sd, Expressions *elements); | |
475 | |
476 Expression *syntaxCopy(); | |
477 Expression *semantic(Scope *sc); | |
478 Expression *getField(Type *type, unsigned offset); | |
479 int getFieldIndex(Type *type, unsigned offset); | |
480 elem *toElem(IRState *irs); | |
481 int checkSideEffect(int flag); | |
482 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
483 void toMangleBuffer(OutBuffer *buf); | |
484 void scanForNestedRef(Scope *sc); | |
485 Expression *optimize(int result); | |
486 Expression *interpret(InterState *istate); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
487 #if IN_DMD |
159 | 488 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
489 #elif IN_LLVM |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
490 // LDC |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
491 virtual llvm::Constant *toConstElem(IRState *irs); |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
492 #endif |
159 | 493 Expression *toLvalue(Scope *sc, Expression *e); |
494 | |
495 int inlineCost(InlineCostState *ics); | |
496 Expression *doInline(InlineDoState *ids); | |
497 Expression *inlineScan(InlineScanState *iss); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
498 |
159 | 499 }; |
500 | |
501 struct TypeDotIdExp : Expression | |
502 { | |
503 Identifier *ident; | |
504 | |
505 TypeDotIdExp(Loc loc, Type *type, Identifier *ident); | |
506 Expression *syntaxCopy(); | |
507 Expression *semantic(Scope *sc); | |
508 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
509 elem *toElem(IRState *irs); | |
510 }; | |
511 | |
512 struct TypeExp : Expression | |
513 { | |
514 TypeExp(Loc loc, Type *type); | |
876
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
875
diff
changeset
|
515 Expression *syntaxCopy(); |
159 | 516 Expression *semantic(Scope *sc); |
517 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
518 Expression *optimize(int result); | |
519 elem *toElem(IRState *irs); | |
520 }; | |
521 | |
522 struct ScopeExp : Expression | |
523 { | |
524 ScopeDsymbol *sds; | |
525 | |
526 ScopeExp(Loc loc, ScopeDsymbol *sds); | |
527 Expression *syntaxCopy(); | |
528 Expression *semantic(Scope *sc); | |
529 elem *toElem(IRState *irs); | |
530 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
531 }; | |
532 | |
533 struct TemplateExp : Expression | |
534 { | |
535 TemplateDeclaration *td; | |
536 | |
537 TemplateExp(Loc loc, TemplateDeclaration *td); | |
538 void rvalue(); | |
539 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
540 }; | |
541 | |
542 struct NewExp : Expression | |
543 { | |
544 /* thisexp.new(newargs) newtype(arguments) | |
545 */ | |
546 Expression *thisexp; // if !NULL, 'this' for class being allocated | |
547 Expressions *newargs; // Array of Expression's to call new operator | |
548 Type *newtype; | |
549 Expressions *arguments; // Array of Expression's | |
550 | |
551 CtorDeclaration *member; // constructor function | |
552 NewDeclaration *allocator; // allocator function | |
553 int onstack; // allocate on stack | |
554 | |
555 NewExp(Loc loc, Expression *thisexp, Expressions *newargs, | |
556 Type *newtype, Expressions *arguments); | |
557 Expression *syntaxCopy(); | |
558 Expression *semantic(Scope *sc); | |
559 elem *toElem(IRState *irs); | |
560 int checkSideEffect(int flag); | |
561 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
562 void scanForNestedRef(Scope *sc); | |
563 | |
564 //int inlineCost(InlineCostState *ics); | |
565 Expression *doInline(InlineDoState *ids); | |
566 //Expression *inlineScan(InlineScanState *iss); | |
567 }; | |
568 | |
569 struct NewAnonClassExp : Expression | |
570 { | |
571 /* thisexp.new(newargs) class baseclasses { } (arguments) | |
572 */ | |
573 Expression *thisexp; // if !NULL, 'this' for class being allocated | |
574 Expressions *newargs; // Array of Expression's to call new operator | |
575 ClassDeclaration *cd; // class being instantiated | |
576 Expressions *arguments; // Array of Expression's to call class constructor | |
577 | |
578 NewAnonClassExp(Loc loc, Expression *thisexp, Expressions *newargs, | |
579 ClassDeclaration *cd, Expressions *arguments); | |
580 Expression *syntaxCopy(); | |
581 Expression *semantic(Scope *sc); | |
582 int checkSideEffect(int flag); | |
583 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
584 }; | |
585 | |
586 // Offset from symbol | |
587 | |
588 struct SymOffExp : Expression | |
589 { | |
590 Declaration *var; | |
591 unsigned offset; | |
592 | |
593 SymOffExp(Loc loc, Declaration *var, unsigned offset); | |
594 Expression *semantic(Scope *sc); | |
595 void checkEscape(); | |
596 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
597 int isConst(); | |
598 int isBool(int result); | |
599 Expression *doInline(InlineDoState *ids); | |
600 MATCH implicitConvTo(Type *t); | |
601 Expression *castTo(Scope *sc, Type *t); | |
602 void scanForNestedRef(Scope *sc); | |
603 | |
604 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
605 #if IN_DMD |
159 | 606 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
607 #endif |
159 | 608 }; |
609 | |
610 // Variable | |
611 | |
612 struct VarExp : Expression | |
613 { | |
614 Declaration *var; | |
615 | |
616 VarExp(Loc loc, Declaration *var); | |
617 int equals(Object *o); | |
618 Expression *semantic(Scope *sc); | |
619 Expression *optimize(int result); | |
620 Expression *interpret(InterState *istate); | |
621 void dump(int indent); | |
622 char *toChars(); | |
623 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
624 void checkEscape(); | |
625 Expression *toLvalue(Scope *sc, Expression *e); | |
626 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
627 elem *toElem(IRState *irs); | |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
628 #if IN_DMD |
159 | 629 dt_t **toDt(dt_t **pdt); |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
630 #elif IN_LLVM |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
631 // LDC |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
632 virtual llvm::Constant *toConstElem(IRState *irs); |
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
633 #endif |
159 | 634 void scanForNestedRef(Scope *sc); |
635 | |
636 int inlineCost(InlineCostState *ics); | |
637 Expression *doInline(InlineDoState *ids); | |
638 //Expression *inlineScan(InlineScanState *iss); | |
639 }; | |
640 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
641 #if DMDV2 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
642 // Overload Set |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
643 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
644 struct OverExp : Expression |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
645 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
646 OverloadSet *vars; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
647 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
648 OverExp(OverloadSet *s); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
649 int isLvalue(); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
650 Expression *toLvalue(Scope *sc, Expression *e); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
651 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
652 #endif |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
653 |
159 | 654 // Function/Delegate literal |
655 | |
656 struct FuncExp : Expression | |
657 { | |
658 FuncLiteralDeclaration *fd; | |
659 | |
660 FuncExp(Loc loc, FuncLiteralDeclaration *fd); | |
661 Expression *syntaxCopy(); | |
662 Expression *semantic(Scope *sc); | |
663 void scanForNestedRef(Scope *sc); | |
664 char *toChars(); | |
665 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
666 elem *toElem(IRState *irs); | |
667 | |
668 int inlineCost(InlineCostState *ics); | |
669 //Expression *doInline(InlineDoState *ids); | |
670 //Expression *inlineScan(InlineScanState *iss); | |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
664
diff
changeset
|
671 |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
664
diff
changeset
|
672 // LDC |
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
664
diff
changeset
|
673 virtual llvm::Constant *toConstElem(IRState *irs); |
159 | 674 }; |
675 | |
676 // Declaration of a symbol | |
677 | |
678 struct DeclarationExp : Expression | |
679 { | |
680 Dsymbol *declaration; | |
681 | |
682 DeclarationExp(Loc loc, Dsymbol *declaration); | |
683 Expression *syntaxCopy(); | |
684 Expression *semantic(Scope *sc); | |
685 Expression *interpret(InterState *istate); | |
686 int checkSideEffect(int flag); | |
687 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
688 elem *toElem(IRState *irs); | |
689 void scanForNestedRef(Scope *sc); | |
690 | |
691 int inlineCost(InlineCostState *ics); | |
692 Expression *doInline(InlineDoState *ids); | |
693 Expression *inlineScan(InlineScanState *iss); | |
694 }; | |
695 | |
696 struct TypeidExp : Expression | |
697 { | |
698 Type *typeidType; | |
699 | |
700 TypeidExp(Loc loc, Type *typeidType); | |
701 Expression *syntaxCopy(); | |
702 Expression *semantic(Scope *sc); | |
703 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
704 }; | |
705 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
706 #if DMDV2 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
707 struct TraitsExp : Expression |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
708 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
709 Identifier *ident; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
710 Objects *args; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
711 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
712 TraitsExp(Loc loc, Identifier *ident, Objects *args); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
713 Expression *syntaxCopy(); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
714 Expression *semantic(Scope *sc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
715 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
716 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
717 #endif |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
718 |
159 | 719 struct HaltExp : Expression |
720 { | |
721 HaltExp(Loc loc); | |
722 Expression *semantic(Scope *sc); | |
723 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
724 int checkSideEffect(int flag); | |
725 | |
726 elem *toElem(IRState *irs); | |
727 }; | |
728 | |
729 struct IsExp : Expression | |
730 { | |
731 /* is(targ id tok tspec) | |
732 * is(targ id == tok2) | |
733 */ | |
734 Type *targ; | |
735 Identifier *id; // can be NULL | |
736 enum TOK tok; // ':' or '==' | |
737 Type *tspec; // can be NULL | |
738 enum TOK tok2; // 'struct', 'union', 'typedef', etc. | |
739 | |
740 IsExp(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec, enum TOK tok2); | |
741 Expression *syntaxCopy(); | |
742 Expression *semantic(Scope *sc); | |
743 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
744 }; | |
745 | |
746 /****************************************************************/ | |
747 | |
748 struct UnaExp : Expression | |
749 { | |
750 Expression *e1; | |
751 | |
752 UnaExp(Loc loc, enum TOK op, int size, Expression *e1); | |
753 Expression *syntaxCopy(); | |
754 Expression *semantic(Scope *sc); | |
755 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
756 Expression *optimize(int result); | |
757 void dump(int indent); | |
758 void scanForNestedRef(Scope *sc); | |
759 Expression *interpretCommon(InterState *istate, Expression *(*fp)(Type *, Expression *)); | |
760 | |
761 int inlineCost(InlineCostState *ics); | |
762 Expression *doInline(InlineDoState *ids); | |
763 Expression *inlineScan(InlineScanState *iss); | |
764 | |
765 Expression *op_overload(Scope *sc); // doesn't need to be virtual | |
766 }; | |
767 | |
768 struct BinExp : Expression | |
769 { | |
770 Expression *e1; | |
771 Expression *e2; | |
772 | |
773 BinExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2); | |
774 Expression *syntaxCopy(); | |
775 Expression *semantic(Scope *sc); | |
776 Expression *semanticp(Scope *sc); | |
777 Expression *commonSemanticAssign(Scope *sc); | |
778 Expression *commonSemanticAssignIntegral(Scope *sc); | |
779 int checkSideEffect(int flag); | |
780 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
781 Expression *scaleFactor(Scope *sc); | |
782 Expression *typeCombine(Scope *sc); | |
783 Expression *optimize(int result); | |
784 int isunsigned(); | |
785 void incompatibleTypes(); | |
786 void dump(int indent); | |
787 void scanForNestedRef(Scope *sc); | |
788 Expression *interpretCommon(InterState *istate, Expression *(*fp)(Type *, Expression *, Expression *)); | |
789 Expression *interpretCommon2(InterState *istate, Expression *(*fp)(TOK, Type *, Expression *, Expression *)); | |
790 Expression *interpretAssignCommon(InterState *istate, Expression *(*fp)(Type *, Expression *, Expression *), int post = 0); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
791 Expression *arrayOp(Scope *sc); |
159 | 792 |
793 int inlineCost(InlineCostState *ics); | |
794 Expression *doInline(InlineDoState *ids); | |
795 Expression *inlineScan(InlineScanState *iss); | |
796 | |
797 Expression *op_overload(Scope *sc); | |
798 | |
799 elem *toElemBin(IRState *irs, int op); | |
800 }; | |
801 | |
802 struct BinAssignExp : BinExp | |
803 { | |
804 BinAssignExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2); | |
805 int checkSideEffect(int flag); | |
806 }; | |
807 | |
808 /****************************************************************/ | |
809 | |
810 struct CompileExp : UnaExp | |
811 { | |
812 CompileExp(Loc loc, Expression *e); | |
813 Expression *semantic(Scope *sc); | |
814 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
815 }; | |
816 | |
817 struct FileExp : UnaExp | |
818 { | |
819 FileExp(Loc loc, Expression *e); | |
820 Expression *semantic(Scope *sc); | |
821 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
822 }; | |
823 | |
824 struct AssertExp : UnaExp | |
825 { | |
826 Expression *msg; | |
827 | |
828 AssertExp(Loc loc, Expression *e, Expression *msg = NULL); | |
829 Expression *syntaxCopy(); | |
830 Expression *semantic(Scope *sc); | |
831 Expression *interpret(InterState *istate); | |
832 int checkSideEffect(int flag); | |
833 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
834 | |
835 int inlineCost(InlineCostState *ics); | |
836 Expression *doInline(InlineDoState *ids); | |
837 Expression *inlineScan(InlineScanState *iss); | |
838 | |
839 elem *toElem(IRState *irs); | |
840 }; | |
841 | |
842 struct DotIdExp : UnaExp | |
843 { | |
844 Identifier *ident; | |
845 | |
846 DotIdExp(Loc loc, Expression *e, Identifier *ident); | |
847 Expression *semantic(Scope *sc); | |
848 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
849 void dump(int i); | |
850 }; | |
851 | |
852 struct DotTemplateExp : UnaExp | |
853 { | |
854 TemplateDeclaration *td; | |
855 | |
856 DotTemplateExp(Loc loc, Expression *e, TemplateDeclaration *td); | |
857 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
858 }; | |
859 | |
860 struct DotVarExp : UnaExp | |
861 { | |
862 Declaration *var; | |
863 | |
864 DotVarExp(Loc loc, Expression *e, Declaration *var); | |
865 Expression *semantic(Scope *sc); | |
866 Expression *toLvalue(Scope *sc, Expression *e); | |
867 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
875
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
860
diff
changeset
|
868 Expression *optimize(int result); |
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
860
diff
changeset
|
869 Expression *interpret(InterState *istate); |
159 | 870 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
871 void dump(int indent); | |
872 elem *toElem(IRState *irs); | |
873 }; | |
874 | |
875 struct DotTemplateInstanceExp : UnaExp | |
876 { | |
877 TemplateInstance *ti; | |
878 | |
879 DotTemplateInstanceExp(Loc loc, Expression *e, TemplateInstance *ti); | |
880 Expression *syntaxCopy(); | |
881 Expression *semantic(Scope *sc); | |
882 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
883 void dump(int indent); | |
884 }; | |
885 | |
886 struct DelegateExp : UnaExp | |
887 { | |
888 FuncDeclaration *func; | |
889 | |
890 DelegateExp(Loc loc, Expression *e, FuncDeclaration *func); | |
891 Expression *semantic(Scope *sc); | |
892 MATCH implicitConvTo(Type *t); | |
893 Expression *castTo(Scope *sc, Type *t); | |
894 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
895 void dump(int indent); | |
896 | |
897 int inlineCost(InlineCostState *ics); | |
898 elem *toElem(IRState *irs); | |
899 }; | |
900 | |
901 struct DotTypeExp : UnaExp | |
902 { | |
903 Dsymbol *sym; // symbol that represents a type | |
904 | |
905 DotTypeExp(Loc loc, Expression *e, Dsymbol *sym); | |
906 Expression *semantic(Scope *sc); | |
907 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
908 elem *toElem(IRState *irs); | |
909 }; | |
910 | |
911 struct CallExp : UnaExp | |
912 { | |
913 Expressions *arguments; // function arguments | |
914 | |
915 CallExp(Loc loc, Expression *e, Expressions *exps); | |
916 CallExp(Loc loc, Expression *e); | |
917 CallExp(Loc loc, Expression *e, Expression *earg1); | |
918 CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2); | |
919 | |
920 Expression *syntaxCopy(); | |
921 Expression *semantic(Scope *sc); | |
922 Expression *optimize(int result); | |
923 Expression *interpret(InterState *istate); | |
924 int checkSideEffect(int flag); | |
925 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
926 void dump(int indent); | |
927 elem *toElem(IRState *irs); | |
928 void scanForNestedRef(Scope *sc); | |
929 Expression *toLvalue(Scope *sc, Expression *e); | |
930 | |
931 int inlineCost(InlineCostState *ics); | |
932 Expression *doInline(InlineDoState *ids); | |
933 Expression *inlineScan(InlineScanState *iss); | |
934 }; | |
935 | |
936 struct AddrExp : UnaExp | |
937 { | |
938 AddrExp(Loc loc, Expression *e); | |
939 Expression *semantic(Scope *sc); | |
940 elem *toElem(IRState *irs); | |
941 MATCH implicitConvTo(Type *t); | |
942 Expression *castTo(Scope *sc, Type *t); | |
943 Expression *optimize(int result); | |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
944 // LDC |
459
9db9099583ca
Implement a rough AddrExp::toConstElem()
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
945 virtual llvm::Constant *toConstElem(IRState *irs); |
159 | 946 }; |
947 | |
948 struct PtrExp : UnaExp | |
949 { | |
950 PtrExp(Loc loc, Expression *e); | |
951 PtrExp(Loc loc, Expression *e, Type *t); | |
952 Expression *semantic(Scope *sc); | |
953 Expression *toLvalue(Scope *sc, Expression *e); | |
954 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
955 elem *toElem(IRState *irs); | |
956 Expression *optimize(int result); | |
957 Expression *interpret(InterState *istate); | |
958 }; | |
959 | |
960 struct NegExp : UnaExp | |
961 { | |
962 NegExp(Loc loc, Expression *e); | |
963 Expression *semantic(Scope *sc); | |
964 Expression *optimize(int result); | |
965 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
966 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
967 Expression *buildArrayLoop(Arguments *fparams); |
159 | 968 |
969 // For operator overloading | |
970 Identifier *opId(); | |
971 | |
972 elem *toElem(IRState *irs); | |
973 }; | |
974 | |
975 struct UAddExp : UnaExp | |
976 { | |
977 UAddExp(Loc loc, Expression *e); | |
978 Expression *semantic(Scope *sc); | |
979 | |
980 // For operator overloading | |
981 Identifier *opId(); | |
982 }; | |
983 | |
984 struct ComExp : UnaExp | |
985 { | |
986 ComExp(Loc loc, Expression *e); | |
987 Expression *semantic(Scope *sc); | |
988 Expression *optimize(int result); | |
989 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
990 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
991 Expression *buildArrayLoop(Arguments *fparams); |
159 | 992 |
993 // For operator overloading | |
994 Identifier *opId(); | |
995 | |
996 elem *toElem(IRState *irs); | |
997 }; | |
998 | |
999 struct NotExp : UnaExp | |
1000 { | |
1001 NotExp(Loc loc, Expression *e); | |
1002 Expression *semantic(Scope *sc); | |
1003 Expression *optimize(int result); | |
1004 Expression *interpret(InterState *istate); | |
1005 int isBit(); | |
1006 elem *toElem(IRState *irs); | |
1007 }; | |
1008 | |
1009 struct BoolExp : UnaExp | |
1010 { | |
1011 BoolExp(Loc loc, Expression *e, Type *type); | |
1012 Expression *semantic(Scope *sc); | |
1013 Expression *optimize(int result); | |
1014 Expression *interpret(InterState *istate); | |
1015 int isBit(); | |
1016 elem *toElem(IRState *irs); | |
1017 }; | |
1018 | |
1019 struct DeleteExp : UnaExp | |
1020 { | |
1021 DeleteExp(Loc loc, Expression *e); | |
1022 Expression *semantic(Scope *sc); | |
1023 Expression *checkToBoolean(); | |
1024 int checkSideEffect(int flag); | |
1025 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1026 elem *toElem(IRState *irs); | |
1027 }; | |
1028 | |
1029 struct CastExp : UnaExp | |
1030 { | |
1031 // Possible to cast to one type while painting to another type | |
1032 Type *to; // type to cast to | |
1033 | |
1034 CastExp(Loc loc, Expression *e, Type *t); | |
1035 Expression *syntaxCopy(); | |
1036 Expression *semantic(Scope *sc); | |
1037 Expression *optimize(int result); | |
1038 Expression *interpret(InterState *istate); | |
1039 int checkSideEffect(int flag); | |
1040 void checkEscape(); | |
1041 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1042 elem *toElem(IRState *irs); | |
1043 | |
1044 // For operator overloading | |
1045 Identifier *opId(); | |
619
722630261d62
Implemented constant pointer casts (like casting function pointer to void* as a constant global initializer)
tomas@myhost
parents:
599
diff
changeset
|
1046 |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
1047 // LDC |
619
722630261d62
Implemented constant pointer casts (like casting function pointer to void* as a constant global initializer)
tomas@myhost
parents:
599
diff
changeset
|
1048 virtual llvm::Constant *toConstElem(IRState *irs); |
159 | 1049 }; |
1050 | |
1051 | |
1052 struct SliceExp : UnaExp | |
1053 { | |
1054 Expression *upr; // NULL if implicit 0 | |
1055 Expression *lwr; // NULL if implicit [length - 1] | |
1056 VarDeclaration *lengthVar; | |
1057 | |
1058 SliceExp(Loc loc, Expression *e1, Expression *lwr, Expression *upr); | |
1059 Expression *syntaxCopy(); | |
1060 Expression *semantic(Scope *sc); | |
1061 void checkEscape(); | |
1062 Expression *toLvalue(Scope *sc, Expression *e); | |
1063 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1064 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1065 Expression *optimize(int result); | |
1066 Expression *interpret(InterState *istate); | |
1067 void dump(int indent); | |
1068 elem *toElem(IRState *irs); | |
1069 void scanForNestedRef(Scope *sc); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1070 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1071 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1072 |
1073 int inlineCost(InlineCostState *ics); | |
1074 Expression *doInline(InlineDoState *ids); | |
1075 Expression *inlineScan(InlineScanState *iss); | |
860
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1076 |
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1077 // LDC |
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1078 virtual llvm::Constant *toConstElem(IRState *irs); |
159 | 1079 }; |
1080 | |
1081 struct ArrayLengthExp : UnaExp | |
1082 { | |
1083 ArrayLengthExp(Loc loc, Expression *e1); | |
1084 Expression *semantic(Scope *sc); | |
1085 Expression *optimize(int result); | |
1086 Expression *interpret(InterState *istate); | |
1087 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1088 elem *toElem(IRState *irs); | |
1089 }; | |
1090 | |
1091 // e1[a0,a1,a2,a3,...] | |
1092 | |
1093 struct ArrayExp : UnaExp | |
1094 { | |
1095 Expressions *arguments; // Array of Expression's | |
1096 | |
1097 ArrayExp(Loc loc, Expression *e1, Expressions *arguments); | |
1098 Expression *syntaxCopy(); | |
1099 Expression *semantic(Scope *sc); | |
1100 Expression *toLvalue(Scope *sc, Expression *e); | |
1101 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1102 void scanForNestedRef(Scope *sc); | |
1103 | |
1104 // For operator overloading | |
1105 Identifier *opId(); | |
1106 | |
1107 int inlineCost(InlineCostState *ics); | |
1108 Expression *doInline(InlineDoState *ids); | |
1109 Expression *inlineScan(InlineScanState *iss); | |
1110 }; | |
1111 | |
1112 /****************************************************************/ | |
1113 | |
1114 struct DotExp : BinExp | |
1115 { | |
1116 DotExp(Loc loc, Expression *e1, Expression *e2); | |
1117 Expression *semantic(Scope *sc); | |
1118 }; | |
1119 | |
1120 struct CommaExp : BinExp | |
1121 { | |
1122 CommaExp(Loc loc, Expression *e1, Expression *e2); | |
1123 Expression *semantic(Scope *sc); | |
1124 void checkEscape(); | |
1125 Expression *toLvalue(Scope *sc, Expression *e); | |
1126 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1127 int isBool(int result); | |
1128 int checkSideEffect(int flag); | |
1129 Expression *optimize(int result); | |
1130 Expression *interpret(InterState *istate); | |
1131 elem *toElem(IRState *irs); | |
1132 }; | |
1133 | |
1134 struct IndexExp : BinExp | |
1135 { | |
1136 VarDeclaration *lengthVar; | |
1137 int modifiable; | |
1138 | |
1139 IndexExp(Loc loc, Expression *e1, Expression *e2); | |
1140 Expression *semantic(Scope *sc); | |
1141 Expression *toLvalue(Scope *sc, Expression *e); | |
1142 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1143 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1144 Expression *optimize(int result); | |
1145 Expression *interpret(InterState *istate); | |
1146 Expression *doInline(InlineDoState *ids); | |
1147 void scanForNestedRef(Scope *sc); | |
1148 | |
1149 elem *toElem(IRState *irs); | |
860
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1150 // LDC |
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1151 virtual llvm::Constant *toConstElem(IRState *irs); |
159 | 1152 }; |
1153 | |
1154 /* For both i++ and i-- | |
1155 */ | |
1156 struct PostExp : BinExp | |
1157 { | |
1158 PostExp(enum TOK op, Loc loc, Expression *e); | |
1159 Expression *semantic(Scope *sc); | |
1160 Expression *interpret(InterState *istate); | |
1161 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1162 Identifier *opId(); // For operator overloading | |
1163 elem *toElem(IRState *irs); | |
1164 }; | |
1165 | |
1166 struct AssignExp : BinExp | |
1167 { int ismemset; // !=0 if setting the contents of an array | |
1168 | |
1169 AssignExp(Loc loc, Expression *e1, Expression *e2); | |
1170 Expression *semantic(Scope *sc); | |
1171 Expression *checkToBoolean(); | |
1172 Expression *interpret(InterState *istate); | |
1173 Identifier *opId(); // For operator overloading | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1174 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1175 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1176 elem *toElem(IRState *irs); |
1177 }; | |
1178 | |
1179 #define ASSIGNEXP(op) \ | |
1180 struct op##AssignExp : BinExp \ | |
1181 { \ | |
1182 op##AssignExp(Loc loc, Expression *e1, Expression *e2); \ | |
1183 Expression *semantic(Scope *sc); \ | |
1184 Expression *interpret(InterState *istate); \ | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1185 X(void buildArrayIdent(OutBuffer *buf, Expressions *arguments);) \ |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1186 X(Expression *buildArrayLoop(Arguments *fparams);) \ |
159 | 1187 \ |
1188 Identifier *opId(); /* For operator overloading */ \ | |
1189 \ | |
1190 elem *toElem(IRState *irs); \ | |
1191 }; | |
1192 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1193 #define X(a) a |
159 | 1194 ASSIGNEXP(Add) |
1195 ASSIGNEXP(Min) | |
1196 ASSIGNEXP(Mul) | |
1197 ASSIGNEXP(Div) | |
1198 ASSIGNEXP(Mod) | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1199 ASSIGNEXP(And) |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1200 ASSIGNEXP(Or) |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1201 ASSIGNEXP(Xor) |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1202 #undef X |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1203 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1204 #define X(a) |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1205 |
159 | 1206 ASSIGNEXP(Shl) |
1207 ASSIGNEXP(Shr) | |
1208 ASSIGNEXP(Ushr) | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1209 ASSIGNEXP(Cat) |
159 | 1210 |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1211 #undef X |
159 | 1212 #undef ASSIGNEXP |
1213 | |
1214 struct AddExp : BinExp | |
1215 { | |
1216 AddExp(Loc loc, Expression *e1, Expression *e2); | |
1217 Expression *semantic(Scope *sc); | |
1218 Expression *optimize(int result); | |
1219 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1220 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1221 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1222 |
1223 // For operator overloading | |
1224 int isCommutative(); | |
1225 Identifier *opId(); | |
1226 Identifier *opId_r(); | |
1227 | |
1228 elem *toElem(IRState *irs); | |
1229 }; | |
1230 | |
1231 struct MinExp : BinExp | |
1232 { | |
1233 MinExp(Loc loc, Expression *e1, Expression *e2); | |
1234 Expression *semantic(Scope *sc); | |
1235 Expression *optimize(int result); | |
1236 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1237 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1238 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1239 |
1240 // For operator overloading | |
1241 Identifier *opId(); | |
1242 Identifier *opId_r(); | |
1243 | |
1244 elem *toElem(IRState *irs); | |
1245 }; | |
1246 | |
1247 struct CatExp : BinExp | |
1248 { | |
1249 CatExp(Loc loc, Expression *e1, Expression *e2); | |
1250 Expression *semantic(Scope *sc); | |
1251 Expression *optimize(int result); | |
1252 Expression *interpret(InterState *istate); | |
1253 | |
1254 // For operator overloading | |
1255 Identifier *opId(); | |
1256 Identifier *opId_r(); | |
1257 | |
1258 elem *toElem(IRState *irs); | |
1259 }; | |
1260 | |
1261 struct MulExp : BinExp | |
1262 { | |
1263 MulExp(Loc loc, Expression *e1, Expression *e2); | |
1264 Expression *semantic(Scope *sc); | |
1265 Expression *optimize(int result); | |
1266 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1267 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1268 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1269 |
1270 // For operator overloading | |
1271 int isCommutative(); | |
1272 Identifier *opId(); | |
1273 Identifier *opId_r(); | |
1274 | |
1275 elem *toElem(IRState *irs); | |
1276 }; | |
1277 | |
1278 struct DivExp : BinExp | |
1279 { | |
1280 DivExp(Loc loc, Expression *e1, Expression *e2); | |
1281 Expression *semantic(Scope *sc); | |
1282 Expression *optimize(int result); | |
1283 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1284 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1285 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1286 |
1287 // For operator overloading | |
1288 Identifier *opId(); | |
1289 Identifier *opId_r(); | |
1290 | |
1291 elem *toElem(IRState *irs); | |
1292 }; | |
1293 | |
1294 struct ModExp : BinExp | |
1295 { | |
1296 ModExp(Loc loc, Expression *e1, Expression *e2); | |
1297 Expression *semantic(Scope *sc); | |
1298 Expression *optimize(int result); | |
1299 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1300 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1301 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1302 |
1303 // For operator overloading | |
1304 Identifier *opId(); | |
1305 Identifier *opId_r(); | |
1306 | |
1307 elem *toElem(IRState *irs); | |
1308 }; | |
1309 | |
1310 struct ShlExp : BinExp | |
1311 { | |
1312 ShlExp(Loc loc, Expression *e1, Expression *e2); | |
1313 Expression *semantic(Scope *sc); | |
1314 Expression *optimize(int result); | |
1315 Expression *interpret(InterState *istate); | |
1316 | |
1317 // For operator overloading | |
1318 Identifier *opId(); | |
1319 Identifier *opId_r(); | |
1320 | |
1321 elem *toElem(IRState *irs); | |
1322 }; | |
1323 | |
1324 struct ShrExp : BinExp | |
1325 { | |
1326 ShrExp(Loc loc, Expression *e1, Expression *e2); | |
1327 Expression *semantic(Scope *sc); | |
1328 Expression *optimize(int result); | |
1329 Expression *interpret(InterState *istate); | |
1330 | |
1331 // For operator overloading | |
1332 Identifier *opId(); | |
1333 Identifier *opId_r(); | |
1334 | |
1335 elem *toElem(IRState *irs); | |
1336 }; | |
1337 | |
1338 struct UshrExp : BinExp | |
1339 { | |
1340 UshrExp(Loc loc, Expression *e1, Expression *e2); | |
1341 Expression *semantic(Scope *sc); | |
1342 Expression *optimize(int result); | |
1343 Expression *interpret(InterState *istate); | |
1344 | |
1345 // For operator overloading | |
1346 Identifier *opId(); | |
1347 Identifier *opId_r(); | |
1348 | |
1349 elem *toElem(IRState *irs); | |
1350 }; | |
1351 | |
1352 struct AndExp : BinExp | |
1353 { | |
1354 AndExp(Loc loc, Expression *e1, Expression *e2); | |
1355 Expression *semantic(Scope *sc); | |
1356 Expression *optimize(int result); | |
1357 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1358 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1359 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1360 |
1361 // For operator overloading | |
1362 int isCommutative(); | |
1363 Identifier *opId(); | |
1364 Identifier *opId_r(); | |
1365 | |
1366 elem *toElem(IRState *irs); | |
1367 }; | |
1368 | |
1369 struct OrExp : BinExp | |
1370 { | |
1371 OrExp(Loc loc, Expression *e1, Expression *e2); | |
1372 Expression *semantic(Scope *sc); | |
1373 Expression *optimize(int result); | |
1374 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1375 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1376 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1377 |
1378 // For operator overloading | |
1379 int isCommutative(); | |
1380 Identifier *opId(); | |
1381 Identifier *opId_r(); | |
1382 | |
1383 elem *toElem(IRState *irs); | |
1384 }; | |
1385 | |
1386 struct XorExp : BinExp | |
1387 { | |
1388 XorExp(Loc loc, Expression *e1, Expression *e2); | |
1389 Expression *semantic(Scope *sc); | |
1390 Expression *optimize(int result); | |
1391 Expression *interpret(InterState *istate); | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1392 void buildArrayIdent(OutBuffer *buf, Expressions *arguments); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1393 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1394 |
1395 // For operator overloading | |
1396 int isCommutative(); | |
1397 Identifier *opId(); | |
1398 Identifier *opId_r(); | |
1399 | |
1400 elem *toElem(IRState *irs); | |
1401 }; | |
1402 | |
1403 struct OrOrExp : BinExp | |
1404 { | |
1405 OrOrExp(Loc loc, Expression *e1, Expression *e2); | |
1406 Expression *semantic(Scope *sc); | |
1407 Expression *checkToBoolean(); | |
1408 int isBit(); | |
1409 Expression *optimize(int result); | |
1410 Expression *interpret(InterState *istate); | |
1411 int checkSideEffect(int flag); | |
1412 elem *toElem(IRState *irs); | |
1413 }; | |
1414 | |
1415 struct AndAndExp : BinExp | |
1416 { | |
1417 AndAndExp(Loc loc, Expression *e1, Expression *e2); | |
1418 Expression *semantic(Scope *sc); | |
1419 Expression *checkToBoolean(); | |
1420 int isBit(); | |
1421 Expression *optimize(int result); | |
1422 Expression *interpret(InterState *istate); | |
1423 int checkSideEffect(int flag); | |
1424 elem *toElem(IRState *irs); | |
1425 }; | |
1426 | |
1427 struct CmpExp : BinExp | |
1428 { | |
1429 CmpExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1430 Expression *semantic(Scope *sc); | |
1431 Expression *optimize(int result); | |
1432 Expression *interpret(InterState *istate); | |
1433 int isBit(); | |
1434 | |
1435 // For operator overloading | |
1436 int isCommutative(); | |
1437 Identifier *opId(); | |
1438 | |
1439 elem *toElem(IRState *irs); | |
1440 }; | |
1441 | |
1442 struct InExp : BinExp | |
1443 { | |
1444 InExp(Loc loc, Expression *e1, Expression *e2); | |
1445 Expression *semantic(Scope *sc); | |
1446 int isBit(); | |
1447 | |
1448 // For operator overloading | |
1449 Identifier *opId(); | |
1450 Identifier *opId_r(); | |
1451 | |
1452 elem *toElem(IRState *irs); | |
1453 }; | |
1454 | |
1455 struct RemoveExp : BinExp | |
1456 { | |
1457 RemoveExp(Loc loc, Expression *e1, Expression *e2); | |
1458 elem *toElem(IRState *irs); | |
1459 }; | |
1460 | |
1461 // == and != | |
1462 | |
1463 struct EqualExp : BinExp | |
1464 { | |
1465 EqualExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1466 Expression *semantic(Scope *sc); | |
1467 Expression *optimize(int result); | |
1468 Expression *interpret(InterState *istate); | |
1469 int isBit(); | |
1470 | |
1471 // For operator overloading | |
1472 int isCommutative(); | |
1473 Identifier *opId(); | |
1474 | |
1475 elem *toElem(IRState *irs); | |
1476 }; | |
1477 | |
1478 // === and !=== | |
1479 | |
1480 struct IdentityExp : BinExp | |
1481 { | |
1482 IdentityExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1483 Expression *semantic(Scope *sc); | |
1484 int isBit(); | |
1485 Expression *optimize(int result); | |
1486 Expression *interpret(InterState *istate); | |
1487 elem *toElem(IRState *irs); | |
1488 }; | |
1489 | |
1490 /****************************************************************/ | |
1491 | |
1492 struct CondExp : BinExp | |
1493 { | |
1494 Expression *econd; | |
1495 | |
1496 CondExp(Loc loc, Expression *econd, Expression *e1, Expression *e2); | |
1497 Expression *syntaxCopy(); | |
1498 Expression *semantic(Scope *sc); | |
1499 Expression *optimize(int result); | |
1500 Expression *interpret(InterState *istate); | |
1501 void checkEscape(); | |
1502 Expression *toLvalue(Scope *sc, Expression *e); | |
1503 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1504 Expression *checkToBoolean(); | |
1505 int checkSideEffect(int flag); | |
1506 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1507 MATCH implicitConvTo(Type *t); | |
1508 Expression *castTo(Scope *sc, Type *t); | |
1509 void scanForNestedRef(Scope *sc); | |
1510 | |
1511 int inlineCost(InlineCostState *ics); | |
1512 Expression *doInline(InlineDoState *ids); | |
1513 Expression *inlineScan(InlineScanState *iss); | |
1514 | |
1515 elem *toElem(IRState *irs); | |
1516 }; | |
1517 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1518 #if DMDV2 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1519 /****************************************************************/ |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1520 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1521 struct DefaultInitExp : Expression |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1522 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1523 enum TOK subop; // which of the derived classes this is |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1524 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1525 DefaultInitExp(Loc loc, enum TOK subop, int size); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1526 virtual Expression *resolve(Loc loc, Scope *sc) = 0; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1527 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1528 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1529 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1530 struct FileInitExp : DefaultInitExp |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1531 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1532 FileInitExp(Loc loc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1533 Expression *semantic(Scope *sc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1534 Expression *resolve(Loc loc, Scope *sc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1535 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1536 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1537 struct LineInitExp : DefaultInitExp |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1538 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1539 LineInitExp(Loc loc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1540 Expression *semantic(Scope *sc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1541 Expression *resolve(Loc loc, Scope *sc); |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1542 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1543 #endif |
159 | 1544 |
1545 /****************************************************************/ | |
1546 | |
599
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1547 #if IN_LLVM |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1548 |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
1549 // this stuff is strictly LDC |
599
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1550 |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1551 struct GEPExp : UnaExp |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1552 { |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1553 unsigned index; |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1554 Identifier* ident; |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1555 |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1556 GEPExp(Loc loc, Expression* e, Identifier* id, unsigned idx); |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1557 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1558 Expression *toLvalue(Scope *sc, Expression *e); |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1559 |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1560 elem *toElem(IRState *irs); |
860
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1561 llvm::Constant *toConstElem(IRState *irs); |
599
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1562 }; |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1563 |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1564 #endif |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1565 |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1566 /****************************************************************/ |
4435f57956e7
Fixed .funcptr property of delegates, no longer uses the infamous DMD rewrites to pointer arithmetic, instead a GEPExp has been introduced.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
588
diff
changeset
|
1567 |
159 | 1568 /* Special values used by the interpreter |
1569 */ | |
1570 #define EXP_CANT_INTERPRET ((Expression *)1) | |
1571 #define EXP_CONTINUE_INTERPRET ((Expression *)2) | |
1572 #define EXP_BREAK_INTERPRET ((Expression *)3) | |
1573 #define EXP_GOTO_INTERPRET ((Expression *)4) | |
1574 #define EXP_VOID_INTERPRET ((Expression *)5) | |
1575 | |
1576 Expression *expType(Type *type, Expression *e); | |
1577 | |
1578 Expression *Neg(Type *type, Expression *e1); | |
1579 Expression *Com(Type *type, Expression *e1); | |
1580 Expression *Not(Type *type, Expression *e1); | |
1581 Expression *Bool(Type *type, Expression *e1); | |
1582 Expression *Cast(Type *type, Type *to, Expression *e1); | |
1583 Expression *ArrayLength(Type *type, Expression *e1); | |
1584 Expression *Ptr(Type *type, Expression *e1); | |
1585 | |
1586 Expression *Add(Type *type, Expression *e1, Expression *e2); | |
1587 Expression *Min(Type *type, Expression *e1, Expression *e2); | |
1588 Expression *Mul(Type *type, Expression *e1, Expression *e2); | |
1589 Expression *Div(Type *type, Expression *e1, Expression *e2); | |
1590 Expression *Mod(Type *type, Expression *e1, Expression *e2); | |
1591 Expression *Shl(Type *type, Expression *e1, Expression *e2); | |
1592 Expression *Shr(Type *type, Expression *e1, Expression *e2); | |
1593 Expression *Ushr(Type *type, Expression *e1, Expression *e2); | |
1594 Expression *And(Type *type, Expression *e1, Expression *e2); | |
1595 Expression *Or(Type *type, Expression *e1, Expression *e2); | |
1596 Expression *Xor(Type *type, Expression *e1, Expression *e2); | |
1597 Expression *Index(Type *type, Expression *e1, Expression *e2); | |
1598 Expression *Cat(Type *type, Expression *e1, Expression *e2); | |
1599 | |
1600 Expression *Equal(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1601 Expression *Cmp(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1602 Expression *Identity(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1603 | |
1604 Expression *Slice(Type *type, Expression *e1, Expression *lwr, Expression *upr); | |
1605 | |
1606 #endif /* DMD_EXPRESSION_H */ |