Mercurial > projects > ldc
comparison dmd2/statement.h @ 1526:54b3c1394d62
Merged dmdfe 2.031.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Tue, 07 Jul 2009 02:26:11 +0100 |
parents | 638d16625da2 |
children | e4f7b5d9c68a |
comparison
equal
deleted
inserted
replaced
1525:d28cd7c45267 | 1526:54b3c1394d62 |
---|---|
126 virtual int hasBreak(); | 126 virtual int hasBreak(); |
127 virtual int hasContinue(); | 127 virtual int hasContinue(); |
128 virtual int usesEH(); | 128 virtual int usesEH(); |
129 virtual int blockExit(); | 129 virtual int blockExit(); |
130 virtual int comeFrom(); | 130 virtual int comeFrom(); |
131 virtual int isEmpty(); | |
131 virtual void scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); | 132 virtual void scopeCode(Scope *sc, Statement **sentry, Statement **sexit, Statement **sfinally); |
132 virtual Statements *flatten(Scope *sc); | 133 virtual Statements *flatten(Scope *sc); |
133 virtual Expression *interpret(InterState *istate); | 134 virtual Expression *interpret(InterState *istate); |
134 | 135 |
135 virtual int inlineCost(InlineCostState *ics); | 136 virtual int inlineCost(InlineCostState *ics); |
144 virtual CompoundStatement *isCompoundStatement() { return NULL; } | 145 virtual CompoundStatement *isCompoundStatement() { return NULL; } |
145 virtual ReturnStatement *isReturnStatement() { return NULL; } | 146 virtual ReturnStatement *isReturnStatement() { return NULL; } |
146 virtual IfStatement *isIfStatement() { return NULL; } | 147 virtual IfStatement *isIfStatement() { return NULL; } |
147 virtual CaseStatement* isCaseStatement() { return NULL; } | 148 virtual CaseStatement* isCaseStatement() { return NULL; } |
148 | 149 |
149 // LDC | 150 #if IN_LLVM |
150 virtual void toNakedIR(IRState *irs); | 151 virtual void toNakedIR(IRState *irs); |
151 virtual AsmBlockStatement* endsWithAsm(); | 152 virtual AsmBlockStatement* endsWithAsm(); |
153 #endif | |
152 }; | 154 }; |
153 | 155 |
154 struct ExpStatement : Statement | 156 struct ExpStatement : Statement |
155 { | 157 { |
156 Expression *exp; | 158 Expression *exp; |
166 Expression *doInline(InlineDoState *ids); | 168 Expression *doInline(InlineDoState *ids); |
167 Statement *inlineScan(InlineScanState *iss); | 169 Statement *inlineScan(InlineScanState *iss); |
168 | 170 |
169 void toIR(IRState *irs); | 171 void toIR(IRState *irs); |
170 | 172 |
171 // LDC | 173 #if IN_LLVM |
172 void toNakedIR(IRState *irs); | 174 void toNakedIR(IRState *irs); |
175 #endif | |
173 }; | 176 }; |
174 | 177 |
175 struct CompileStatement : Statement | 178 struct CompileStatement : Statement |
176 { | 179 { |
177 Expression *exp; | 180 Expression *exp; |
207 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | 210 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
208 virtual Statement *semantic(Scope *sc); | 211 virtual Statement *semantic(Scope *sc); |
209 int usesEH(); | 212 int usesEH(); |
210 int blockExit(); | 213 int blockExit(); |
211 int comeFrom(); | 214 int comeFrom(); |
215 int isEmpty(); | |
212 virtual Statements *flatten(Scope *sc); | 216 virtual Statements *flatten(Scope *sc); |
213 ReturnStatement *isReturnStatement(); | 217 ReturnStatement *isReturnStatement(); |
214 Expression *interpret(InterState *istate); | 218 Expression *interpret(InterState *istate); |
215 | 219 |
216 int inlineCost(InlineCostState *ics); | 220 int inlineCost(InlineCostState *ics); |
217 Expression *doInline(InlineDoState *ids); | 221 Expression *doInline(InlineDoState *ids); |
218 Statement *inlineScan(InlineScanState *iss); | 222 Statement *inlineScan(InlineScanState *iss); |
219 | 223 |
220 virtual void toIR(IRState *irs); | 224 virtual void toIR(IRState *irs); |
221 | 225 |
222 // LDC | 226 #if IN_LLVM |
223 virtual void toNakedIR(IRState *irs); | 227 virtual void toNakedIR(IRState *irs); |
224 virtual AsmBlockStatement* endsWithAsm(); | 228 virtual AsmBlockStatement* endsWithAsm(); |
229 #endif | |
225 | 230 |
226 virtual CompoundStatement *isCompoundStatement() { return this; } | 231 virtual CompoundStatement *isCompoundStatement() { return this; } |
227 }; | 232 }; |
228 | 233 |
229 struct CompoundDeclarationStatement : CompoundStatement | 234 struct CompoundDeclarationStatement : CompoundStatement |
270 int hasBreak(); | 275 int hasBreak(); |
271 int hasContinue(); | 276 int hasContinue(); |
272 int usesEH(); | 277 int usesEH(); |
273 int blockExit(); | 278 int blockExit(); |
274 int comeFrom(); | 279 int comeFrom(); |
280 int isEmpty(); | |
275 Expression *interpret(InterState *istate); | 281 Expression *interpret(InterState *istate); |
276 | 282 |
277 Statement *inlineScan(InlineScanState *iss); | 283 Statement *inlineScan(InlineScanState *iss); |
278 | 284 |
279 void toIR(IRState *irs); | 285 void toIR(IRState *irs); |
477 | 483 |
478 struct SwitchStatement : Statement | 484 struct SwitchStatement : Statement |
479 { | 485 { |
480 Expression *condition; | 486 Expression *condition; |
481 Statement *body; | 487 Statement *body; |
488 bool isFinal; | |
482 | 489 |
483 DefaultStatement *sdefault; | 490 DefaultStatement *sdefault; |
484 | 491 |
485 Array gotoCases; // array of unresolved GotoCaseStatement's | 492 Array gotoCases; // array of unresolved GotoCaseStatement's |
486 Array *cases; // array of CaseStatement's | 493 Array *cases; // array of CaseStatement's |
487 int hasNoDefault; // !=0 if no default statement | 494 int hasNoDefault; // !=0 if no default statement |
488 int hasVars; // !=0 if has variable case values | 495 int hasVars; // !=0 if has variable case values |
489 | 496 |
490 // LDC | 497 #if IN_LLVM |
491 Statement *enclosingScopeExit; | 498 Statement *enclosingScopeExit; |
492 | 499 #endif |
493 SwitchStatement(Loc loc, Expression *c, Statement *b); | 500 |
501 SwitchStatement(Loc loc, Expression *c, Statement *b, bool isFinal); | |
494 Statement *syntaxCopy(); | 502 Statement *syntaxCopy(); |
495 Statement *semantic(Scope *sc); | 503 Statement *semantic(Scope *sc); |
496 int hasBreak(); | 504 int hasBreak(); |
497 int usesEH(); | 505 int usesEH(); |
498 int blockExit(); | 506 int blockExit(); |
506 | 514 |
507 struct CaseStatement : Statement | 515 struct CaseStatement : Statement |
508 { | 516 { |
509 Expression *exp; | 517 Expression *exp; |
510 Statement *statement; | 518 Statement *statement; |
519 | |
511 int index; // which case it is (since we sort this) | 520 int index; // which case it is (since we sort this) |
512 block *cblock; // back end: label for the block | 521 block *cblock; // back end: label for the block |
513 | 522 |
514 // LDC | 523 #if IN_LLVM |
515 Statement *enclosingScopeExit; | 524 Statement *enclosingScopeExit; |
525 #endif | |
516 | 526 |
517 CaseStatement(Loc loc, Expression *exp, Statement *s); | 527 CaseStatement(Loc loc, Expression *exp, Statement *s); |
518 Statement *syntaxCopy(); | 528 Statement *syntaxCopy(); |
519 Statement *semantic(Scope *sc); | 529 Statement *semantic(Scope *sc); |
520 int compare(Object *obj); | 530 int compare(Object *obj); |
528 | 538 |
529 void toIR(IRState *irs); | 539 void toIR(IRState *irs); |
530 | 540 |
531 CaseStatement* isCaseStatement() { return this; } | 541 CaseStatement* isCaseStatement() { return this; } |
532 | 542 |
533 // LDC | 543 #if IN_LLVM |
534 llvm::BasicBlock* bodyBB; | 544 llvm::BasicBlock* bodyBB; |
535 llvm::ConstantInt* llvmIdx; | 545 llvm::ConstantInt* llvmIdx; |
536 }; | 546 #endif |
547 }; | |
548 | |
549 #if DMDV2 | |
550 | |
551 struct CaseRangeStatement : Statement | |
552 { | |
553 Expression *first; | |
554 Expression *last; | |
555 Statement *statement; | |
556 | |
557 CaseRangeStatement(Loc loc, Expression *first, Expression *last, Statement *s); | |
558 Statement *syntaxCopy(); | |
559 Statement *semantic(Scope *sc); | |
560 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
561 }; | |
562 | |
563 #endif | |
537 | 564 |
538 struct DefaultStatement : Statement | 565 struct DefaultStatement : Statement |
539 { | 566 { |
540 Statement *statement; | 567 Statement *statement; |
541 #if IN_GCC | 568 #if IN_GCC |
542 block *cblock; // back end: label for the block | 569 block *cblock; // back end: label for the block |
543 #endif | 570 #endif |
544 | 571 |
545 // LDC | 572 #if IN_LLVM |
546 Statement *enclosingScopeExit; | 573 Statement *enclosingScopeExit; |
574 #endif | |
547 | 575 |
548 DefaultStatement(Loc loc, Statement *s); | 576 DefaultStatement(Loc loc, Statement *s); |
549 Statement *syntaxCopy(); | 577 Statement *syntaxCopy(); |
550 Statement *semantic(Scope *sc); | 578 Statement *semantic(Scope *sc); |
551 int usesEH(); | 579 int usesEH(); |
556 | 584 |
557 Statement *inlineScan(InlineScanState *iss); | 585 Statement *inlineScan(InlineScanState *iss); |
558 | 586 |
559 void toIR(IRState *irs); | 587 void toIR(IRState *irs); |
560 | 588 |
561 // LDC | 589 #if IN_LLVM |
562 llvm::BasicBlock* bodyBB; | 590 llvm::BasicBlock* bodyBB; |
591 #endif | |
563 }; | 592 }; |
564 | 593 |
565 struct GotoDefaultStatement : Statement | 594 struct GotoDefaultStatement : Statement |
566 { | 595 { |
567 SwitchStatement *sw; | 596 SwitchStatement *sw; |
632 int blockExit(); | 661 int blockExit(); |
633 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | 662 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
634 | 663 |
635 void toIR(IRState *irs); | 664 void toIR(IRState *irs); |
636 | 665 |
666 #if IN_LLVM | |
637 // LDC: only set if ident is set: label statement to jump to | 667 // LDC: only set if ident is set: label statement to jump to |
638 LabelStatement *target; | 668 LabelStatement *target; |
669 #endif | |
639 }; | 670 }; |
640 | 671 |
641 struct ContinueStatement : Statement | 672 struct ContinueStatement : Statement |
642 { | 673 { |
643 Identifier *ident; | 674 Identifier *ident; |
649 int blockExit(); | 680 int blockExit(); |
650 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | 681 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
651 | 682 |
652 void toIR(IRState *irs); | 683 void toIR(IRState *irs); |
653 | 684 |
685 #if IN_LLVM | |
654 // LDC: only set if ident is set: label statement to jump to | 686 // LDC: only set if ident is set: label statement to jump to |
655 LabelStatement *target; | 687 LabelStatement *target; |
688 #endif | |
656 }; | 689 }; |
657 | 690 |
658 struct SynchronizedStatement : Statement | 691 struct SynchronizedStatement : Statement |
659 { | 692 { |
660 Expression *exp; | 693 Expression *exp; |
673 | 706 |
674 // Back end | 707 // Back end |
675 elem *esync; | 708 elem *esync; |
676 SynchronizedStatement(Loc loc, elem *esync, Statement *body); | 709 SynchronizedStatement(Loc loc, elem *esync, Statement *body); |
677 void toIR(IRState *irs); | 710 void toIR(IRState *irs); |
711 #if IN_LLVM | |
678 llvm::Value* llsync; | 712 llvm::Value* llsync; |
713 #endif | |
679 }; | 714 }; |
680 | 715 |
681 struct WithStatement : Statement | 716 struct WithStatement : Statement |
682 { | 717 { |
683 Expression *exp; | 718 Expression *exp; |
835 | 870 |
836 Statement *inlineScan(InlineScanState *iss); | 871 Statement *inlineScan(InlineScanState *iss); |
837 | 872 |
838 void toIR(IRState *irs); | 873 void toIR(IRState *irs); |
839 | 874 |
840 // LDC | 875 #if IN_LLVM |
841 bool asmLabel; // for labels inside inline assembler | 876 bool asmLabel; // for labels inside inline assembler |
842 void toNakedIR(IRState *irs); | 877 void toNakedIR(IRState *irs); |
878 #endif | |
843 }; | 879 }; |
844 | 880 |
845 struct LabelDsymbol : Dsymbol | 881 struct LabelDsymbol : Dsymbol |
846 { | 882 { |
847 LabelStatement *statement; | 883 LabelStatement *statement; |
871 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | 907 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
872 virtual AsmStatement *isAsmStatement() { return this; } | 908 virtual AsmStatement *isAsmStatement() { return this; } |
873 | 909 |
874 void toIR(IRState *irs); | 910 void toIR(IRState *irs); |
875 | 911 |
876 // LDC | 912 #if IN_LLVM |
877 // non-zero if this is a branch, contains the target labels identifier | 913 // non-zero if this is a branch, contains the target labels identifier |
878 Identifier* isBranchToLabel; | 914 Identifier* isBranchToLabel; |
879 | 915 |
880 void toNakedIR(IRState *irs); | 916 void toNakedIR(IRState *irs); |
917 #endif | |
881 }; | 918 }; |
882 | 919 |
883 struct AsmBlockStatement : CompoundStatement | 920 struct AsmBlockStatement : CompoundStatement |
884 { | 921 { |
885 TryFinallyStatement* enclosingFinally; | 922 TryFinallyStatement* enclosingFinally; |