Intel SPMD Program Compiler  1.12.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ForStmt Class Reference

Statement implementation for 'for' loops (as well as for 'while' loops). More...

#include <stmt.h>

Inheritance diagram for ForStmt:
Inheritance graph
[legend]
Collaboration diagram for ForStmt:
Collaboration graph
[legend]

Public Member Functions

 ForStmt (Stmt *initializer, Expr *testExpr, Stmt *stepStatements, Stmt *bodyStatements, bool doCoherentCheck, SourcePos pos)
 
void EmitCode (FunctionEmitContext *ctx) const
 
void Print (int indent) const
 
StmtTypeCheck ()
 
int EstimateCost () const
 
- Public Member Functions inherited from Stmt
 Stmt (SourcePos p, unsigned scid)
 
virtual StmtOptimize ()
 
- Public Member Functions inherited from ASTNode
 ASTNode (SourcePos p, unsigned scid)
 
virtual ~ASTNode ()
 
unsigned getValueID () const
 

Static Public Member Functions

static bool classof (ForStmt const *)
 
static bool classof (ASTNode const *N)
 
- Static Public Member Functions inherited from Stmt
static bool classof (Stmt const *)
 
static bool classof (ASTNode const *N)
 
- Static Public Member Functions inherited from ASTNode
static bool classof (ASTNode const *)
 

Public Attributes

Stmtinit
 
Exprtest
 
Stmtstep
 
Stmtstmts
 
const bool doCoherentCheck
 
- Public Attributes inherited from ASTNode
SourcePos pos
 

Additional Inherited Members

- Public Types inherited from ASTNode
enum  ASTNodeTy {
  AddressOfExprID, AssignExprID, BinaryExprID, ConstExprID,
  DerefExprID, PtrDerefExprID, RefDerefExprID, ExprListID,
  FunctionCallExprID, FunctionSymbolExprID, IndexExprID, StructMemberExprID,
  VectorMemberExprID, NewExprID, NullPointerExprID, ReferenceExprID,
  SelectExprID, SizeOfExprID, SymbolExprID, SyncExprID,
  TypeCastExprID, UnaryExprID, MaxExprID, AssertStmtID,
  BreakStmtID, CaseStmtID, ContinueStmtID, DeclStmtID,
  DefaultStmtID, DeleteStmtID, DoStmtID, ExprStmtID,
  ForeachActiveStmtID, ForeachStmtID, ForeachUniqueStmtID, ForStmtID,
  GotoStmtID, IfStmtID, LabeledStmtID, PrintStmtID,
  ReturnStmtID, StmtListID, SwitchStmtID, UnmaskedStmtID
}
 

Detailed Description

Statement implementation for 'for' loops (as well as for 'while' loops).

Definition at line 180 of file stmt.h.

Constructor & Destructor Documentation

◆ ForStmt()

ForStmt::ForStmt ( Stmt initializer,
Expr testExpr,
Stmt stepStatements,
Stmt bodyStatements,
bool  doCoherentCheck,
SourcePos  pos 
)

Definition at line 1117 of file stmt.cpp.

Member Function Documentation

◆ classof() [1/2]

static bool ForStmt::classof ( ForStmt const *  )
inlinestatic

Definition at line 185 of file stmt.h.

◆ classof() [2/2]

static bool ForStmt::classof ( ASTNode const *  N)
inlinestatic

◆ EmitCode()

void ForStmt::EmitCode ( FunctionEmitContext ctx) const
virtual

◆ EstimateCost()

int ForStmt::EstimateCost ( ) const
virtual

Estimate the execution cost of the node (not including the cost of the children. The value returned should be based on the COST_* enumerant values defined in ispc.h.

Implements ASTNode.

Definition at line 1266 of file stmt.cpp.

References COST_UNIFORM_LOOP, COST_VARYING_LOOP, Opt::disableUniformControlFlow, g, Expr::GetType(), Type::IsUniformType(), lHasVaryingBreakOrContinue(), Globals::opt, stmts, and test.

◆ Print()

void ForStmt::Print ( int  indent) const
virtual

Print a representation of the statement (and any children AST nodes) to standard output. This method is used for debuggins.

Implements Stmt.

Definition at line 1273 of file stmt.cpp.

References init, ASTNode::pos, Stmt::Print(), Expr::Print(), SourcePos::Print(), step, stmts, and test.

◆ TypeCheck()

Stmt * ForStmt::TypeCheck ( )
virtual

Type checking should be performed by the node when this method is called. In the event of an error, a NULL value may be returned. As with ASTNode::Optimize(), the caller should store the returned pointer in place of the original ASTNode *.

Implements Stmt.

Definition at line 1250 of file stmt.cpp.

References Opt::disableUniformControlFlow, g, Expr::GetType(), Type::IsUniformType(), lHasVaryingBreakOrContinue(), Globals::opt, stmts, test, TypeConvertExpr(), AtomicType::UniformBool, and AtomicType::VaryingBool.

Member Data Documentation

◆ doCoherentCheck

const bool ForStmt::doCoherentCheck

Definition at line 204 of file stmt.h.

Referenced by EmitCode().

◆ init

Stmt* ForStmt::init

'for' statment initializer; may be NULL, indicating no intitializer

Definition at line 195 of file stmt.h.

Referenced by EmitCode(), Print(), and WalkAST().

◆ step

Stmt* ForStmt::step

Statements to run at the end of the loop for the loop step, before the test expression is evaluated.

Definition at line 201 of file stmt.h.

Referenced by EmitCode(), Print(), and WalkAST().

◆ stmts

Stmt* ForStmt::stmts

Loop body statements

Definition at line 203 of file stmt.h.

Referenced by EmitCode(), EstimateCost(), Print(), TypeCheck(), and WalkAST().

◆ test

Expr* ForStmt::test

expression that returns a value indicating whether the loop should continue for the next iteration

Definition at line 198 of file stmt.h.

Referenced by EmitCode(), EstimateCost(), Print(), TypeCheck(), and WalkAST().


The documentation for this class was generated from the following files: