Intel SPMD Program Compiler  1.12.0
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
Collaboration diagram for ForeachStmt:
Collaboration graph

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

Constructor & Destructor Documentation

◆ ForeachStmt()

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

Member Function Documentation

◆ classof() [1/2]

static bool ForeachStmt::classof ( ForeachStmt const *  )

Definition at line 246 of file stmt.h.

◆ classof() [2/2]

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

◆ EmitCode()

void ForeachStmt::EmitCode ( FunctionEmitContext ctx) const

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

Implements Stmt.

Definition at line 1524 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.

◆ EstimateCost()

int ForeachStmt::EstimateCost ( ) const

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


◆ Print()

void ForeachStmt::Print ( int  indent) const

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

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

◆ TypeCheck()

Stmt * ForeachStmt::TypeCheck ( )

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

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

Member Data Documentation

◆ dimVariables

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

Definition at line 255 of file stmt.h.

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

◆ endExprs

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

Definition at line 257 of file stmt.h.

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

◆ isTiled

bool ForeachStmt::isTiled

Definition at line 258 of file stmt.h.

Referenced by EmitCode().

◆ startExprs

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

Definition at line 256 of file stmt.h.

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

◆ stmts

Stmt* ForeachStmt::stmts

Definition at line 259 of file stmt.h.

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

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