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