Mercurial > projects > ldc
annotate dmd/statement.h @ 92:70d6113eeb8c trunk
[svn r96] Updated to DMD 1.023.
Regular bugfixes.
author | lindquist |
---|---|
date | Thu, 08 Nov 2007 19:13:28 +0100 |
parents | fd32135dca3e |
children | 288fe1029e1f |
rev | line source |
---|---|
1 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 by Digital Mars | |
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_STATEMENT_H | |
12 #define DMD_STATEMENT_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 | |
20 #include "arraytypes.h" | |
21 #include "dsymbol.h" | |
22 #include "lexer.h" | |
23 | |
24 struct OutBuffer; | |
25 struct Scope; | |
26 struct Expression; | |
27 struct LabelDsymbol; | |
28 struct Identifier; | |
29 struct IfStatement; | |
30 struct DeclarationStatement; | |
31 struct DefaultStatement; | |
32 struct VarDeclaration; | |
33 struct Condition; | |
34 struct Module; | |
35 struct Token; | |
36 struct InlineCostState; | |
37 struct InlineDoState; | |
38 struct InlineScanState; | |
39 struct ReturnStatement; | |
40 struct CompoundStatement; | |
41 struct Argument; | |
42 struct StaticAssert; | |
43 struct AsmStatement; | |
44 struct GotoStatement; | |
45 struct ScopeStatement; | |
46 struct TryCatchStatement; | |
47 struct HdrGenState; | |
48 struct InterState; | |
49 | |
50 enum TOK; | |
51 | |
52 namespace llvm | |
53 { | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
54 class Value; |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
55 class BasicBlock; |
1 | 56 } |
57 | |
58 // Back end | |
59 struct IRState; | |
60 struct Blockx; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
61 #if IN_LLVM |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
62 struct DValue; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
63 typedef DValue elem; |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
64 #endif |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
65 |
1 | 66 #if IN_GCC |
67 union tree_node; typedef union tree_node block; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
68 //union tree_node; typedef union tree_node elem; |
1 | 69 #else |
70 struct block; | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
71 //struct elem; |
1 | 72 #endif |
73 struct code; | |
74 | |
75 struct Statement : Object | |
76 { | |
77 Loc loc; | |
78 | |
79 Statement(Loc loc); | |
80 virtual Statement *syntaxCopy(); | |
81 | |
82 void print(); | |
83 char *toChars(); | |
84 | |
85 void error(const char *format, ...); | |
86 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
87 virtual TryCatchStatement *isTryCatchStatement() { return NULL; } | |
88 virtual GotoStatement *isGotoStatement() { return NULL; } | |
89 virtual AsmStatement *isAsmStatement() { return NULL; } | |
90 #ifdef _DH | |
91 int incontract; | |
92 #endif | |
93 virtual ScopeStatement *isScopeStatement() { return NULL; } | |
94 virtual Statement *semantic(Scope *sc); | |
95 Statement *semanticScope(Scope *sc, Statement *sbreak, Statement *scontinue); | |
96 virtual int hasBreak(); | |
97 virtual int hasContinue(); | |
98 virtual int usesEH(); | |
99 virtual int fallOffEnd(); | |
100 virtual int comeFrom(); | |
101 virtual void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
102 virtual Statements *flatten(Scope *sc); | |
103 virtual Expression *interpret(InterState *istate); | |
104 | |
105 virtual int inlineCost(InlineCostState *ics); | |
106 virtual Expression *doInline(InlineDoState *ids); | |
107 virtual Statement *inlineScan(InlineScanState *iss); | |
108 | |
109 // Back end | |
110 virtual void toIR(IRState *irs); | |
111 | |
112 // Avoid dynamic_cast | |
113 virtual DeclarationStatement *isDeclarationStatement() { return NULL; } | |
114 virtual CompoundStatement *isCompoundStatement() { return NULL; } | |
115 virtual ReturnStatement *isReturnStatement() { return NULL; } | |
116 virtual IfStatement *isIfStatement() { return NULL; } | |
117 }; | |
118 | |
119 struct ExpStatement : Statement | |
120 { | |
121 Expression *exp; | |
122 | |
123 ExpStatement(Loc loc, Expression *exp); | |
124 Statement *syntaxCopy(); | |
125 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
126 Statement *semantic(Scope *sc); | |
127 Expression *interpret(InterState *istate); | |
128 int fallOffEnd(); | |
129 | |
130 int inlineCost(InlineCostState *ics); | |
131 Expression *doInline(InlineDoState *ids); | |
132 Statement *inlineScan(InlineScanState *iss); | |
133 | |
134 void toIR(IRState *irs); | |
135 }; | |
136 | |
137 struct CompileStatement : Statement | |
138 { | |
139 Expression *exp; | |
140 | |
141 CompileStatement(Loc loc, Expression *exp); | |
142 Statement *syntaxCopy(); | |
143 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
144 Statement *semantic(Scope *sc); | |
145 }; | |
146 | |
147 struct DeclarationStatement : ExpStatement | |
148 { | |
149 // Doing declarations as an expression, rather than a statement, | |
150 // makes inlining functions much easier. | |
151 | |
152 DeclarationStatement(Loc loc, Dsymbol *s); | |
153 DeclarationStatement(Loc loc, Expression *exp); | |
154 Statement *syntaxCopy(); | |
155 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
156 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
157 | |
158 DeclarationStatement *isDeclarationStatement() { return this; } | |
159 }; | |
160 | |
161 struct CompoundStatement : Statement | |
162 { | |
163 Statements *statements; | |
164 | |
165 CompoundStatement(Loc loc, Statements *s); | |
166 CompoundStatement(Loc loc, Statement *s1, Statement *s2); | |
167 Statement *syntaxCopy(); | |
168 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
169 Statement *semantic(Scope *sc); | |
170 int usesEH(); | |
171 int fallOffEnd(); | |
172 int comeFrom(); | |
173 Statements *flatten(Scope *sc); | |
174 ReturnStatement *isReturnStatement(); | |
175 Expression *interpret(InterState *istate); | |
176 | |
177 int inlineCost(InlineCostState *ics); | |
178 Expression *doInline(InlineDoState *ids); | |
179 Statement *inlineScan(InlineScanState *iss); | |
180 | |
181 void toIR(IRState *irs); | |
182 | |
183 CompoundStatement *isCompoundStatement() { return this; } | |
184 }; | |
185 | |
186 /* The purpose of this is so that continue will go to the next | |
187 * of the statements, and break will go to the end of the statements. | |
188 */ | |
189 struct UnrolledLoopStatement : Statement | |
190 { | |
191 Statements *statements; | |
192 | |
193 UnrolledLoopStatement(Loc loc, Statements *statements); | |
194 Statement *syntaxCopy(); | |
195 Statement *semantic(Scope *sc); | |
196 int hasBreak(); | |
197 int hasContinue(); | |
198 int usesEH(); | |
199 int fallOffEnd(); | |
200 int comeFrom(); | |
201 Expression *interpret(InterState *istate); | |
202 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
203 | |
204 int inlineCost(InlineCostState *ics); | |
205 Expression *doInline(InlineDoState *ids); | |
206 Statement *inlineScan(InlineScanState *iss); | |
207 | |
208 void toIR(IRState *irs); | |
209 }; | |
210 | |
211 struct ScopeStatement : Statement | |
212 { | |
213 Statement *statement; | |
214 | |
215 ScopeStatement(Loc loc, Statement *s); | |
216 Statement *syntaxCopy(); | |
217 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
218 ScopeStatement *isScopeStatement() { return this; } | |
219 Statement *semantic(Scope *sc); | |
220 int hasBreak(); | |
221 int hasContinue(); | |
222 int usesEH(); | |
223 int fallOffEnd(); | |
224 int comeFrom(); | |
225 Expression *interpret(InterState *istate); | |
226 | |
227 Statement *inlineScan(InlineScanState *iss); | |
228 | |
229 void toIR(IRState *irs); | |
230 }; | |
231 | |
232 struct WhileStatement : Statement | |
233 { | |
234 Expression *condition; | |
235 Statement *body; | |
236 | |
237 WhileStatement(Loc loc, Expression *c, Statement *b); | |
238 Statement *syntaxCopy(); | |
239 Statement *semantic(Scope *sc); | |
240 int hasBreak(); | |
241 int hasContinue(); | |
242 int usesEH(); | |
243 int fallOffEnd(); | |
244 int comeFrom(); | |
245 Expression *interpret(InterState *istate); | |
246 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
247 | |
248 Statement *inlineScan(InlineScanState *iss); | |
249 | |
250 void toIR(IRState *irs); | |
251 }; | |
252 | |
253 struct DoStatement : Statement | |
254 { | |
255 Statement *body; | |
256 Expression *condition; | |
257 | |
258 DoStatement(Loc loc, Statement *b, Expression *c); | |
259 Statement *syntaxCopy(); | |
260 Statement *semantic(Scope *sc); | |
261 int hasBreak(); | |
262 int hasContinue(); | |
263 int usesEH(); | |
264 int fallOffEnd(); | |
265 int comeFrom(); | |
266 Expression *interpret(InterState *istate); | |
267 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
268 | |
269 Statement *inlineScan(InlineScanState *iss); | |
270 | |
271 void toIR(IRState *irs); | |
272 }; | |
273 | |
274 struct ForStatement : Statement | |
275 { | |
276 Statement *init; | |
277 Expression *condition; | |
278 Expression *increment; | |
279 Statement *body; | |
280 | |
281 ForStatement(Loc loc, Statement *init, Expression *condition, Expression *increment, Statement *body); | |
282 Statement *syntaxCopy(); | |
283 Statement *semantic(Scope *sc); | |
284 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
285 int hasBreak(); | |
286 int hasContinue(); | |
287 int usesEH(); | |
288 int fallOffEnd(); | |
289 int comeFrom(); | |
290 Expression *interpret(InterState *istate); | |
291 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
292 | |
293 Statement *inlineScan(InlineScanState *iss); | |
294 | |
295 void toIR(IRState *irs); | |
296 }; | |
297 | |
298 struct ForeachStatement : Statement | |
299 { | |
300 enum TOK op; // TOKforeach or TOKforeach_reverse | |
301 Arguments *arguments; // array of Argument*'s | |
302 Expression *aggr; | |
303 Statement *body; | |
304 | |
305 VarDeclaration *key; | |
306 VarDeclaration *value; | |
307 | |
308 FuncDeclaration *func; // function we're lexically in | |
309 | |
310 Array cases; // put breaks, continues, gotos and returns here | |
311 Array gotos; // forward referenced goto's go here | |
312 | |
313 ForeachStatement(Loc loc, enum TOK op, Arguments *arguments, Expression *aggr, Statement *body); | |
314 Statement *syntaxCopy(); | |
315 Statement *semantic(Scope *sc); | |
316 int hasBreak(); | |
317 int hasContinue(); | |
318 int usesEH(); | |
319 int fallOffEnd(); | |
320 int comeFrom(); | |
321 Expression *interpret(InterState *istate); | |
322 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
323 | |
324 Statement *inlineScan(InlineScanState *iss); | |
325 | |
326 void toIR(IRState *irs); | |
327 }; | |
328 | |
329 struct IfStatement : Statement | |
330 { | |
331 Argument *arg; | |
332 Expression *condition; | |
333 Statement *ifbody; | |
334 Statement *elsebody; | |
335 | |
336 VarDeclaration *match; // for MatchExpression results | |
337 | |
338 IfStatement(Loc loc, Argument *arg, Expression *condition, Statement *ifbody, Statement *elsebody); | |
339 Statement *syntaxCopy(); | |
340 Statement *semantic(Scope *sc); | |
341 Expression *interpret(InterState *istate); | |
342 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
343 int usesEH(); | |
344 int fallOffEnd(); | |
345 IfStatement *isIfStatement() { return this; } | |
346 | |
347 int inlineCost(InlineCostState *ics); | |
348 Expression *doInline(InlineDoState *ids); | |
349 Statement *inlineScan(InlineScanState *iss); | |
350 | |
351 void toIR(IRState *irs); | |
352 }; | |
353 | |
354 struct ConditionalStatement : Statement | |
355 { | |
356 Condition *condition; | |
357 Statement *ifbody; | |
358 Statement *elsebody; | |
359 | |
360 ConditionalStatement(Loc loc, Condition *condition, Statement *ifbody, Statement *elsebody); | |
361 Statement *syntaxCopy(); | |
362 Statement *semantic(Scope *sc); | |
363 Statements *flatten(Scope *sc); | |
364 int usesEH(); | |
365 | |
366 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
367 }; | |
368 | |
369 struct PragmaStatement : Statement | |
370 { | |
371 Identifier *ident; | |
372 Expressions *args; // array of Expression's | |
373 Statement *body; | |
374 | |
375 PragmaStatement(Loc loc, Identifier *ident, Expressions *args, Statement *body); | |
376 Statement *syntaxCopy(); | |
377 Statement *semantic(Scope *sc); | |
378 int usesEH(); | |
379 int fallOffEnd(); | |
380 | |
381 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
382 }; | |
383 | |
384 struct StaticAssertStatement : Statement | |
385 { | |
386 StaticAssert *sa; | |
387 | |
388 StaticAssertStatement(StaticAssert *sa); | |
389 Statement *syntaxCopy(); | |
390 Statement *semantic(Scope *sc); | |
391 | |
392 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
393 }; | |
394 | |
395 struct SwitchStatement : Statement | |
396 { | |
397 Expression *condition; | |
398 Statement *body; | |
399 DefaultStatement *sdefault; | |
400 | |
401 Array gotoCases; // array of unresolved GotoCaseStatement's | |
402 Array *cases; // array of CaseStatement's | |
403 int hasNoDefault; // !=0 if no default statement | |
404 | |
405 SwitchStatement(Loc loc, Expression *c, Statement *b); | |
406 Statement *syntaxCopy(); | |
407 Statement *semantic(Scope *sc); | |
408 int hasBreak(); | |
409 int usesEH(); | |
410 int fallOffEnd(); | |
411 Expression *interpret(InterState *istate); | |
412 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
413 | |
414 Statement *inlineScan(InlineScanState *iss); | |
415 | |
416 void toIR(IRState *irs); | |
417 }; | |
418 | |
419 struct CaseStatement : Statement | |
420 { | |
421 Expression *exp; | |
422 Statement *statement; | |
423 int index; // which case it is (since we sort this) | |
424 block *cblock; // back end: label for the block | |
425 | |
426 CaseStatement(Loc loc, Expression *exp, Statement *s); | |
427 Statement *syntaxCopy(); | |
428 Statement *semantic(Scope *sc); | |
429 int compare(Object *obj); | |
430 int usesEH(); | |
431 int fallOffEnd(); | |
432 int comeFrom(); | |
433 Expression *interpret(InterState *istate); | |
434 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
435 | |
436 Statement *inlineScan(InlineScanState *iss); | |
437 | |
438 void toIR(IRState *irs); | |
439 }; | |
440 | |
441 struct DefaultStatement : Statement | |
442 { | |
443 Statement *statement; | |
444 #if IN_GCC | |
445 block *cblock; // back end: label for the block | |
446 #endif | |
447 | |
448 DefaultStatement(Loc loc, Statement *s); | |
449 Statement *syntaxCopy(); | |
450 Statement *semantic(Scope *sc); | |
451 int usesEH(); | |
452 int fallOffEnd(); | |
453 int comeFrom(); | |
454 Expression *interpret(InterState *istate); | |
455 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
456 | |
457 Statement *inlineScan(InlineScanState *iss); | |
458 | |
459 void toIR(IRState *irs); | |
460 }; | |
461 | |
462 struct GotoDefaultStatement : Statement | |
463 { | |
464 SwitchStatement *sw; | |
465 | |
466 GotoDefaultStatement(Loc loc); | |
467 Statement *syntaxCopy(); | |
468 Statement *semantic(Scope *sc); | |
469 Expression *interpret(InterState *istate); | |
470 int fallOffEnd(); | |
471 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
472 | |
473 void toIR(IRState *irs); | |
474 }; | |
475 | |
476 struct GotoCaseStatement : Statement | |
477 { | |
478 Expression *exp; // NULL, or which case to goto | |
479 CaseStatement *cs; // case statement it resolves to | |
480 | |
481 GotoCaseStatement(Loc loc, Expression *exp); | |
482 Statement *syntaxCopy(); | |
483 Statement *semantic(Scope *sc); | |
484 Expression *interpret(InterState *istate); | |
485 int fallOffEnd(); | |
486 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
487 | |
488 void toIR(IRState *irs); | |
489 }; | |
490 | |
491 struct SwitchErrorStatement : Statement | |
492 { | |
493 SwitchErrorStatement(Loc loc); | |
494 int fallOffEnd(); | |
495 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
496 | |
497 void toIR(IRState *irs); | |
498 }; | |
499 | |
500 struct ReturnStatement : Statement | |
501 { | |
502 Expression *exp; | |
503 | |
504 ReturnStatement(Loc loc, Expression *exp); | |
505 Statement *syntaxCopy(); | |
506 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
507 Statement *semantic(Scope *sc); | |
508 int fallOffEnd(); | |
509 Expression *interpret(InterState *istate); | |
510 | |
511 int inlineCost(InlineCostState *ics); | |
512 Expression *doInline(InlineDoState *ids); | |
513 Statement *inlineScan(InlineScanState *iss); | |
514 | |
515 void toIR(IRState *irs); | |
516 | |
517 ReturnStatement *isReturnStatement() { return this; } | |
518 }; | |
519 | |
520 struct BreakStatement : Statement | |
521 { | |
522 Identifier *ident; | |
523 | |
524 BreakStatement(Loc loc, Identifier *ident); | |
525 Statement *syntaxCopy(); | |
526 Statement *semantic(Scope *sc); | |
527 Expression *interpret(InterState *istate); | |
528 int fallOffEnd(); | |
529 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
530 | |
531 void toIR(IRState *irs); | |
532 }; | |
533 | |
534 struct ContinueStatement : Statement | |
535 { | |
536 Identifier *ident; | |
537 | |
538 ContinueStatement(Loc loc, Identifier *ident); | |
539 Statement *syntaxCopy(); | |
540 Statement *semantic(Scope *sc); | |
541 Expression *interpret(InterState *istate); | |
542 int fallOffEnd(); | |
543 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
544 | |
545 void toIR(IRState *irs); | |
546 }; | |
547 | |
548 struct SynchronizedStatement : Statement | |
549 { | |
550 Expression *exp; | |
551 Statement *body; | |
552 | |
553 SynchronizedStatement(Loc loc, Expression *exp, Statement *body); | |
554 Statement *syntaxCopy(); | |
555 Statement *semantic(Scope *sc); | |
556 int hasBreak(); | |
557 int hasContinue(); | |
558 int usesEH(); | |
559 int fallOffEnd(); | |
560 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
561 | |
562 Statement *inlineScan(InlineScanState *iss); | |
563 | |
564 // Back end | |
565 elem *esync; | |
566 SynchronizedStatement(Loc loc, elem *esync, Statement *body); | |
567 void toIR(IRState *irs); | |
568 }; | |
569 | |
570 struct WithStatement : Statement | |
571 { | |
572 Expression *exp; | |
573 Statement *body; | |
574 VarDeclaration *wthis; | |
575 | |
576 WithStatement(Loc loc, Expression *exp, Statement *body); | |
577 Statement *syntaxCopy(); | |
578 Statement *semantic(Scope *sc); | |
579 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
580 int usesEH(); | |
581 int fallOffEnd(); | |
582 | |
583 Statement *inlineScan(InlineScanState *iss); | |
584 | |
585 void toIR(IRState *irs); | |
586 }; | |
587 | |
588 struct TryCatchStatement : Statement | |
589 { | |
590 Statement *body; | |
591 Array *catches; | |
592 | |
593 TryCatchStatement(Loc loc, Statement *body, Array *catches); | |
594 Statement *syntaxCopy(); | |
595 Statement *semantic(Scope *sc); | |
596 int hasBreak(); | |
597 int usesEH(); | |
598 int fallOffEnd(); | |
599 | |
600 Statement *inlineScan(InlineScanState *iss); | |
601 | |
602 void toIR(IRState *irs); | |
603 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
604 TryCatchStatement *isTryCatchStatement() { return this; } | |
605 }; | |
606 | |
607 struct Catch : Object | |
608 { | |
609 Loc loc; | |
610 Type *type; | |
611 Identifier *ident; | |
612 VarDeclaration *var; | |
613 Statement *handler; | |
614 | |
615 Catch(Loc loc, Type *t, Identifier *id, Statement *handler); | |
616 Catch *syntaxCopy(); | |
617 void semantic(Scope *sc); | |
618 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
619 }; | |
620 | |
621 struct TryFinallyStatement : Statement | |
622 { | |
623 Statement *body; | |
624 Statement *finalbody; | |
625 | |
626 TryFinallyStatement(Loc loc, Statement *body, Statement *finalbody); | |
627 Statement *syntaxCopy(); | |
628 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
629 Statement *semantic(Scope *sc); | |
630 int hasBreak(); | |
631 int hasContinue(); | |
632 int usesEH(); | |
633 int fallOffEnd(); | |
634 | |
635 Statement *inlineScan(InlineScanState *iss); | |
636 | |
637 void toIR(IRState *irs); | |
638 }; | |
639 | |
640 struct OnScopeStatement : Statement | |
641 { | |
642 TOK tok; | |
643 Statement *statement; | |
644 | |
645 OnScopeStatement(Loc loc, TOK tok, Statement *statement); | |
646 Statement *syntaxCopy(); | |
647 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
648 Statement *semantic(Scope *sc); | |
649 int usesEH(); | |
650 void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); | |
651 | |
652 void toIR(IRState *irs); | |
653 }; | |
654 | |
655 struct ThrowStatement : Statement | |
656 { | |
657 Expression *exp; | |
658 | |
659 ThrowStatement(Loc loc, Expression *exp); | |
660 Statement *syntaxCopy(); | |
661 Statement *semantic(Scope *sc); | |
662 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
663 int fallOffEnd(); | |
664 | |
665 Statement *inlineScan(InlineScanState *iss); | |
666 | |
667 void toIR(IRState *irs); | |
668 }; | |
669 | |
670 struct VolatileStatement : Statement | |
671 { | |
672 Statement *statement; | |
673 | |
674 VolatileStatement(Loc loc, Statement *statement); | |
675 Statement *syntaxCopy(); | |
676 Statement *semantic(Scope *sc); | |
677 Statements *flatten(Scope *sc); | |
678 int fallOffEnd(); | |
679 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
680 | |
681 Statement *inlineScan(InlineScanState *iss); | |
682 | |
683 void toIR(IRState *irs); | |
684 }; | |
685 | |
686 struct GotoStatement : Statement | |
687 { | |
688 Identifier *ident; | |
689 LabelDsymbol *label; | |
690 TryFinallyStatement *tf; | |
691 | |
692 GotoStatement(Loc loc, Identifier *ident); | |
693 Statement *syntaxCopy(); | |
694 Statement *semantic(Scope *sc); | |
695 int fallOffEnd(); | |
696 Expression *interpret(InterState *istate); | |
697 | |
698 void toIR(IRState *irs); | |
699 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
700 GotoStatement *isGotoStatement() { return this; } | |
701 }; | |
702 | |
703 struct LabelStatement : Statement | |
704 { | |
705 Identifier *ident; | |
706 Statement *statement; | |
707 TryFinallyStatement *tf; | |
708 block *lblock; // back end | |
709 int isReturnLabel; | |
710 | |
711 LabelStatement(Loc loc, Identifier *ident, Statement *statement); | |
712 Statement *syntaxCopy(); | |
713 Statement *semantic(Scope *sc); | |
714 Statements *flatten(Scope *sc); | |
715 int usesEH(); | |
716 int fallOffEnd(); | |
717 int comeFrom(); | |
718 Expression *interpret(InterState *istate); | |
719 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
720 | |
721 Statement *inlineScan(InlineScanState *iss); | |
722 | |
86
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
723 void toIR(IRState *irs); |
fd32135dca3e
[svn r90] Major updates to the gen directory. Redesigned the 'elem' struct. Much more... !!!
lindquist
parents:
37
diff
changeset
|
724 |
37
77cdca8c210f
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
lindquist
parents:
1
diff
changeset
|
725 llvm::BasicBlock* llvmBB; |
1 | 726 }; |
727 | |
728 struct LabelDsymbol : Dsymbol | |
729 { | |
730 LabelStatement *statement; | |
731 #if IN_GCC | |
732 unsigned asmLabelNum; // GCC-specific | |
733 #endif | |
734 | |
735 LabelDsymbol(Identifier *ident); | |
736 LabelDsymbol *isLabel(); | |
737 }; | |
738 | |
739 struct AsmStatement : Statement | |
740 { | |
741 Token *tokens; | |
742 code *asmcode; | |
743 unsigned asmalign; // alignment of this statement | |
744 unsigned refparam; // !=0 if function parameter is referenced | |
745 unsigned naked; // !=0 if function is to be naked | |
746 unsigned regs; // mask of registers modified | |
747 | |
748 AsmStatement(Loc loc, Token *tokens); | |
749 Statement *syntaxCopy(); | |
750 Statement *semantic(Scope *sc); | |
751 int comeFrom(); | |
752 | |
753 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
754 virtual AsmStatement *isAsmStatement() { return this; } | |
755 | |
756 void toIR(IRState *irs); | |
757 }; | |
758 | |
759 #endif /* DMD_STATEMENT_H */ |