Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
stmt.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2010-2019, Intel Corporation
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
12  * Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16  * Neither the name of Intel Corporation nor the names of its
17  contributors may be used to endorse or promote products derived from
18  this software without specific prior written permission.
19 
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
24  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 /** @file stmt.h
35  @brief File with declarations for classes related to statements in the language
36 */
37 
38 #pragma once
39 
40 #include "ast.h"
41 #include "ispc.h"
42 
43 /** @brief Interface class for statements in the ispc language.
44 
45  This abstract base-class encapsulates methods that AST nodes for
46  statements in the language must implement.
47  */
48 class Stmt : public ASTNode {
49  public:
50  Stmt(SourcePos p, unsigned scid) : ASTNode(p, scid) {}
51 
52  static inline bool classof(Stmt const *) { return true; }
53  static inline bool classof(ASTNode const *N) { return N->getValueID() > MaxExprID; }
54 
55  /** Emit LLVM IR for the statement, using the FunctionEmitContext to create the
56  necessary instructions.
57  */
58  virtual void EmitCode(FunctionEmitContext *ctx) const = 0;
59 
60  /** Print a representation of the statement (and any children AST
61  nodes) to standard output. This method is used for debuggins. */
62  virtual void Print(int indent) const = 0;
63 
64  // Redeclare these methods with Stmt * return values, rather than
65  // ASTNode *s, as in the original ASTNode declarations of them. We'll
66  // also provide a default implementation of Optimize(), since most
67  // Stmts don't have anything to do here.
68  virtual Stmt *Optimize();
69  virtual Stmt *TypeCheck() = 0;
70 };
71 
72 /** @brief Statement representing a single expression */
73 class ExprStmt : public Stmt {
74  public:
75  ExprStmt(Expr *expr, SourcePos pos);
76 
77  static inline bool classof(ExprStmt const *) { return true; }
78  static inline bool classof(ASTNode const *N) { return N->getValueID() == ExprStmtID; }
79 
80  void EmitCode(FunctionEmitContext *ctx) const;
81  void Print(int indent) const;
82 
83  Stmt *TypeCheck();
84  int EstimateCost() const;
85 
87 };
88 
90  VariableDeclaration(Symbol *s = NULL, Expr *i = NULL) {
91  sym = s;
92  init = i;
93  }
96 };
97 
98 /** @brief Statement representing a single declaration (which in turn may declare
99  a number of variables. */
100 class DeclStmt : public Stmt {
101  public:
102  DeclStmt(const std::vector<VariableDeclaration> &v, SourcePos pos);
103 
104  static inline bool classof(DeclStmt const *) { return true; }
105  static inline bool classof(ASTNode const *N) { return N->getValueID() == DeclStmtID; }
106 
107  void EmitCode(FunctionEmitContext *ctx) const;
108  void Print(int indent) const;
109 
110  Stmt *Optimize();
111  Stmt *TypeCheck();
112  int EstimateCost() const;
113 
114  std::vector<VariableDeclaration> vars;
115 };
116 
117 /** @brief Statement representing a single if statement, possibly with an
118  else clause. */
119 class IfStmt : public Stmt {
120  public:
121  IfStmt(Expr *testExpr, Stmt *trueStmts, Stmt *falseStmts, bool doAllCheck, SourcePos pos);
122 
123  static inline bool classof(IfStmt const *) { return true; }
124  static inline bool classof(ASTNode const *N) { return N->getValueID() == IfStmtID; }
125 
126  void EmitCode(FunctionEmitContext *ctx) const;
127  void Print(int indent) const;
128 
129  Stmt *TypeCheck();
130  int EstimateCost() const;
131 
132  // @todo these are only public for lHasVaryingBreakOrContinue(); would
133  // be nice to clean that up...
134  /** Expression giving the 'if' test. */
136  /** Statements to run if the 'if' test returns a true value */
138  /** Statements to run if the 'if' test returns a false value */
140 
141  private:
142  /** This value records if this was a 'coherent' if statement in the
143  source and thus, if the emitted code should check to see if all
144  active program instances want to follow just one of the 'true' or
145  'false' blocks. */
146  const bool doAllCheck;
147 
148  void emitMaskedTrueAndFalse(FunctionEmitContext *ctx, llvm::Value *oldMask, llvm::Value *test) const;
149  void emitVaryingIf(FunctionEmitContext *ctx, llvm::Value *test) const;
150  void emitMaskAllOn(FunctionEmitContext *ctx, llvm::Value *test, llvm::BasicBlock *bDone) const;
151  void emitMaskMixed(FunctionEmitContext *ctx, llvm::Value *oldMask, llvm::Value *test,
152  llvm::BasicBlock *bDone) const;
153 };
154 
155 /** @brief Statement implementation representing a 'do' statement in the
156  program.
157  */
158 class DoStmt : public Stmt {
159  public:
160  DoStmt(Expr *testExpr, Stmt *bodyStmts, bool doCoherentCheck, SourcePos pos);
161 
162  static inline bool classof(DoStmt const *) { return true; }
163  static inline bool classof(ASTNode const *N) { return N->getValueID() == DoStmtID; }
164 
165  void EmitCode(FunctionEmitContext *ctx) const;
166  void Print(int indent) const;
167 
168  Stmt *TypeCheck();
169  int EstimateCost() const;
170 
173  const bool doCoherentCheck;
174 };
175 
176 /** @brief Statement implementation for 'for' loops (as well as for 'while'
177  loops).
178  */
179 class ForStmt : public Stmt {
180  public:
181  ForStmt(Stmt *initializer, Expr *testExpr, Stmt *stepStatements, Stmt *bodyStatements, bool doCoherentCheck,
182  SourcePos pos);
183 
184  static inline bool classof(ForStmt const *) { return true; }
185  static inline bool classof(ASTNode const *N) { return N->getValueID() == ForStmtID; }
186 
187  void EmitCode(FunctionEmitContext *ctx) const;
188  void Print(int indent) const;
189 
190  Stmt *TypeCheck();
191  int EstimateCost() const;
192 
193  /** 'for' statment initializer; may be NULL, indicating no intitializer */
195  /** expression that returns a value indicating whether the loop should
196  continue for the next iteration */
198  /** Statements to run at the end of the loop for the loop step, before
199  the test expression is evaluated. */
201  /** Loop body statements */
203  const bool doCoherentCheck;
204 };
205 
206 /** @brief Statement implementation for a break statement in the
207  program. */
208 class BreakStmt : public Stmt {
209  public:
211 
212  static inline bool classof(BreakStmt const *) { return true; }
213  static inline bool classof(ASTNode const *N) { return N->getValueID() == BreakStmtID; }
214 
215  void EmitCode(FunctionEmitContext *ctx) const;
216  void Print(int indent) const;
217 
218  Stmt *TypeCheck();
219  int EstimateCost() const;
220 };
221 
222 /** @brief Statement implementation for a continue statement in the
223  program. */
224 class ContinueStmt : public Stmt {
225  public:
227 
228  static inline bool classof(ContinueStmt const *) { return true; }
229  static inline bool classof(ASTNode const *N) { return N->getValueID() == ContinueStmtID; }
230 
231  void EmitCode(FunctionEmitContext *ctx) const;
232  void Print(int indent) const;
233 
234  Stmt *TypeCheck();
235  int EstimateCost() const;
236 };
237 
238 /** @brief Statement implementation for parallel 'foreach' loops.
239  */
240 class ForeachStmt : public Stmt {
241  public:
242  ForeachStmt(const std::vector<Symbol *> &loopVars, const std::vector<Expr *> &startExprs,
243  const std::vector<Expr *> &endExprs, Stmt *bodyStatements, bool tiled, SourcePos pos);
244 
245  static inline bool classof(ForeachStmt const *) { return true; }
246  static inline bool classof(ASTNode const *N) { return N->getValueID() == ForeachStmtID; }
247 
248  void EmitCode(FunctionEmitContext *ctx) const;
249  void Print(int indent) const;
250 
251  Stmt *TypeCheck();
252  int EstimateCost() const;
253 
254  std::vector<Symbol *> dimVariables;
255  std::vector<Expr *> startExprs;
256  std::vector<Expr *> endExprs;
257  bool isTiled;
259 };
260 
261 /** Iteration over each executing program instance.
262  */
263 class ForeachActiveStmt : public Stmt {
264  public:
265  ForeachActiveStmt(Symbol *iterSym, Stmt *stmts, SourcePos pos);
266 
267  static inline bool classof(ForeachActiveStmt const *) { return true; }
268  static inline bool classof(ASTNode const *N) { return N->getValueID() == ForeachActiveStmtID; }
269 
270  void EmitCode(FunctionEmitContext *ctx) const;
271  void Print(int indent) const;
272 
273  Stmt *TypeCheck();
274  int EstimateCost() const;
275 
278 };
279 
280 /** Parallel iteration over each unique value in the given (varying)
281  expression.
282  */
283 class ForeachUniqueStmt : public Stmt {
284  public:
285  ForeachUniqueStmt(const char *iterName, Expr *expr, Stmt *stmts, SourcePos pos);
286 
287  static inline bool classof(ForeachUniqueStmt const *) { return true; }
288  static inline bool classof(ASTNode const *N) { return N->getValueID() == ForeachUniqueStmtID; }
289 
290  void EmitCode(FunctionEmitContext *ctx) const;
291  void Print(int indent) const;
292 
293  Stmt *TypeCheck();
294  int EstimateCost() const;
295 
299 };
300 
301 /**
302  */
303 class UnmaskedStmt : public Stmt {
304  public:
305  UnmaskedStmt(Stmt *stmt, SourcePos pos);
306 
307  static inline bool classof(UnmaskedStmt const *) { return true; }
308  static inline bool classof(ASTNode const *N) { return N->getValueID() == UnmaskedStmtID; }
309 
310  void EmitCode(FunctionEmitContext *ctx) const;
311  void Print(int indent) const;
312 
313  Stmt *TypeCheck();
314  int EstimateCost() const;
315 
317 };
318 
319 /** @brief Statement implementation for a 'return' statement in the
320  program. */
321 class ReturnStmt : public Stmt {
322  public:
323  ReturnStmt(Expr *e, SourcePos p);
324 
325  static inline bool classof(ReturnStmt const *) { return true; }
326  static inline bool classof(ASTNode const *N) { return N->getValueID() == ReturnStmtID; }
327 
328  void EmitCode(FunctionEmitContext *ctx) const;
329  void Print(int indent) const;
330 
331  Stmt *TypeCheck();
332  int EstimateCost() const;
333 
335 };
336 
337 /** Statement corresponding to a "case" label in the program. In addition
338  to the value associated with the "case", this statement also stores the
339  statements following it. */
340 class CaseStmt : public Stmt {
341  public:
342  CaseStmt(int value, Stmt *stmt, SourcePos pos);
343 
344  static inline bool classof(CaseStmt const *) { return true; }
345  static inline bool classof(ASTNode const *N) { return N->getValueID() == CaseStmtID; }
346 
347  void EmitCode(FunctionEmitContext *ctx) const;
348  void Print(int indent) const;
349 
350  Stmt *TypeCheck();
351  int EstimateCost() const;
352 
353  /** Integer value after the "case" statement */
354  const int value;
356 };
357 
358 /** Statement for a "default" label (as would be found inside a "switch"
359  statement). */
360 class DefaultStmt : public Stmt {
361  public:
362  DefaultStmt(Stmt *stmt, SourcePos pos);
363 
364  static inline bool classof(DefaultStmt const *) { return true; }
365  static inline bool classof(ASTNode const *N) { return N->getValueID() == DefaultStmtID; }
366 
367  void EmitCode(FunctionEmitContext *ctx) const;
368  void Print(int indent) const;
369 
370  Stmt *TypeCheck();
371  int EstimateCost() const;
372 
374 };
375 
376 /** A "switch" statement in the program. */
377 class SwitchStmt : public Stmt {
378  public:
379  SwitchStmt(Expr *expr, Stmt *stmts, SourcePos pos);
380 
381  static inline bool classof(SwitchStmt const *) { return true; }
382  static inline bool classof(ASTNode const *N) { return N->getValueID() == SwitchStmtID; }
383 
384  void EmitCode(FunctionEmitContext *ctx) const;
385  void Print(int indent) const;
386 
387  Stmt *TypeCheck();
388  int EstimateCost() const;
389 
390  /** Expression that is used to determine which label to jump to. */
392  /** Statement block after the "switch" expression. */
394 };
395 
396 /** A "goto" in an ispc program. */
397 class GotoStmt : public Stmt {
398  public:
399  GotoStmt(const char *label, SourcePos gotoPos, SourcePos idPos);
400 
401  static inline bool classof(GotoStmt const *) { return true; }
402  static inline bool classof(ASTNode const *N) { return N->getValueID() == GotoStmtID; }
403 
404  void EmitCode(FunctionEmitContext *ctx) const;
405  void Print(int indent) const;
406 
407  Stmt *Optimize();
408  Stmt *TypeCheck();
409  int EstimateCost() const;
410 
411  /** Name of the label to jump to when the goto is executed. */
412  std::string label;
414 };
415 
416 /** Statement corresponding to a label (as would be used as a goto target)
417  in the program. */
418 class LabeledStmt : public Stmt {
419  public:
420  LabeledStmt(const char *label, Stmt *stmt, SourcePos p);
421 
422  static inline bool classof(LabeledStmt const *) { return true; }
423  static inline bool classof(ASTNode const *N) { return N->getValueID() == LabeledStmtID; }
424 
425  void EmitCode(FunctionEmitContext *ctx) const;
426  void Print(int indent) const;
427 
428  Stmt *Optimize();
429  Stmt *TypeCheck();
430  int EstimateCost() const;
431 
432  /** Name of the label. */
433  std::string name;
434  /** Statements following the label. */
436 };
437 
438 /** @brief Representation of a list of statements in the program.
439  */
440 class StmtList : public Stmt {
441  public:
443 
444  static inline bool classof(StmtList const *) { return true; }
445  static inline bool classof(ASTNode const *N) { return N->getValueID() == StmtListID; }
446 
447  void EmitCode(FunctionEmitContext *ctx) const;
448  void Print(int indent) const;
449 
450  Stmt *TypeCheck();
451  int EstimateCost() const;
452 
453  void Add(Stmt *s) {
454  if (s)
455  stmts.push_back(s);
456  }
457 
458  std::vector<Stmt *> stmts;
459 };
460 
461 /** @brief Representation of a print() statement in the program.
462 
463  It's currently necessary to have a special statement type for print()
464  since strings aren't supported as first-class types in the language,
465  but we need to be able to pass a formatting string as the first
466  argument to print(). We also need this to be a variable argument
467  function, which also isn't supported. Representing print() as a
468  statement lets us work around both of those ugly little issues...
469  */
470 class PrintStmt : public Stmt {
471  public:
472  PrintStmt(const std::string &f, Expr *v, SourcePos p);
473 
474  static inline bool classof(PrintStmt const *) { return true; }
475  static inline bool classof(ASTNode const *N) { return N->getValueID() == PrintStmtID; }
476 
477  void EmitCode(FunctionEmitContext *ctx) const;
478  void Print(int indent) const;
479 
480  Stmt *TypeCheck();
481  int EstimateCost() const;
482 
483  /** Format string for the print() statement. */
484  const std::string format;
485  /** This holds the arguments passed to the print() statement. If more
486  than one was provided, this will be an ExprList. */
488 };
489 
490 /** @brief Representation of an assert statement in the program.
491 
492  Like print() above, since we don't have strings as first-class types in
493  the language, we need to do some gymnastics to support it. Like
494  assert() in C, assert() checks the given condition and prints an error
495  and calls abort if the condition fails. For varying conditions, the
496  assert triggers if it's true for any of the program instances.
497 */
498 class AssertStmt : public Stmt {
499  public:
500  AssertStmt(const std::string &msg, Expr *e, SourcePos p);
501 
502  static inline bool classof(AssertStmt const *) { return true; }
503  static inline bool classof(ASTNode const *N) { return N->getValueID() == AssertStmtID; }
504 
505  void EmitCode(FunctionEmitContext *ctx) const;
506  void Print(int indent) const;
507 
508  Stmt *TypeCheck();
509  int EstimateCost() const;
510 
511  /** Message to print if the assertion fails. */
512  const std::string message;
513  /** The expression to be evaluated (that is asserted to be true). */
515 };
516 
517 /** Representation of a delete statement in the program.
518  */
519 class DeleteStmt : public Stmt {
520  public:
521  DeleteStmt(Expr *e, SourcePos p);
522 
523  static inline bool classof(DeleteStmt const *) { return true; }
524  static inline bool classof(ASTNode const *N) { return N->getValueID() == DeleteStmtID; }
525 
526  void EmitCode(FunctionEmitContext *ctx) const;
527  void Print(int indent) const;
528 
529  Stmt *TypeCheck();
530  int EstimateCost() const;
531 
532  /** Expression that gives the pointer value to be deleted. */
534 };
535 
536 extern Stmt *CreateForeachActiveStmt(Symbol *iterSym, Stmt *stmts, SourcePos pos);
static bool classof(ASTNode const *N)
Definition: stmt.h:423
static bool classof(LabeledStmt const *)
Definition: stmt.h:422
Expr * expr
Definition: stmt.h:514
virtual int EstimateCost() const =0
static bool classof(ASTNode const *N)
Definition: stmt.h:105
Stmt * bodyStmts
Definition: stmt.h:172
std::vector< VariableDeclaration > vars
Definition: stmt.h:114
static bool classof(ASTNode const *N)
Definition: stmt.h:246
Stmt(SourcePos p, unsigned scid)
Definition: stmt.h:50
Stmt * stmts
Definition: stmt.h:355
const bool doCoherentCheck
Definition: stmt.h:203
static bool classof(ASTNode const *N)
Definition: stmt.h:308
static bool classof(ForeachStmt const *)
Definition: stmt.h:245
Stmt * trueStmts
Definition: stmt.h:137
Expr * expr
Definition: stmt.h:334
std::vector< Expr * > endExprs
Definition: stmt.h:256
static bool classof(ASTNode const *N)
Definition: stmt.h:163
static bool classof(ASTNode const *N)
Definition: stmt.h:345
Representation of a print() statement in the program.
Definition: stmt.h:470
static bool classof(AssertStmt const *)
Definition: stmt.h:502
Interface class for statements in the ispc language.
Definition: stmt.h:48
Statement representing a single declaration (which in turn may declare a number of variables...
Definition: stmt.h:100
static bool classof(ASTNode const *N)
Definition: stmt.h:53
static bool classof(ContinueStmt const *)
Definition: stmt.h:228
const std::string message
Definition: stmt.h:512
Statement representing a single expression.
Definition: stmt.h:73
const std::string format
Definition: stmt.h:484
static bool classof(ForStmt const *)
Definition: stmt.h:184
Stmt * CreateForeachActiveStmt(Symbol *iterSym, Stmt *stmts, SourcePos pos)
Definition: stmt.h:397
static bool classof(ASTNode const *N)
Definition: stmt.h:365
static bool classof(ASTNode const *N)
Definition: stmt.h:382
static bool classof(ASTNode const *N)
Definition: stmt.h:445
static bool classof(ExprStmt const *)
Definition: stmt.h:77
Statement implementation for &#39;for&#39; loops (as well as for &#39;while&#39; loops).
Definition: stmt.h:179
static bool classof(ASTNode const *N)
Definition: stmt.h:475
static bool classof(ASTNode const *N)
Definition: stmt.h:124
Representation of an assert statement in the program.
Definition: stmt.h:498
static bool classof(ForeachUniqueStmt const *)
Definition: stmt.h:287
Statement implementation representing a &#39;do&#39; statement in the program.
Definition: stmt.h:158
static bool classof(ASTNode const *N)
Definition: stmt.h:503
StmtList(SourcePos p)
Definition: stmt.h:442
Symbol * sym
Definition: stmt.h:94
const int value
Definition: stmt.h:354
virtual void EmitCode(FunctionEmitContext *ctx) const =0
static bool classof(StmtList const *)
Definition: stmt.h:444
static bool classof(Stmt const *)
Definition: stmt.h:52
Symbol * sym
Definition: stmt.h:296
static bool classof(UnmaskedStmt const *)
Definition: stmt.h:307
Expr * test
Definition: stmt.h:135
static bool classof(ASTNode const *N)
Definition: stmt.h:524
Stmt * stmts
Definition: stmt.h:393
static bool classof(GotoStmt const *)
Definition: stmt.h:401
Statement implementation for a break statement in the program.
Definition: stmt.h:208
Stmt * stmts
Definition: stmt.h:373
Expr * expr
Definition: stmt.h:391
Statement implementation for a &#39;return&#39; statement in the program.
Definition: stmt.h:321
static bool classof(SwitchStmt const *)
Definition: stmt.h:381
Expr * init
Definition: stmt.h:95
Abstract base class for nodes in the abstract syntax tree (AST).
Definition: ast.h:49
static bool classof(BreakStmt const *)
Definition: stmt.h:212
static bool classof(DefaultStmt const *)
Definition: stmt.h:364
virtual Stmt * TypeCheck()=0
unsigned getValueID() const
Definition: ast.h:133
Stmt * stmts
Definition: stmt.h:298
Stmt * step
Definition: stmt.h:200
Statement implementation for a continue statement in the program.
Definition: stmt.h:224
bool isTiled
Definition: stmt.h:257
static bool classof(ASTNode const *N)
Definition: stmt.h:229
VariableDeclaration(Symbol *s=NULL, Expr *i=NULL)
Definition: stmt.h:90
static bool classof(CaseStmt const *)
Definition: stmt.h:344
Representation of a range of positions in a source file.
Definition: ispc.h:123
Stmt * stmts
Definition: stmt.h:277
Stmt * stmts
Definition: stmt.h:202
static bool classof(ASTNode const *N)
Definition: stmt.h:288
SourcePos pos
Definition: ast.h:76
static bool classof(ASTNode const *N)
Definition: stmt.h:78
const bool doCoherentCheck
Definition: stmt.h:173
Expr * values
Definition: stmt.h:487
Expr * testExpr
Definition: stmt.h:171
Stmt * falseStmts
Definition: stmt.h:139
static bool classof(ReturnStmt const *)
Definition: stmt.h:325
static bool classof(ASTNode const *N)
Definition: stmt.h:326
Expr * test
Definition: stmt.h:197
Stmt * init
Definition: stmt.h:194
Stmt * stmts
Definition: stmt.h:258
Definition: stmt.h:340
static bool classof(ASTNode const *N)
Definition: stmt.h:185
std::vector< Expr * > startExprs
Definition: stmt.h:255
static bool classof(DoStmt const *)
Definition: stmt.h:162
Symbol * sym
Definition: stmt.h:276
SourcePos identifierPos
Definition: stmt.h:413
Representation of a program symbol.
Definition: sym.h:62
Stmt * stmt
Definition: stmt.h:435
std::vector< Stmt * > stmts
Definition: stmt.h:458
Expr * expr
Definition: stmt.h:86
Statement implementation for parallel &#39;foreach&#39; loops.
Definition: stmt.h:240
Stmt * stmts
Definition: stmt.h:316
static bool classof(DeclStmt const *)
Definition: stmt.h:104
Statement representing a single if statement, possibly with an else clause.
Definition: stmt.h:119
Expr is the abstract base class that defines the interface that all expression types must implement...
Definition: expr.h:47
Expr * expr
Definition: stmt.h:533
virtual Stmt * Optimize()
Definition: stmt.cpp:64
std::vector< Symbol * > dimVariables
Definition: stmt.h:254
Representation of a list of statements in the program.
Definition: stmt.h:440
static bool classof(DeleteStmt const *)
Definition: stmt.h:523
std::string name
Definition: stmt.h:433
virtual void Print(int indent) const =0
Expr * expr
Definition: stmt.h:297
static bool classof(ASTNode const *N)
Definition: stmt.h:213
std::string label
Definition: stmt.h:412
static bool classof(PrintStmt const *)
Definition: stmt.h:474
static bool classof(ASTNode const *N)
Definition: stmt.h:268
static bool classof(ASTNode const *N)
Definition: stmt.h:402
static bool classof(ForeachActiveStmt const *)
Definition: stmt.h:267
Main ispc.header file. Defines Target, Globals and Opt classes.
static bool classof(IfStmt const *)
Definition: stmt.h:123
const bool doAllCheck
Definition: stmt.h:146
void Add(Stmt *s)
Definition: stmt.h:453