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

Statement implementation for parallel 'foreach' loops. More...

#include <stmt.h>

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

Public Member Functions

 ForeachStmt (const std::vector< Symbol * > &loopVars, const std::vector< Expr * > &startExprs, const std::vector< Expr * > &endExprs, Stmt *bodyStatements, bool tiled, 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 (ForeachStmt 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

std::vector< Symbol * > dimVariables
 
std::vector< Expr * > startExprs
 
std::vector< Expr * > endExprs
 
bool isTiled
 
Stmtstmts
 
- 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 parallel 'foreach' loops.

Definition at line 268 of file stmt.h.

Constructor & Destructor Documentation

ForeachStmt::ForeachStmt ( const std::vector< Symbol * > &  loopVars,
const std::vector< Expr * > &  startExprs,
const std::vector< Expr * > &  endExprs,
Stmt bodyStatements,
bool  tiled,
SourcePos  pos 
)

Definition at line 1465 of file stmt.cpp.

Member Function Documentation

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

Definition at line 275 of file stmt.h.

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

Definition at line 276 of file stmt.h.

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

void ForeachStmt::EmitCode ( FunctionEmitContext ctx) const
virtual

Emit LLVM IR for the statement, using the FunctionEmitContext to create the necessary instructions.

Implements Stmt.

Definition at line 1666 of file stmt.cpp.

References FunctionEmitContext::AddInstrumentationPoint(), FunctionEmitContext::AllocaInst(), AssertPos, FunctionEmitContext::BinaryOperator(), LLVMTypes::BoolType, FunctionEmitContext::BranchInst(), FunctionEmitContext::BroadcastValue(), FunctionEmitContext::CmpInst(), FunctionEmitContext::CreateBasicBlock(), dimVariables, FunctionEmitContext::DisableGatherScatterWarnings(), Stmt::EmitCode(), FunctionEmitContext::EmitVariableDebugInfo(), FunctionEmitContext::EnableGatherScatterWarnings(), endExprs, FunctionEmitContext::EndForeach(), FunctionEmitContext::EndScope(), FunctionEmitContext::FOREACH_REGULAR, g, FunctionEmitContext::GetCurrentBasicBlock(), FunctionEmitContext::GetFullMask(), FunctionEmitContext::GetFunction(), FunctionEmitContext::GetFunctionMask(), FunctionEmitContext::GetInternalMask(), Target::getISA(), Target::getVectorWidth(), FunctionEmitContext::I1VecToBoolVec(), LLVMTypes::Int32Type, LLVMTypes::Int32VectorType, isTiled, lGetSpans(), LLVMFalse, LLVMInt32(), LLVMMaskAllOff, LLVMMaskAllOn, LLVMTrue, FunctionEmitContext::LoadInst(), lUpdateVaryingCounter(), LLVMTypes::MaskType, ASTNode::pos, FunctionEmitContext::RestoreContinuedLanes(), FunctionEmitContext::SetBlockEntryMask(), FunctionEmitContext::SetContinueTarget(), FunctionEmitContext::SetCurrentBasicBlock(), FunctionEmitContext::SetDebugPos(), FunctionEmitContext::SetFunctionMask(), FunctionEmitContext::SetInternalMask(), startExprs, FunctionEmitContext::StartForeach(), FunctionEmitContext::StartScope(), stmts, FunctionEmitContext::StoreInst(), and Globals::target.

int ForeachStmt::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 2179 of file stmt.cpp.

References COST_SIMPLE_ARITH_LOGIC_OP, COST_UNIFORM_LOOP, and dimVariables.

void ForeachStmt::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 2185 of file stmt.cpp.

References dimVariables, endExprs, ASTNode::pos, Stmt::Print(), SourcePos::Print(), startExprs, and stmts.

Stmt * ForeachStmt::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 2136 of file stmt.cpp.

References dimVariables, endExprs, Error(), ASTNode::pos, startExprs, TypeConvertExpr(), and AtomicType::UniformInt32.

Member Data Documentation

std::vector<Symbol *> ForeachStmt::dimVariables

Definition at line 286 of file stmt.h.

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

std::vector<Expr *> ForeachStmt::endExprs

Definition at line 288 of file stmt.h.

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

bool ForeachStmt::isTiled

Definition at line 289 of file stmt.h.

Referenced by EmitCode().

std::vector<Expr *> ForeachStmt::startExprs

Definition at line 287 of file stmt.h.

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

Stmt* ForeachStmt::stmts

Definition at line 290 of file stmt.h.

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


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