Mercurial > projects > ldc
annotate dmd/expression.h @ 1183:df386fd4030e
Commit requested by lindquist.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 31 Mar 2009 03:06:19 +0200 |
parents | ab186e535e72 |
children | e961851fb8be |
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 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
49 #if IN_DMD |
159 | 50 // Back end |
51 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
|
52 |
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 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
63 struct IRState; |
159 | 64 struct DValue; |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
65 namespace llvm { |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
66 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
|
67 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
|
68 } |
159 | 69 #endif |
70 | |
71 void initPrecedence(); | |
72 | |
73 Expression *resolveProperties(Scope *sc, Expression *e); | |
74 void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d); | |
75 Dsymbol *search_function(AggregateDeclaration *ad, Identifier *funcid); | |
76 void inferApplyArgTypes(enum TOK op, Arguments *arguments, Expression *aggr); | |
77 void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); | |
78 void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); | |
79 void expandTuples(Expressions *exps); | |
80 FuncDeclaration *hasThis(Scope *sc); | |
81 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
|
82 int arrayExpressionCanThrow(Expressions *exps); |
159 | 83 |
84 struct Expression : Object | |
85 { | |
86 Loc loc; // file location | |
87 enum TOK op; // handy to minimize use of dynamic_cast | |
88 Type *type; // !=NULL means that semantic() has been run | |
89 int size; // # of bytes in Expression so we can copy() it | |
90 | |
91 Expression(Loc loc, enum TOK op, int size); | |
92 Expression *copy(); | |
93 virtual Expression *syntaxCopy(); | |
94 virtual Expression *semantic(Scope *sc); | |
95 | |
96 int dyncast() { return DYNCAST_EXPRESSION; } // kludge for template.isExpression() | |
97 | |
98 void print(); | |
99 char *toChars(); | |
100 virtual void dump(int indent); | |
101 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
|
102 void warning(const char *format, ...); |
159 | 103 virtual void rvalue(); |
104 | |
105 static Expression *combine(Expression *e1, Expression *e2); | |
106 static Expressions *arraySyntaxCopy(Expressions *exps); | |
107 | |
108 virtual integer_t toInteger(); | |
109 virtual uinteger_t toUInteger(); | |
110 virtual real_t toReal(); | |
111 virtual real_t toImaginary(); | |
112 virtual complex_t toComplex(); | |
113 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
114 virtual void toMangleBuffer(OutBuffer *buf); | |
115 virtual Expression *toLvalue(Scope *sc, Expression *e); | |
116 virtual Expression *modifiableLvalue(Scope *sc, Expression *e); | |
117 Expression *implicitCastTo(Scope *sc, Type *t); | |
118 virtual MATCH implicitConvTo(Type *t); | |
119 virtual Expression *castTo(Scope *sc, Type *t); | |
120 virtual void checkEscape(); | |
121 void checkScalar(); | |
122 void checkNoBool(); | |
123 Expression *checkIntegral(); | |
124 Expression *checkArithmetic(); | |
125 void checkDeprecated(Scope *sc, Dsymbol *s); | |
126 virtual Expression *checkToBoolean(); | |
127 Expression *checkToPointer(); | |
128 Expression *addressOf(Scope *sc); | |
129 Expression *deref(); | |
130 Expression *integralPromotions(Scope *sc); | |
131 | |
132 Expression *toDelegate(Scope *sc, Type *t); | |
133 virtual void scanForNestedRef(Scope *sc); | |
134 | |
135 virtual Expression *optimize(int result); | |
136 #define WANTflags 1 | |
137 #define WANTvalue 2 | |
138 #define WANTinterpret 4 | |
139 | |
140 virtual Expression *interpret(InterState *istate); | |
141 | |
142 virtual int isConst(); | |
143 virtual int isBool(int result); | |
144 virtual int isBit(); | |
145 virtual int checkSideEffect(int flag); | |
336 | 146 virtual int canThrow(); |
159 | 147 |
148 virtual int inlineCost(InlineCostState *ics); | |
149 virtual Expression *doInline(InlineDoState *ids); | |
150 virtual Expression *inlineScan(InlineScanState *iss); | |
151 | |
152 // For operator overloading | |
153 virtual int isCommutative(); | |
154 virtual Identifier *opId(); | |
155 virtual Identifier *opId_r(); | |
156 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
157 // 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
|
158 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
|
159 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
|
160 |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
161 #if IN_DMD |
159 | 162 // Back end |
163 virtual elem *toElem(IRState *irs); | |
164 virtual dt_t **toDt(dt_t **pdt); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
165 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
166 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
167 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
168 virtual DValue* toElem(IRState* irs); |
159 | 169 virtual llvm::Constant *toConstElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
170 virtual void cacheLvalue(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
171 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
172 llvm::Value* cachedLvalue; |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
173 #endif |
159 | 174 }; |
175 | |
176 struct IntegerExp : Expression | |
177 { | |
178 integer_t value; | |
179 | |
180 IntegerExp(Loc loc, integer_t value, Type *type); | |
181 IntegerExp(integer_t value); | |
182 int equals(Object *o); | |
183 Expression *semantic(Scope *sc); | |
184 Expression *interpret(InterState *istate); | |
185 char *toChars(); | |
186 void dump(int indent); | |
187 integer_t toInteger(); | |
188 real_t toReal(); | |
189 real_t toImaginary(); | |
190 complex_t toComplex(); | |
191 int isConst(); | |
192 int isBool(int result); | |
193 MATCH implicitConvTo(Type *t); | |
194 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
195 void toMangleBuffer(OutBuffer *buf); | |
196 Expression *toLvalue(Scope *sc, Expression *e); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
197 #if IN_DMD |
159 | 198 elem *toElem(IRState *irs); |
199 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
|
200 #elif IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
201 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
202 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
|
203 #endif |
159 | 204 }; |
205 | |
206 struct RealExp : Expression | |
207 { | |
208 real_t value; | |
209 | |
210 RealExp(Loc loc, real_t value, Type *type); | |
211 int equals(Object *o); | |
212 Expression *semantic(Scope *sc); | |
213 Expression *interpret(InterState *istate); | |
214 char *toChars(); | |
215 integer_t toInteger(); | |
216 uinteger_t toUInteger(); | |
217 real_t toReal(); | |
218 real_t toImaginary(); | |
219 complex_t toComplex(); | |
220 Expression *castTo(Scope *sc, Type *t); | |
221 int isConst(); | |
222 int isBool(int result); | |
223 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
224 void toMangleBuffer(OutBuffer *buf); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
225 #if IN_DMD |
159 | 226 elem *toElem(IRState *irs); |
227 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
|
228 #elif IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
229 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
230 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
|
231 #endif |
159 | 232 }; |
233 | |
234 struct ComplexExp : Expression | |
235 { | |
236 complex_t value; | |
237 | |
238 ComplexExp(Loc loc, complex_t value, Type *type); | |
239 int equals(Object *o); | |
240 Expression *semantic(Scope *sc); | |
241 Expression *interpret(InterState *istate); | |
242 char *toChars(); | |
243 integer_t toInteger(); | |
244 uinteger_t toUInteger(); | |
245 real_t toReal(); | |
246 real_t toImaginary(); | |
247 complex_t toComplex(); | |
248 Expression *castTo(Scope *sc, Type *t); | |
249 int isConst(); | |
250 int isBool(int result); | |
251 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
252 void toMangleBuffer(OutBuffer *buf); | |
253 #ifdef _DH | |
254 OutBuffer hexp; | |
255 #endif | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
256 #if IN_DMD |
159 | 257 elem *toElem(IRState *irs); |
258 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
|
259 #elif IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
260 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
261 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
|
262 #endif |
159 | 263 }; |
264 | |
265 struct IdentifierExp : Expression | |
266 { | |
267 Identifier *ident; | |
268 Declaration *var; | |
269 | |
270 IdentifierExp(Loc loc, Identifier *ident); | |
271 IdentifierExp(Loc loc, Declaration *var); | |
272 Expression *semantic(Scope *sc); | |
273 char *toChars(); | |
274 void dump(int indent); | |
275 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
276 Expression *toLvalue(Scope *sc, Expression *e); | |
277 }; | |
278 | |
279 struct DollarExp : IdentifierExp | |
280 { | |
281 DollarExp(Loc loc); | |
282 }; | |
283 | |
284 struct DsymbolExp : Expression | |
285 { | |
286 Dsymbol *s; | |
287 | |
288 DsymbolExp(Loc loc, Dsymbol *s); | |
289 Expression *semantic(Scope *sc); | |
290 char *toChars(); | |
291 void dump(int indent); | |
292 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
293 Expression *toLvalue(Scope *sc, Expression *e); | |
294 }; | |
295 | |
296 struct ThisExp : Expression | |
297 { | |
298 Declaration *var; | |
299 | |
300 ThisExp(Loc loc); | |
301 Expression *semantic(Scope *sc); | |
302 int isBool(int result); | |
303 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
304 Expression *toLvalue(Scope *sc, Expression *e); | |
305 void scanForNestedRef(Scope *sc); | |
306 | |
307 int inlineCost(InlineCostState *ics); | |
308 Expression *doInline(InlineDoState *ids); | |
309 //Expression *inlineScan(InlineScanState *iss); | |
310 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
311 #if IN_DMD |
159 | 312 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
313 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
314 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
315 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
316 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
317 #endif |
159 | 318 }; |
319 | |
320 struct SuperExp : ThisExp | |
321 { | |
322 SuperExp(Loc loc); | |
323 Expression *semantic(Scope *sc); | |
324 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
325 void scanForNestedRef(Scope *sc); | |
326 | |
327 int inlineCost(InlineCostState *ics); | |
328 Expression *doInline(InlineDoState *ids); | |
329 //Expression *inlineScan(InlineScanState *iss); | |
330 }; | |
331 | |
332 struct NullExp : Expression | |
333 { | |
334 unsigned char committed; // !=0 if type is committed | |
335 | |
336 NullExp(Loc loc); | |
337 Expression *semantic(Scope *sc); | |
338 int isBool(int result); | |
339 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
340 void toMangleBuffer(OutBuffer *buf); | |
341 MATCH implicitConvTo(Type *t); | |
342 Expression *castTo(Scope *sc, Type *t); | |
343 Expression *interpret(InterState *istate); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
344 #if IN_DMD |
159 | 345 elem *toElem(IRState *irs); |
346 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
|
347 #elif IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
348 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
349 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
|
350 #endif |
159 | 351 }; |
352 | |
353 struct StringExp : Expression | |
354 { | |
355 void *string; // char, wchar, or dchar data | |
356 size_t len; // number of chars, wchars, or dchars | |
357 unsigned char sz; // 1: char, 2: wchar, 4: dchar | |
358 unsigned char committed; // !=0 if type is committed | |
359 unsigned char postfix; // 'c', 'w', 'd' | |
360 | |
361 StringExp(Loc loc, char *s); | |
362 StringExp(Loc loc, void *s, size_t len); | |
363 StringExp(Loc loc, void *s, size_t len, unsigned char postfix); | |
364 //Expression *syntaxCopy(); | |
365 int equals(Object *o); | |
366 char *toChars(); | |
367 Expression *semantic(Scope *sc); | |
368 Expression *interpret(InterState *istate); | |
369 StringExp *toUTF8(Scope *sc); | |
370 MATCH implicitConvTo(Type *t); | |
371 Expression *castTo(Scope *sc, Type *t); | |
372 int compare(Object *obj); | |
373 int isBool(int result); | |
374 unsigned charAt(size_t i); | |
375 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
376 void toMangleBuffer(OutBuffer *buf); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
377 #if IN_DMD |
159 | 378 elem *toElem(IRState *irs); |
379 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
|
380 #elif IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
381 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
382 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
|
383 #endif |
159 | 384 }; |
385 | |
386 // Tuple | |
387 | |
388 struct TupleExp : Expression | |
389 { | |
390 Expressions *exps; | |
391 | |
392 TupleExp(Loc loc, Expressions *exps); | |
393 TupleExp(Loc loc, TupleDeclaration *tup); | |
394 Expression *syntaxCopy(); | |
395 int equals(Object *o); | |
396 Expression *semantic(Scope *sc); | |
397 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
398 void scanForNestedRef(Scope *sc); | |
399 void checkEscape(); | |
400 int checkSideEffect(int flag); | |
401 Expression *optimize(int result); | |
402 Expression *interpret(InterState *istate); | |
403 Expression *castTo(Scope *sc, Type *t); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
404 #if IN_DMD |
159 | 405 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
406 #endif |
159 | 407 |
408 int inlineCost(InlineCostState *ics); | |
409 Expression *doInline(InlineDoState *ids); | |
410 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
411 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
412 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
413 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
414 #endif |
159 | 415 }; |
416 | |
417 struct ArrayLiteralExp : Expression | |
418 { | |
419 Expressions *elements; | |
420 | |
421 ArrayLiteralExp(Loc loc, Expressions *elements); | |
422 ArrayLiteralExp(Loc loc, Expression *e); | |
423 | |
424 Expression *syntaxCopy(); | |
425 Expression *semantic(Scope *sc); | |
426 int isBool(int result); | |
427 int checkSideEffect(int flag); | |
428 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
429 void toMangleBuffer(OutBuffer *buf); | |
430 void scanForNestedRef(Scope *sc); | |
431 Expression *optimize(int result); | |
432 Expression *interpret(InterState *istate); | |
433 MATCH implicitConvTo(Type *t); | |
434 Expression *castTo(Scope *sc, Type *t); | |
435 | |
436 int inlineCost(InlineCostState *ics); | |
437 Expression *doInline(InlineDoState *ids); | |
438 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
439 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
440 #if IN_DMD |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
441 elem *toElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
442 dt_t **toDt(dt_t **pdt); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
443 #elif IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
444 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
445 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
446 #endif |
159 | 447 }; |
448 | |
449 struct AssocArrayLiteralExp : Expression | |
450 { | |
451 Expressions *keys; | |
452 Expressions *values; | |
453 | |
454 AssocArrayLiteralExp(Loc loc, Expressions *keys, Expressions *values); | |
455 | |
456 Expression *syntaxCopy(); | |
457 Expression *semantic(Scope *sc); | |
458 int isBool(int result); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
459 #if IN_DMD |
159 | 460 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
461 #endif |
159 | 462 int checkSideEffect(int flag); |
463 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
464 void toMangleBuffer(OutBuffer *buf); | |
465 void scanForNestedRef(Scope *sc); | |
466 Expression *optimize(int result); | |
467 Expression *interpret(InterState *istate); | |
468 MATCH implicitConvTo(Type *t); | |
469 Expression *castTo(Scope *sc, Type *t); | |
470 | |
471 int inlineCost(InlineCostState *ics); | |
472 Expression *doInline(InlineDoState *ids); | |
473 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
474 |
1146
1860414bf3b7
* Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1103
diff
changeset
|
475 #if IN_LLVM |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
476 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
477 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
|
478 #endif |
159 | 479 }; |
480 | |
481 struct StructLiteralExp : Expression | |
482 { | |
483 StructDeclaration *sd; // which aggregate this is for | |
484 Expressions *elements; // parallels sd->fields[] with | |
485 // NULL entries for fields to skip | |
486 | |
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 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
|
489 #endif |
159 | 490 size_t soffset; // offset from start of s |
491 int fillHoles; // fill alignment 'holes' with zero | |
492 | |
493 StructLiteralExp(Loc loc, StructDeclaration *sd, Expressions *elements); | |
494 | |
495 Expression *syntaxCopy(); | |
496 Expression *semantic(Scope *sc); | |
497 Expression *getField(Type *type, unsigned offset); | |
498 int getFieldIndex(Type *type, unsigned offset); | |
499 int checkSideEffect(int flag); | |
500 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
501 void toMangleBuffer(OutBuffer *buf); | |
502 void scanForNestedRef(Scope *sc); | |
503 Expression *optimize(int result); | |
504 Expression *interpret(InterState *istate); | |
1168
ab186e535e72
A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
Christian Kamm <kamm incasoftware de>
parents:
1152
diff
changeset
|
505 // LDC: struct literals aren't lvalues! Taking their address can lead to |
ab186e535e72
A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
Christian Kamm <kamm incasoftware de>
parents:
1152
diff
changeset
|
506 // incorrect behavior, see LDC#218, DMD#2682 |
ab186e535e72
A different fix to #218 and DMD2682 that does not lead to constant folding regressions.
Christian Kamm <kamm incasoftware de>
parents:
1152
diff
changeset
|
507 // Expression *toLvalue(Scope *sc, Expression *e); |
159 | 508 |
509 int inlineCost(InlineCostState *ics); | |
510 Expression *doInline(InlineDoState *ids); | |
511 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
512 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
513 #if IN_DMD |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
514 elem *toElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
515 dt_t **toDt(dt_t **pdt); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
516 #elif IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
517 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
518 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
519 #endif |
159 | 520 }; |
521 | |
522 struct TypeDotIdExp : Expression | |
523 { | |
524 Identifier *ident; | |
525 | |
526 TypeDotIdExp(Loc loc, Type *type, Identifier *ident); | |
527 Expression *syntaxCopy(); | |
528 Expression *semantic(Scope *sc); | |
529 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
530 #if IN_DMD |
159 | 531 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
532 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
533 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
534 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
535 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
536 #endif |
159 | 537 }; |
538 | |
539 struct TypeExp : Expression | |
540 { | |
541 TypeExp(Loc loc, Type *type); | |
876
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
875
diff
changeset
|
542 Expression *syntaxCopy(); |
159 | 543 Expression *semantic(Scope *sc); |
544 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
545 Expression *optimize(int result); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
546 #if IN_DMD |
159 | 547 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
548 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
549 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
550 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
551 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
552 #endif |
159 | 553 }; |
554 | |
555 struct ScopeExp : Expression | |
556 { | |
557 ScopeDsymbol *sds; | |
558 | |
559 ScopeExp(Loc loc, ScopeDsymbol *sds); | |
560 Expression *syntaxCopy(); | |
561 Expression *semantic(Scope *sc); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
562 #if IN_DMD |
159 | 563 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
564 #endif |
159 | 565 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
566 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
567 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
568 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
569 #endif |
159 | 570 }; |
571 | |
572 struct TemplateExp : Expression | |
573 { | |
574 TemplateDeclaration *td; | |
575 | |
576 TemplateExp(Loc loc, TemplateDeclaration *td); | |
577 void rvalue(); | |
578 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
579 }; | |
580 | |
581 struct NewExp : Expression | |
582 { | |
583 /* thisexp.new(newargs) newtype(arguments) | |
584 */ | |
585 Expression *thisexp; // if !NULL, 'this' for class being allocated | |
586 Expressions *newargs; // Array of Expression's to call new operator | |
587 Type *newtype; | |
588 Expressions *arguments; // Array of Expression's | |
589 | |
590 CtorDeclaration *member; // constructor function | |
591 NewDeclaration *allocator; // allocator function | |
592 int onstack; // allocate on stack | |
593 | |
594 NewExp(Loc loc, Expression *thisexp, Expressions *newargs, | |
595 Type *newtype, Expressions *arguments); | |
596 Expression *syntaxCopy(); | |
597 Expression *semantic(Scope *sc); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
598 #if IN_DMD |
159 | 599 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
600 #endif |
159 | 601 int checkSideEffect(int flag); |
602 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
603 void scanForNestedRef(Scope *sc); | |
604 | |
605 //int inlineCost(InlineCostState *ics); | |
606 Expression *doInline(InlineDoState *ids); | |
607 //Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
608 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
609 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
610 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
611 #endif |
159 | 612 }; |
613 | |
614 struct NewAnonClassExp : Expression | |
615 { | |
616 /* thisexp.new(newargs) class baseclasses { } (arguments) | |
617 */ | |
618 Expression *thisexp; // if !NULL, 'this' for class being allocated | |
619 Expressions *newargs; // Array of Expression's to call new operator | |
620 ClassDeclaration *cd; // class being instantiated | |
621 Expressions *arguments; // Array of Expression's to call class constructor | |
622 | |
623 NewAnonClassExp(Loc loc, Expression *thisexp, Expressions *newargs, | |
624 ClassDeclaration *cd, Expressions *arguments); | |
625 Expression *syntaxCopy(); | |
626 Expression *semantic(Scope *sc); | |
627 int checkSideEffect(int flag); | |
628 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
629 }; | |
630 | |
631 // Offset from symbol | |
632 | |
633 struct SymOffExp : Expression | |
634 { | |
635 Declaration *var; | |
636 unsigned offset; | |
637 | |
638 SymOffExp(Loc loc, Declaration *var, unsigned offset); | |
639 Expression *semantic(Scope *sc); | |
640 void checkEscape(); | |
641 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
642 int isConst(); | |
643 int isBool(int result); | |
644 Expression *doInline(InlineDoState *ids); | |
645 MATCH implicitConvTo(Type *t); | |
646 Expression *castTo(Scope *sc, Type *t); | |
647 void scanForNestedRef(Scope *sc); | |
648 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
649 #if IN_DMD |
159 | 650 elem *toElem(IRState *irs); |
651 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
|
652 #endif |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
653 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
654 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
655 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
656 #endif |
159 | 657 }; |
658 | |
659 // Variable | |
660 | |
661 struct VarExp : Expression | |
662 { | |
663 Declaration *var; | |
664 | |
665 VarExp(Loc loc, Declaration *var); | |
666 int equals(Object *o); | |
667 Expression *semantic(Scope *sc); | |
668 Expression *optimize(int result); | |
669 Expression *interpret(InterState *istate); | |
670 void dump(int indent); | |
671 char *toChars(); | |
672 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
673 void checkEscape(); | |
674 Expression *toLvalue(Scope *sc, Expression *e); | |
675 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
676 #if IN_DMD |
159 | 677 elem *toElem(IRState *irs); |
678 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
|
679 #endif |
159 | 680 void scanForNestedRef(Scope *sc); |
681 | |
682 int inlineCost(InlineCostState *ics); | |
683 Expression *doInline(InlineDoState *ids); | |
684 //Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
685 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
686 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
687 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
688 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
689 void cacheLvalue(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
690 #endif |
159 | 691 }; |
692 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
693 #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
|
694 // 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
|
695 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
696 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
|
697 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
698 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
|
699 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
700 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
|
701 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
|
702 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
|
703 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
704 #endif |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
705 |
159 | 706 // Function/Delegate literal |
707 | |
708 struct FuncExp : Expression | |
709 { | |
710 FuncLiteralDeclaration *fd; | |
711 | |
712 FuncExp(Loc loc, FuncLiteralDeclaration *fd); | |
713 Expression *syntaxCopy(); | |
714 Expression *semantic(Scope *sc); | |
715 void scanForNestedRef(Scope *sc); | |
716 char *toChars(); | |
717 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
718 #if IN_DMD |
159 | 719 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
720 #endif |
159 | 721 |
722 int inlineCost(InlineCostState *ics); | |
723 //Expression *doInline(InlineDoState *ids); | |
724 //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
|
725 |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
726 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
727 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
728 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
729 #endif |
159 | 730 }; |
731 | |
732 // Declaration of a symbol | |
733 | |
734 struct DeclarationExp : Expression | |
735 { | |
736 Dsymbol *declaration; | |
737 | |
738 DeclarationExp(Loc loc, Dsymbol *declaration); | |
739 Expression *syntaxCopy(); | |
740 Expression *semantic(Scope *sc); | |
741 Expression *interpret(InterState *istate); | |
742 int checkSideEffect(int flag); | |
743 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
744 #if IN_DMD |
159 | 745 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
746 #endif |
159 | 747 void scanForNestedRef(Scope *sc); |
748 | |
749 int inlineCost(InlineCostState *ics); | |
750 Expression *doInline(InlineDoState *ids); | |
751 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
752 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
753 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
754 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
755 #endif |
159 | 756 }; |
757 | |
758 struct TypeidExp : Expression | |
759 { | |
760 Type *typeidType; | |
761 | |
762 TypeidExp(Loc loc, Type *typeidType); | |
763 Expression *syntaxCopy(); | |
764 Expression *semantic(Scope *sc); | |
765 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
766 }; | |
767 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
768 #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
|
769 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
|
770 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
771 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
|
772 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
|
773 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
774 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
|
775 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
|
776 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
|
777 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
|
778 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
779 #endif |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
780 |
159 | 781 struct HaltExp : Expression |
782 { | |
783 HaltExp(Loc loc); | |
784 Expression *semantic(Scope *sc); | |
785 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
786 int checkSideEffect(int flag); | |
787 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
788 #if IN_DMD |
159 | 789 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
790 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
791 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
792 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
793 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
794 #endif |
159 | 795 }; |
796 | |
797 struct IsExp : Expression | |
798 { | |
799 /* is(targ id tok tspec) | |
800 * is(targ id == tok2) | |
801 */ | |
802 Type *targ; | |
803 Identifier *id; // can be NULL | |
804 enum TOK tok; // ':' or '==' | |
805 Type *tspec; // can be NULL | |
806 enum TOK tok2; // 'struct', 'union', 'typedef', etc. | |
807 | |
808 IsExp(Loc loc, Type *targ, Identifier *id, enum TOK tok, Type *tspec, enum TOK tok2); | |
809 Expression *syntaxCopy(); | |
810 Expression *semantic(Scope *sc); | |
811 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
812 }; | |
813 | |
814 /****************************************************************/ | |
815 | |
816 struct UnaExp : Expression | |
817 { | |
818 Expression *e1; | |
819 | |
820 UnaExp(Loc loc, enum TOK op, int size, Expression *e1); | |
821 Expression *syntaxCopy(); | |
822 Expression *semantic(Scope *sc); | |
823 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
824 Expression *optimize(int result); | |
825 void dump(int indent); | |
826 void scanForNestedRef(Scope *sc); | |
827 Expression *interpretCommon(InterState *istate, Expression *(*fp)(Type *, Expression *)); | |
828 | |
829 int inlineCost(InlineCostState *ics); | |
830 Expression *doInline(InlineDoState *ids); | |
831 Expression *inlineScan(InlineScanState *iss); | |
832 | |
833 Expression *op_overload(Scope *sc); // doesn't need to be virtual | |
834 }; | |
835 | |
836 struct BinExp : Expression | |
837 { | |
838 Expression *e1; | |
839 Expression *e2; | |
840 | |
841 BinExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2); | |
842 Expression *syntaxCopy(); | |
843 Expression *semantic(Scope *sc); | |
844 Expression *semanticp(Scope *sc); | |
845 Expression *commonSemanticAssign(Scope *sc); | |
846 Expression *commonSemanticAssignIntegral(Scope *sc); | |
847 int checkSideEffect(int flag); | |
848 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
849 Expression *scaleFactor(Scope *sc); | |
850 Expression *typeCombine(Scope *sc); | |
851 Expression *optimize(int result); | |
852 int isunsigned(); | |
853 void incompatibleTypes(); | |
854 void dump(int indent); | |
855 void scanForNestedRef(Scope *sc); | |
856 Expression *interpretCommon(InterState *istate, Expression *(*fp)(Type *, Expression *, Expression *)); | |
857 Expression *interpretCommon2(InterState *istate, Expression *(*fp)(TOK, Type *, Expression *, Expression *)); | |
858 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
|
859 Expression *arrayOp(Scope *sc); |
159 | 860 |
861 int inlineCost(InlineCostState *ics); | |
862 Expression *doInline(InlineDoState *ids); | |
863 Expression *inlineScan(InlineScanState *iss); | |
864 | |
865 Expression *op_overload(Scope *sc); | |
866 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
867 #if IN_DMD |
159 | 868 elem *toElemBin(IRState *irs, int op); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
869 #endif |
159 | 870 }; |
871 | |
872 struct BinAssignExp : BinExp | |
873 { | |
874 BinAssignExp(Loc loc, enum TOK op, int size, Expression *e1, Expression *e2); | |
875 int checkSideEffect(int flag); | |
876 }; | |
877 | |
878 /****************************************************************/ | |
879 | |
880 struct CompileExp : UnaExp | |
881 { | |
882 CompileExp(Loc loc, Expression *e); | |
883 Expression *semantic(Scope *sc); | |
884 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
885 }; | |
886 | |
887 struct FileExp : UnaExp | |
888 { | |
889 FileExp(Loc loc, Expression *e); | |
890 Expression *semantic(Scope *sc); | |
891 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
892 }; | |
893 | |
894 struct AssertExp : UnaExp | |
895 { | |
896 Expression *msg; | |
897 | |
898 AssertExp(Loc loc, Expression *e, Expression *msg = NULL); | |
899 Expression *syntaxCopy(); | |
900 Expression *semantic(Scope *sc); | |
901 Expression *interpret(InterState *istate); | |
902 int checkSideEffect(int flag); | |
903 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
904 | |
905 int inlineCost(InlineCostState *ics); | |
906 Expression *doInline(InlineDoState *ids); | |
907 Expression *inlineScan(InlineScanState *iss); | |
908 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
909 #if IN_DMD |
159 | 910 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
911 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
912 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
913 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
914 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
915 #endif |
159 | 916 }; |
917 | |
918 struct DotIdExp : UnaExp | |
919 { | |
920 Identifier *ident; | |
921 | |
922 DotIdExp(Loc loc, Expression *e, Identifier *ident); | |
923 Expression *semantic(Scope *sc); | |
924 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
925 void dump(int i); | |
926 }; | |
927 | |
928 struct DotTemplateExp : UnaExp | |
929 { | |
930 TemplateDeclaration *td; | |
931 | |
932 DotTemplateExp(Loc loc, Expression *e, TemplateDeclaration *td); | |
933 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
934 }; | |
935 | |
936 struct DotVarExp : UnaExp | |
937 { | |
938 Declaration *var; | |
939 | |
940 DotVarExp(Loc loc, Expression *e, Declaration *var); | |
941 Expression *semantic(Scope *sc); | |
942 Expression *toLvalue(Scope *sc, Expression *e); | |
943 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
875
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
860
diff
changeset
|
944 Expression *optimize(int result); |
330f999ade44
Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
860
diff
changeset
|
945 Expression *interpret(InterState *istate); |
159 | 946 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
947 void dump(int indent); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
948 #if IN_DMD |
159 | 949 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
950 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
951 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
952 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
953 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
954 void cacheLvalue(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
955 #endif |
159 | 956 }; |
957 | |
958 struct DotTemplateInstanceExp : UnaExp | |
959 { | |
960 TemplateInstance *ti; | |
961 | |
962 DotTemplateInstanceExp(Loc loc, Expression *e, TemplateInstance *ti); | |
963 Expression *syntaxCopy(); | |
964 Expression *semantic(Scope *sc); | |
965 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
966 void dump(int indent); | |
967 }; | |
968 | |
969 struct DelegateExp : UnaExp | |
970 { | |
971 FuncDeclaration *func; | |
972 | |
973 DelegateExp(Loc loc, Expression *e, FuncDeclaration *func); | |
974 Expression *semantic(Scope *sc); | |
975 MATCH implicitConvTo(Type *t); | |
976 Expression *castTo(Scope *sc, Type *t); | |
977 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
978 void dump(int indent); | |
979 | |
980 int inlineCost(InlineCostState *ics); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
981 #if IN_DMD |
159 | 982 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
983 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
984 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
985 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
986 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
987 #endif |
159 | 988 }; |
989 | |
990 struct DotTypeExp : UnaExp | |
991 { | |
992 Dsymbol *sym; // symbol that represents a type | |
993 | |
994 DotTypeExp(Loc loc, Expression *e, Dsymbol *sym); | |
995 Expression *semantic(Scope *sc); | |
996 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
997 #if IN_DMD |
159 | 998 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
999 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1000 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1001 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1002 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1003 #endif |
159 | 1004 }; |
1005 | |
1006 struct CallExp : UnaExp | |
1007 { | |
1008 Expressions *arguments; // function arguments | |
1009 | |
1010 CallExp(Loc loc, Expression *e, Expressions *exps); | |
1011 CallExp(Loc loc, Expression *e); | |
1012 CallExp(Loc loc, Expression *e, Expression *earg1); | |
1013 CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2); | |
1014 | |
1015 Expression *syntaxCopy(); | |
1016 Expression *semantic(Scope *sc); | |
1017 Expression *optimize(int result); | |
1018 Expression *interpret(InterState *istate); | |
1019 int checkSideEffect(int flag); | |
1020 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1021 void dump(int indent); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1022 #if IN_DMD |
159 | 1023 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1024 #endif |
159 | 1025 void scanForNestedRef(Scope *sc); |
1026 Expression *toLvalue(Scope *sc, Expression *e); | |
1027 | |
1028 int inlineCost(InlineCostState *ics); | |
1029 Expression *doInline(InlineDoState *ids); | |
1030 Expression *inlineScan(InlineScanState *iss); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1031 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1032 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1033 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1034 #endif |
159 | 1035 }; |
1036 | |
1037 struct AddrExp : UnaExp | |
1038 { | |
1039 AddrExp(Loc loc, Expression *e); | |
1040 Expression *semantic(Scope *sc); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1041 #if IN_DMD |
159 | 1042 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1043 #endif |
159 | 1044 MATCH implicitConvTo(Type *t); |
1045 Expression *castTo(Scope *sc, Type *t); | |
1046 Expression *optimize(int result); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1047 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1048 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1049 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1050 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1051 #endif |
159 | 1052 }; |
1053 | |
1054 struct PtrExp : UnaExp | |
1055 { | |
1056 PtrExp(Loc loc, Expression *e); | |
1057 PtrExp(Loc loc, Expression *e, Type *t); | |
1058 Expression *semantic(Scope *sc); | |
1059 Expression *toLvalue(Scope *sc, Expression *e); | |
1060 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1061 #if IN_DMD |
159 | 1062 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1063 #endif |
159 | 1064 Expression *optimize(int result); |
1065 Expression *interpret(InterState *istate); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1066 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1067 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1068 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1069 void cacheLvalue(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1070 #endif |
159 | 1071 }; |
1072 | |
1073 struct NegExp : UnaExp | |
1074 { | |
1075 NegExp(Loc loc, Expression *e); | |
1076 Expression *semantic(Scope *sc); | |
1077 Expression *optimize(int result); | |
1078 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
|
1079 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
|
1080 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1081 |
1082 // For operator overloading | |
1083 Identifier *opId(); | |
1084 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1085 #if IN_DMD |
159 | 1086 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1087 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1088 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1089 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1090 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1091 #endif |
159 | 1092 }; |
1093 | |
1094 struct UAddExp : UnaExp | |
1095 { | |
1096 UAddExp(Loc loc, Expression *e); | |
1097 Expression *semantic(Scope *sc); | |
1098 | |
1099 // For operator overloading | |
1100 Identifier *opId(); | |
1101 }; | |
1102 | |
1103 struct ComExp : UnaExp | |
1104 { | |
1105 ComExp(Loc loc, Expression *e); | |
1106 Expression *semantic(Scope *sc); | |
1107 Expression *optimize(int result); | |
1108 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
|
1109 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
|
1110 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1111 |
1112 // For operator overloading | |
1113 Identifier *opId(); | |
1114 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1115 #if IN_DMD |
159 | 1116 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1117 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1118 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1119 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1120 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1121 #endif |
159 | 1122 }; |
1123 | |
1124 struct NotExp : UnaExp | |
1125 { | |
1126 NotExp(Loc loc, Expression *e); | |
1127 Expression *semantic(Scope *sc); | |
1128 Expression *optimize(int result); | |
1129 Expression *interpret(InterState *istate); | |
1130 int isBit(); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1131 #if IN_DMD |
159 | 1132 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1133 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1134 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1135 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1136 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1137 #endif |
159 | 1138 }; |
1139 | |
1140 struct BoolExp : UnaExp | |
1141 { | |
1142 BoolExp(Loc loc, Expression *e, Type *type); | |
1143 Expression *semantic(Scope *sc); | |
1144 Expression *optimize(int result); | |
1145 Expression *interpret(InterState *istate); | |
1146 int isBit(); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1147 #if IN_DMD |
159 | 1148 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1149 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1150 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1151 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1152 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1153 #endif |
159 | 1154 }; |
1155 | |
1156 struct DeleteExp : UnaExp | |
1157 { | |
1158 DeleteExp(Loc loc, Expression *e); | |
1159 Expression *semantic(Scope *sc); | |
1160 Expression *checkToBoolean(); | |
1161 int checkSideEffect(int flag); | |
1162 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1163 #if IN_DMD |
159 | 1164 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1165 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1166 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1167 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1168 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1169 #endif |
159 | 1170 }; |
1171 | |
1172 struct CastExp : UnaExp | |
1173 { | |
1174 // Possible to cast to one type while painting to another type | |
1175 Type *to; // type to cast to | |
1176 | |
1177 CastExp(Loc loc, Expression *e, Type *t); | |
1178 Expression *syntaxCopy(); | |
1179 Expression *semantic(Scope *sc); | |
1180 Expression *optimize(int result); | |
1181 Expression *interpret(InterState *istate); | |
1182 int checkSideEffect(int flag); | |
1183 void checkEscape(); | |
1184 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1185 #if IN_DMD |
159 | 1186 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1187 #endif |
159 | 1188 |
1189 // For operator overloading | |
1190 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
|
1191 |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1192 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1193 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1194 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1195 #endif |
159 | 1196 }; |
1197 | |
1198 | |
1199 struct SliceExp : UnaExp | |
1200 { | |
1201 Expression *upr; // NULL if implicit 0 | |
1202 Expression *lwr; // NULL if implicit [length - 1] | |
1203 VarDeclaration *lengthVar; | |
1204 | |
1205 SliceExp(Loc loc, Expression *e1, Expression *lwr, Expression *upr); | |
1206 Expression *syntaxCopy(); | |
1207 Expression *semantic(Scope *sc); | |
1208 void checkEscape(); | |
1209 Expression *toLvalue(Scope *sc, Expression *e); | |
1210 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1211 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1212 Expression *optimize(int result); | |
1213 Expression *interpret(InterState *istate); | |
1214 void dump(int indent); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1215 #if IN_DMD |
159 | 1216 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1217 #endif |
159 | 1218 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
|
1219 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
|
1220 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1221 |
1222 int inlineCost(InlineCostState *ics); | |
1223 Expression *doInline(InlineDoState *ids); | |
1224 Expression *inlineScan(InlineScanState *iss); | |
860
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1225 |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1226 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1227 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1228 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1229 #endif |
159 | 1230 }; |
1231 | |
1232 struct ArrayLengthExp : UnaExp | |
1233 { | |
1234 ArrayLengthExp(Loc loc, Expression *e1); | |
1235 Expression *semantic(Scope *sc); | |
1236 Expression *optimize(int result); | |
1237 Expression *interpret(InterState *istate); | |
1238 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1239 #if IN_DMD |
159 | 1240 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1241 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1242 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1243 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1244 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1245 #endif |
159 | 1246 }; |
1247 | |
1248 // e1[a0,a1,a2,a3,...] | |
1249 | |
1250 struct ArrayExp : UnaExp | |
1251 { | |
1252 Expressions *arguments; // Array of Expression's | |
1253 | |
1254 ArrayExp(Loc loc, Expression *e1, Expressions *arguments); | |
1255 Expression *syntaxCopy(); | |
1256 Expression *semantic(Scope *sc); | |
1257 Expression *toLvalue(Scope *sc, Expression *e); | |
1258 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1259 void scanForNestedRef(Scope *sc); | |
1260 | |
1261 // For operator overloading | |
1262 Identifier *opId(); | |
1263 | |
1264 int inlineCost(InlineCostState *ics); | |
1265 Expression *doInline(InlineDoState *ids); | |
1266 Expression *inlineScan(InlineScanState *iss); | |
1267 }; | |
1268 | |
1269 /****************************************************************/ | |
1270 | |
1271 struct DotExp : BinExp | |
1272 { | |
1273 DotExp(Loc loc, Expression *e1, Expression *e2); | |
1274 Expression *semantic(Scope *sc); | |
1275 }; | |
1276 | |
1277 struct CommaExp : BinExp | |
1278 { | |
1279 CommaExp(Loc loc, Expression *e1, Expression *e2); | |
1280 Expression *semantic(Scope *sc); | |
1281 void checkEscape(); | |
1282 Expression *toLvalue(Scope *sc, Expression *e); | |
1283 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1284 int isBool(int result); | |
1285 int checkSideEffect(int flag); | |
1286 Expression *optimize(int result); | |
1287 Expression *interpret(InterState *istate); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1288 #if IN_DMD |
159 | 1289 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1290 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1291 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1292 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1293 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1294 #endif |
159 | 1295 }; |
1296 | |
1297 struct IndexExp : BinExp | |
1298 { | |
1299 VarDeclaration *lengthVar; | |
1300 int modifiable; | |
1301 | |
1302 IndexExp(Loc loc, Expression *e1, Expression *e2); | |
1303 Expression *semantic(Scope *sc); | |
1304 Expression *toLvalue(Scope *sc, Expression *e); | |
1305 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1306 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1307 Expression *optimize(int result); | |
1308 Expression *interpret(InterState *istate); | |
1309 Expression *doInline(InlineDoState *ids); | |
1310 void scanForNestedRef(Scope *sc); | |
1311 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1312 #if IN_DMD |
159 | 1313 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1314 #elif IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1315 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1316 llvm::Constant *toConstElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1317 void cacheLvalue(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1318 #endif |
159 | 1319 }; |
1320 | |
1321 /* For both i++ and i-- | |
1322 */ | |
1323 struct PostExp : BinExp | |
1324 { | |
1325 PostExp(enum TOK op, Loc loc, Expression *e); | |
1326 Expression *semantic(Scope *sc); | |
1327 Expression *interpret(InterState *istate); | |
1328 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1329 Identifier *opId(); // For operator overloading | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1330 #if IN_DMD |
159 | 1331 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1332 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1333 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1334 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1335 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1336 #endif |
159 | 1337 }; |
1338 | |
1339 struct AssignExp : BinExp | |
1340 { int ismemset; // !=0 if setting the contents of an array | |
1341 | |
1342 AssignExp(Loc loc, Expression *e1, Expression *e2); | |
1343 Expression *semantic(Scope *sc); | |
1344 Expression *checkToBoolean(); | |
1345 Expression *interpret(InterState *istate); | |
1346 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
|
1347 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
|
1348 Expression *buildArrayLoop(Arguments *fparams); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1349 #if IN_DMD |
159 | 1350 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1351 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1352 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1353 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1354 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1355 #endif |
159 | 1356 }; |
1357 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1358 #if IN_DMD |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1359 #define ASSIGNEXP_TOELEM elem *toElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1360 #elif IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1361 #define ASSIGNEXP_TOELEM DValue* toElem(IRState *irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1362 #else |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1363 #define ASSIGNEXP_TOELEM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1364 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1365 |
159 | 1366 #define ASSIGNEXP(op) \ |
1367 struct op##AssignExp : BinExp \ | |
1368 { \ | |
1369 op##AssignExp(Loc loc, Expression *e1, Expression *e2); \ | |
1370 Expression *semantic(Scope *sc); \ | |
1371 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
|
1372 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
|
1373 X(Expression *buildArrayLoop(Arguments *fparams);) \ |
159 | 1374 \ |
1375 Identifier *opId(); /* For operator overloading */ \ | |
1376 \ | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1377 ASSIGNEXP_TOELEM \ |
159 | 1378 }; |
1379 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1380 #define X(a) a |
159 | 1381 ASSIGNEXP(Add) |
1382 ASSIGNEXP(Min) | |
1383 ASSIGNEXP(Mul) | |
1384 ASSIGNEXP(Div) | |
1385 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
|
1386 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
|
1387 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
|
1388 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
|
1389 #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
|
1390 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1391 #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
|
1392 |
159 | 1393 ASSIGNEXP(Shl) |
1394 ASSIGNEXP(Shr) | |
1395 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
|
1396 ASSIGNEXP(Cat) |
159 | 1397 |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1398 #undef X |
159 | 1399 #undef ASSIGNEXP |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1400 #undef ASSIGNEXP_TOELEM |
159 | 1401 |
1402 struct AddExp : BinExp | |
1403 { | |
1404 AddExp(Loc loc, Expression *e1, Expression *e2); | |
1405 Expression *semantic(Scope *sc); | |
1406 Expression *optimize(int result); | |
1407 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
|
1408 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
|
1409 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1410 |
1411 // For operator overloading | |
1412 int isCommutative(); | |
1413 Identifier *opId(); | |
1414 Identifier *opId_r(); | |
1415 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1416 #if IN_DMD |
159 | 1417 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1418 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1419 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1420 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1421 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1422 #endif |
159 | 1423 }; |
1424 | |
1425 struct MinExp : BinExp | |
1426 { | |
1427 MinExp(Loc loc, Expression *e1, Expression *e2); | |
1428 Expression *semantic(Scope *sc); | |
1429 Expression *optimize(int result); | |
1430 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
|
1431 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
|
1432 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1433 |
1434 // For operator overloading | |
1435 Identifier *opId(); | |
1436 Identifier *opId_r(); | |
1437 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1438 #if IN_DMD |
159 | 1439 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1440 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1441 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1442 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1443 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1444 #endif |
159 | 1445 }; |
1446 | |
1447 struct CatExp : BinExp | |
1448 { | |
1449 CatExp(Loc loc, Expression *e1, Expression *e2); | |
1450 Expression *semantic(Scope *sc); | |
1451 Expression *optimize(int result); | |
1452 Expression *interpret(InterState *istate); | |
1453 | |
1454 // For operator overloading | |
1455 Identifier *opId(); | |
1456 Identifier *opId_r(); | |
1457 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1458 #if IN_DMD |
159 | 1459 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1460 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1461 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1462 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1463 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1464 #endif |
159 | 1465 }; |
1466 | |
1467 struct MulExp : BinExp | |
1468 { | |
1469 MulExp(Loc loc, Expression *e1, Expression *e2); | |
1470 Expression *semantic(Scope *sc); | |
1471 Expression *optimize(int result); | |
1472 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
|
1473 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
|
1474 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1475 |
1476 // For operator overloading | |
1477 int isCommutative(); | |
1478 Identifier *opId(); | |
1479 Identifier *opId_r(); | |
1480 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1481 #if IN_DMD |
159 | 1482 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1483 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1484 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1485 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1486 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1487 #endif |
159 | 1488 }; |
1489 | |
1490 struct DivExp : BinExp | |
1491 { | |
1492 DivExp(Loc loc, Expression *e1, Expression *e2); | |
1493 Expression *semantic(Scope *sc); | |
1494 Expression *optimize(int result); | |
1495 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
|
1496 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
|
1497 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1498 |
1499 // For operator overloading | |
1500 Identifier *opId(); | |
1501 Identifier *opId_r(); | |
1502 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1503 #if IN_DMD |
159 | 1504 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1505 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1506 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1507 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1508 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1509 #endif |
159 | 1510 }; |
1511 | |
1512 struct ModExp : BinExp | |
1513 { | |
1514 ModExp(Loc loc, Expression *e1, Expression *e2); | |
1515 Expression *semantic(Scope *sc); | |
1516 Expression *optimize(int result); | |
1517 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
|
1518 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
|
1519 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1520 |
1521 // For operator overloading | |
1522 Identifier *opId(); | |
1523 Identifier *opId_r(); | |
1524 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1525 #if IN_DMD |
159 | 1526 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1527 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1528 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1529 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1530 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1531 #endif |
159 | 1532 }; |
1533 | |
1534 struct ShlExp : BinExp | |
1535 { | |
1536 ShlExp(Loc loc, Expression *e1, Expression *e2); | |
1537 Expression *semantic(Scope *sc); | |
1538 Expression *optimize(int result); | |
1539 Expression *interpret(InterState *istate); | |
1540 | |
1541 // For operator overloading | |
1542 Identifier *opId(); | |
1543 Identifier *opId_r(); | |
1544 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1545 #if IN_DMD |
159 | 1546 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1547 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1548 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1549 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1550 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1551 #endif |
159 | 1552 }; |
1553 | |
1554 struct ShrExp : BinExp | |
1555 { | |
1556 ShrExp(Loc loc, Expression *e1, Expression *e2); | |
1557 Expression *semantic(Scope *sc); | |
1558 Expression *optimize(int result); | |
1559 Expression *interpret(InterState *istate); | |
1560 | |
1561 // For operator overloading | |
1562 Identifier *opId(); | |
1563 Identifier *opId_r(); | |
1564 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1565 #if IN_DMD |
159 | 1566 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1567 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1568 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1569 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1570 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1571 #endif |
159 | 1572 }; |
1573 | |
1574 struct UshrExp : BinExp | |
1575 { | |
1576 UshrExp(Loc loc, Expression *e1, Expression *e2); | |
1577 Expression *semantic(Scope *sc); | |
1578 Expression *optimize(int result); | |
1579 Expression *interpret(InterState *istate); | |
1580 | |
1581 // For operator overloading | |
1582 Identifier *opId(); | |
1583 Identifier *opId_r(); | |
1584 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1585 #if IN_DMD |
159 | 1586 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1587 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1588 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1589 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1590 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1591 #endif |
159 | 1592 }; |
1593 | |
1594 struct AndExp : BinExp | |
1595 { | |
1596 AndExp(Loc loc, Expression *e1, Expression *e2); | |
1597 Expression *semantic(Scope *sc); | |
1598 Expression *optimize(int result); | |
1599 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
|
1600 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
|
1601 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1602 |
1603 // For operator overloading | |
1604 int isCommutative(); | |
1605 Identifier *opId(); | |
1606 Identifier *opId_r(); | |
1607 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1608 #if IN_DMD |
159 | 1609 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1610 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1611 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1612 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1613 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1614 #endif |
159 | 1615 }; |
1616 | |
1617 struct OrExp : BinExp | |
1618 { | |
1619 OrExp(Loc loc, Expression *e1, Expression *e2); | |
1620 Expression *semantic(Scope *sc); | |
1621 Expression *optimize(int result); | |
1622 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
|
1623 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
|
1624 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1625 |
1626 // For operator overloading | |
1627 int isCommutative(); | |
1628 Identifier *opId(); | |
1629 Identifier *opId_r(); | |
1630 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1631 #if IN_DMD |
159 | 1632 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1633 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1634 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1635 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1636 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1637 #endif |
159 | 1638 }; |
1639 | |
1640 struct XorExp : BinExp | |
1641 { | |
1642 XorExp(Loc loc, Expression *e1, Expression *e2); | |
1643 Expression *semantic(Scope *sc); | |
1644 Expression *optimize(int result); | |
1645 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
|
1646 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
|
1647 Expression *buildArrayLoop(Arguments *fparams); |
159 | 1648 |
1649 // For operator overloading | |
1650 int isCommutative(); | |
1651 Identifier *opId(); | |
1652 Identifier *opId_r(); | |
1653 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1654 #if IN_DMD |
159 | 1655 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1656 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1657 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1658 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1659 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1660 #endif |
159 | 1661 }; |
1662 | |
1663 struct OrOrExp : BinExp | |
1664 { | |
1665 OrOrExp(Loc loc, Expression *e1, Expression *e2); | |
1666 Expression *semantic(Scope *sc); | |
1667 Expression *checkToBoolean(); | |
1668 int isBit(); | |
1669 Expression *optimize(int result); | |
1670 Expression *interpret(InterState *istate); | |
1671 int checkSideEffect(int flag); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1672 #if IN_DMD |
159 | 1673 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1674 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1675 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1676 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1677 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1678 #endif |
159 | 1679 }; |
1680 | |
1681 struct AndAndExp : BinExp | |
1682 { | |
1683 AndAndExp(Loc loc, Expression *e1, Expression *e2); | |
1684 Expression *semantic(Scope *sc); | |
1685 Expression *checkToBoolean(); | |
1686 int isBit(); | |
1687 Expression *optimize(int result); | |
1688 Expression *interpret(InterState *istate); | |
1689 int checkSideEffect(int flag); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1690 #if IN_DMD |
159 | 1691 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1692 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1693 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1694 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1695 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1696 #endif |
159 | 1697 }; |
1698 | |
1699 struct CmpExp : BinExp | |
1700 { | |
1701 CmpExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1702 Expression *semantic(Scope *sc); | |
1703 Expression *optimize(int result); | |
1704 Expression *interpret(InterState *istate); | |
1705 int isBit(); | |
1706 | |
1707 // For operator overloading | |
1708 int isCommutative(); | |
1709 Identifier *opId(); | |
1710 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1711 #if IN_DMD |
159 | 1712 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1713 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1714 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1715 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1716 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1717 #endif |
159 | 1718 }; |
1719 | |
1720 struct InExp : BinExp | |
1721 { | |
1722 InExp(Loc loc, Expression *e1, Expression *e2); | |
1723 Expression *semantic(Scope *sc); | |
1724 int isBit(); | |
1725 | |
1726 // For operator overloading | |
1727 Identifier *opId(); | |
1728 Identifier *opId_r(); | |
1729 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1730 #if IN_DMD |
159 | 1731 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1732 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1733 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1734 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1735 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1736 #endif |
159 | 1737 }; |
1738 | |
1739 struct RemoveExp : BinExp | |
1740 { | |
1741 RemoveExp(Loc loc, Expression *e1, Expression *e2); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1742 #if IN_DMD |
159 | 1743 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1744 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1745 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1746 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1747 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1748 #endif |
159 | 1749 }; |
1750 | |
1751 // == and != | |
1752 | |
1753 struct EqualExp : BinExp | |
1754 { | |
1755 EqualExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1756 Expression *semantic(Scope *sc); | |
1757 Expression *optimize(int result); | |
1758 Expression *interpret(InterState *istate); | |
1759 int isBit(); | |
1760 | |
1761 // For operator overloading | |
1762 int isCommutative(); | |
1763 Identifier *opId(); | |
1764 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1765 #if IN_DMD |
159 | 1766 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1767 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1768 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1769 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1770 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1771 #endif |
159 | 1772 }; |
1773 | |
1774 // === and !=== | |
1775 | |
1776 struct IdentityExp : BinExp | |
1777 { | |
1778 IdentityExp(enum TOK op, Loc loc, Expression *e1, Expression *e2); | |
1779 Expression *semantic(Scope *sc); | |
1780 int isBit(); | |
1781 Expression *optimize(int result); | |
1782 Expression *interpret(InterState *istate); | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1783 #if IN_DMD |
159 | 1784 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1785 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1786 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1787 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1788 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1789 #endif |
159 | 1790 }; |
1791 | |
1792 /****************************************************************/ | |
1793 | |
1794 struct CondExp : BinExp | |
1795 { | |
1796 Expression *econd; | |
1797 | |
1798 CondExp(Loc loc, Expression *econd, Expression *e1, Expression *e2); | |
1799 Expression *syntaxCopy(); | |
1800 Expression *semantic(Scope *sc); | |
1801 Expression *optimize(int result); | |
1802 Expression *interpret(InterState *istate); | |
1803 void checkEscape(); | |
1804 Expression *toLvalue(Scope *sc, Expression *e); | |
1805 Expression *modifiableLvalue(Scope *sc, Expression *e); | |
1806 Expression *checkToBoolean(); | |
1807 int checkSideEffect(int flag); | |
1808 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
1809 MATCH implicitConvTo(Type *t); | |
1810 Expression *castTo(Scope *sc, Type *t); | |
1811 void scanForNestedRef(Scope *sc); | |
1812 | |
1813 int inlineCost(InlineCostState *ics); | |
1814 Expression *doInline(InlineDoState *ids); | |
1815 Expression *inlineScan(InlineScanState *iss); | |
1816 | |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1817 #if IN_DMD |
159 | 1818 elem *toElem(IRState *irs); |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1819 #endif |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1820 |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1821 #if IN_LLVM |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1822 DValue* toElem(IRState* irs); |
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1823 #endif |
159 | 1824 }; |
1825 | |
510
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1826 #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
|
1827 /****************************************************************/ |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1828 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1829 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
|
1830 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1831 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
|
1832 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1833 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
|
1834 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
|
1835 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
|
1836 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1837 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1838 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
|
1839 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1840 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
|
1841 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
|
1842 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
|
1843 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1844 |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1845 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
|
1846 { |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1847 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
|
1848 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
|
1849 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
|
1850 }; |
6aee82889553
Merged DMD 1.034, array operations are not yet implemented ;)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
459
diff
changeset
|
1851 #endif |
159 | 1852 |
1853 /****************************************************************/ | |
1854 | |
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
|
1855 #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
|
1856 |
664
eef8ac26c66c
Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents:
619
diff
changeset
|
1857 // 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
|
1858 |
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
|
1859 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
|
1860 { |
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
|
1861 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
|
1862 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
|
1863 |
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
|
1864 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
|
1865 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
|
1866 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
|
1867 |
1151
3cf0066e6faf
- Versioned Expresssion::toElem with #if IN_DMD/IN_LLVM.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1146
diff
changeset
|
1868 DValue* toElem(IRState* irs); |
860
7edce7e58ab1
Add more toConstElem stubs to get better error messages.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
1869 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
|
1870 }; |
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
|
1871 |
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
|
1872 #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
|
1873 |
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
|
1874 /****************************************************************/ |
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
|
1875 |
159 | 1876 /* Special values used by the interpreter |
1877 */ | |
1878 #define EXP_CANT_INTERPRET ((Expression *)1) | |
1879 #define EXP_CONTINUE_INTERPRET ((Expression *)2) | |
1880 #define EXP_BREAK_INTERPRET ((Expression *)3) | |
1881 #define EXP_GOTO_INTERPRET ((Expression *)4) | |
1882 #define EXP_VOID_INTERPRET ((Expression *)5) | |
1883 | |
1884 Expression *expType(Type *type, Expression *e); | |
1885 | |
1886 Expression *Neg(Type *type, Expression *e1); | |
1887 Expression *Com(Type *type, Expression *e1); | |
1888 Expression *Not(Type *type, Expression *e1); | |
1889 Expression *Bool(Type *type, Expression *e1); | |
1890 Expression *Cast(Type *type, Type *to, Expression *e1); | |
1891 Expression *ArrayLength(Type *type, Expression *e1); | |
1892 Expression *Ptr(Type *type, Expression *e1); | |
1893 | |
1894 Expression *Add(Type *type, Expression *e1, Expression *e2); | |
1895 Expression *Min(Type *type, Expression *e1, Expression *e2); | |
1896 Expression *Mul(Type *type, Expression *e1, Expression *e2); | |
1897 Expression *Div(Type *type, Expression *e1, Expression *e2); | |
1898 Expression *Mod(Type *type, Expression *e1, Expression *e2); | |
1899 Expression *Shl(Type *type, Expression *e1, Expression *e2); | |
1900 Expression *Shr(Type *type, Expression *e1, Expression *e2); | |
1901 Expression *Ushr(Type *type, Expression *e1, Expression *e2); | |
1902 Expression *And(Type *type, Expression *e1, Expression *e2); | |
1903 Expression *Or(Type *type, Expression *e1, Expression *e2); | |
1904 Expression *Xor(Type *type, Expression *e1, Expression *e2); | |
1905 Expression *Index(Type *type, Expression *e1, Expression *e2); | |
1906 Expression *Cat(Type *type, Expression *e1, Expression *e2); | |
1907 | |
1908 Expression *Equal(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1909 Expression *Cmp(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1910 Expression *Identity(enum TOK op, Type *type, Expression *e1, Expression *e2); | |
1911 | |
1912 Expression *Slice(Type *type, Expression *e1, Expression *lwr, Expression *upr); | |
1913 | |
1914 #endif /* DMD_EXPRESSION_H */ |