Add foreach and foreach_tiled looping constructs
These make it easier to iterate over arbitrary amounts of data elements; specifically, they automatically handle the "ragged extra bits" that come up when the number of elements to be processed isn't evenly divided by programCount. TODO: documentation
This commit is contained in:
25
stmt.h
25
stmt.h
@@ -241,6 +241,31 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/** @brief Statement implementation for parallel 'foreach' loops.
|
||||
*/
|
||||
class ForeachStmt : public Stmt {
|
||||
public:
|
||||
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;
|
||||
|
||||
Stmt *Optimize();
|
||||
Stmt *TypeCheck();
|
||||
int EstimateCost() const;
|
||||
|
||||
std::vector<Symbol *> dimVariables;
|
||||
std::vector<Expr *> startExprs;
|
||||
std::vector<Expr *> endExprs;
|
||||
bool isTiled;
|
||||
Stmt *stmts;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @brief Statement implementation for a 'return' or 'coherent' return
|
||||
statement in the program. */
|
||||
class ReturnStmt : public Stmt {
|
||||
|
||||
Reference in New Issue
Block a user