Distinguish between 'regular' foreach and foreach_unique in FunctionEmitContext
We need to do this since it's illegal to have nested foreach statements, but nested foreach_unique, or foreach_unique inside foreach, etc., are all fine.
This commit is contained in:
8
stmt.cpp
8
stmt.cpp
@@ -1458,7 +1458,7 @@ ForeachStmt::EmitCode(FunctionEmitContext *ctx) const {
|
||||
ctx->StoreInst(LLVMMaskAllOn, extrasMaskPtrs[i]);
|
||||
}
|
||||
|
||||
ctx->StartForeach();
|
||||
ctx->StartForeach(FunctionEmitContext::FOREACH_REGULAR);
|
||||
|
||||
// On to the outermost loop's test
|
||||
ctx->BranchInst(bbTest[0]);
|
||||
@@ -1970,10 +1970,8 @@ ForeachUniqueStmt::EmitCode(FunctionEmitContext *ctx) const {
|
||||
llvm::Value *movmsk = ctx->LaneMask(oldFullMask);
|
||||
ctx->StoreInst(movmsk, maskBitsPtr);
|
||||
|
||||
// Officially start the loop; as far as the FunctionEmitContext is
|
||||
// concerned, this can be handled the same way as a regular foreach
|
||||
// loop (continue allowed but not break and return, etc.)
|
||||
ctx->StartForeach();
|
||||
// Officially start the loop.
|
||||
ctx->StartForeach(FunctionEmitContext::FOREACH_UNIQUE);
|
||||
ctx->SetContinueTarget(bbCheckForMore);
|
||||
|
||||
// Evaluate the varying expression we're iterating over just once.
|
||||
|
||||
Reference in New Issue
Block a user