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