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