Intel SPMD Program Compiler  1.9.1
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 198 of file stmt.h.

Constructor & Destructor Documentation

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

Definition at line 1195 of file stmt.cpp.

Member Function Documentation

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

Definition at line 203 of file stmt.h.

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

Definition at line 204 of file stmt.h.

References ASTNode::ForStmtID, and ASTNode::getValueID().

void ForStmt::EmitCode ( FunctionEmitContext ctx) const
virtual
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 1353 of file stmt.cpp.

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

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 1363 of file stmt.cpp.

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

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 1333 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

const bool ForStmt::doCoherentCheck

Definition at line 224 of file stmt.h.

Referenced by EmitCode().

Stmt* ForStmt::init

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

Definition at line 215 of file stmt.h.

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

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 221 of file stmt.h.

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

Stmt* ForStmt::stmts

Loop body statements

Definition at line 223 of file stmt.h.

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

Expr* ForStmt::test

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

Definition at line 218 of file stmt.h.

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


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