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