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