Add foreach_unique iteration construct.

Idea via Ingo Wald / IVL compiler.
This commit is contained in:
Matt Pharr
2012-06-20 10:03:44 -07:00
parent fae47e0dfc
commit 3bc66136b2
17 changed files with 488 additions and 6 deletions

19
stmt.h
View File

@@ -260,6 +260,25 @@ public:
};
/** Parallel iteration over each unique value in the given (varying)
expression.
*/
class ForeachUniqueStmt : public Stmt {
public:
ForeachUniqueStmt(const char *iterName, Expr *expr, Stmt *stmts,
SourcePos pos);
void EmitCode(FunctionEmitContext *ctx) const;
void Print(int indent) const;
Stmt *TypeCheck();
int EstimateCost() const;
Symbol *sym;
Expr *expr;
Stmt *stmts;
};
/** @brief Statement implementation for a 'return' or 'coherent' return
statement in the program. */