comparison dmd/expression.h @ 40:8b0e809563df trunk

[svn r44] Lots of bug fixes. New array literal support New array ~= operator support (for single element) New with statement support More...
author lindquist
date Fri, 19 Oct 2007 07:43:21 +0200
parents 3cfcb944304e
children fd32135dca3e
comparison
equal deleted inserted replaced
39:fd5e8bbfcb25 40:8b0e809563df
44 struct InterState; 44 struct InterState;
45 struct Symbol; // back end symbol 45 struct Symbol; // back end symbol
46 46
47 namespace llvm 47 namespace llvm
48 { 48 {
49 class Constant;
49 class ConstantInt; 50 class ConstantInt;
50 } 51 }
51 52
52 enum TOK; 53 enum TOK;
53 54
145 virtual Identifier *opId_r(); 146 virtual Identifier *opId_r();
146 147
147 // Back end 148 // Back end
148 virtual elem *toElem(IRState *irs); 149 virtual elem *toElem(IRState *irs);
149 virtual dt_t **toDt(dt_t **pdt); 150 virtual dt_t **toDt(dt_t **pdt);
151 // LLVMDC
152 virtual llvm::Constant *toConstElem(IRState *irs);
150 }; 153 };
151 154
152 struct IntegerExp : Expression 155 struct IntegerExp : Expression
153 { 156 {
154 integer_t value; 157 integer_t value;
170 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 173 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
171 void toMangleBuffer(OutBuffer *buf); 174 void toMangleBuffer(OutBuffer *buf);
172 Expression *toLvalue(Scope *sc, Expression *e); 175 Expression *toLvalue(Scope *sc, Expression *e);
173 elem *toElem(IRState *irs); 176 elem *toElem(IRState *irs);
174 dt_t **toDt(dt_t **pdt); 177 dt_t **toDt(dt_t **pdt);
178 // LLVMDC
179 virtual llvm::Constant *toConstElem(IRState *irs);
175 }; 180 };
176 181
177 struct RealExp : Expression 182 struct RealExp : Expression
178 { 183 {
179 real_t value; 184 real_t value;
193 int isBool(int result); 198 int isBool(int result);
194 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 199 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
195 void toMangleBuffer(OutBuffer *buf); 200 void toMangleBuffer(OutBuffer *buf);
196 elem *toElem(IRState *irs); 201 elem *toElem(IRState *irs);
197 dt_t **toDt(dt_t **pdt); 202 dt_t **toDt(dt_t **pdt);
203 // LLVMDC
204 virtual llvm::Constant *toConstElem(IRState *irs);
198 }; 205 };
199 206
200 struct ComplexExp : Expression 207 struct ComplexExp : Expression
201 { 208 {
202 complex_t value; 209 complex_t value;
296 MATCH implicitConvTo(Type *t); 303 MATCH implicitConvTo(Type *t);
297 Expression *castTo(Scope *sc, Type *t); 304 Expression *castTo(Scope *sc, Type *t);
298 Expression *interpret(InterState *istate); 305 Expression *interpret(InterState *istate);
299 elem *toElem(IRState *irs); 306 elem *toElem(IRState *irs);
300 dt_t **toDt(dt_t **pdt); 307 dt_t **toDt(dt_t **pdt);
308 // LLVMDC
309 virtual llvm::Constant *toConstElem(IRState *irs);
301 }; 310 };
302 311
303 struct StringExp : Expression 312 struct StringExp : Expression
304 { 313 {
305 void *string; // char, wchar, or dchar data 314 void *string; // char, wchar, or dchar data
324 unsigned charAt(size_t i); 333 unsigned charAt(size_t i);
325 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); 334 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
326 void toMangleBuffer(OutBuffer *buf); 335 void toMangleBuffer(OutBuffer *buf);
327 elem *toElem(IRState *irs); 336 elem *toElem(IRState *irs);
328 dt_t **toDt(dt_t **pdt); 337 dt_t **toDt(dt_t **pdt);
338 // LLVMDC
339 virtual llvm::Constant *toConstElem(IRState *irs);
329 }; 340 };
330 341
331 // Tuple 342 // Tuple
332 343
333 struct TupleExp : Expression 344 struct TupleExp : Expression
374 dt_t **toDt(dt_t **pdt); 385 dt_t **toDt(dt_t **pdt);
375 386
376 int inlineCost(InlineCostState *ics); 387 int inlineCost(InlineCostState *ics);
377 Expression *doInline(InlineDoState *ids); 388 Expression *doInline(InlineDoState *ids);
378 Expression *inlineScan(InlineScanState *iss); 389 Expression *inlineScan(InlineScanState *iss);
390 // LLVMDC
391 virtual llvm::Constant *toConstElem(IRState *irs);
379 }; 392 };
380 393
381 struct AssocArrayLiteralExp : Expression 394 struct AssocArrayLiteralExp : Expression
382 { 395 {
383 Expressions *keys; 396 Expressions *keys;
399 Expression *castTo(Scope *sc, Type *t); 412 Expression *castTo(Scope *sc, Type *t);
400 413
401 int inlineCost(InlineCostState *ics); 414 int inlineCost(InlineCostState *ics);
402 Expression *doInline(InlineDoState *ids); 415 Expression *doInline(InlineDoState *ids);
403 Expression *inlineScan(InlineScanState *iss); 416 Expression *inlineScan(InlineScanState *iss);
417 // LLVMDC
418 virtual llvm::Constant *toConstElem(IRState *irs);
404 }; 419 };
405 420
406 struct StructLiteralExp : Expression 421 struct StructLiteralExp : Expression
407 { 422 {
408 StructDeclaration *sd; // which aggregate this is for 423 StructDeclaration *sd; // which aggregate this is for
430 Expression *toLvalue(Scope *sc, Expression *e); 445 Expression *toLvalue(Scope *sc, Expression *e);
431 446
432 int inlineCost(InlineCostState *ics); 447 int inlineCost(InlineCostState *ics);
433 Expression *doInline(InlineDoState *ids); 448 Expression *doInline(InlineDoState *ids);
434 Expression *inlineScan(InlineScanState *iss); 449 Expression *inlineScan(InlineScanState *iss);
450 // LLVMDC
451 virtual llvm::Constant *toConstElem(IRState *irs);
435 }; 452 };
436 453
437 struct TypeDotIdExp : Expression 454 struct TypeDotIdExp : Expression
438 { 455 {
439 Identifier *ident; 456 Identifier *ident;
562 void scanForNestedRef(Scope *sc); 579 void scanForNestedRef(Scope *sc);
563 580
564 int inlineCost(InlineCostState *ics); 581 int inlineCost(InlineCostState *ics);
565 Expression *doInline(InlineDoState *ids); 582 Expression *doInline(InlineDoState *ids);
566 //Expression *inlineScan(InlineScanState *iss); 583 //Expression *inlineScan(InlineScanState *iss);
584 // LLVMDC
585 virtual llvm::Constant *toConstElem(IRState *irs);
567 }; 586 };
568 587
569 // Function/Delegate literal 588 // Function/Delegate literal
570 589
571 struct FuncExp : Expression 590 struct FuncExp : Expression