Add unmasked { } statement.

This reestablishes an "all on" execution mask for the gang, which can
be useful for nested parallelism..
This commit is contained in:
Matt Pharr
2012-06-22 14:30:58 -07:00
parent b4a078e2f6
commit 54459255d4
10 changed files with 282 additions and 30 deletions

View File

@@ -2624,6 +2624,60 @@ SwitchStmt::EstimateCost() const {
}
///////////////////////////////////////////////////////////////////////////
// UnmaskedStmt
UnmaskedStmt::UnmaskedStmt(Stmt *s, SourcePos pos)
: Stmt(pos) {
stmts = s;
}
void
UnmaskedStmt::EmitCode(FunctionEmitContext *ctx) const {
if (!ctx->GetCurrentBasicBlock() || !stmts)
return;
llvm::Value *oldInternalMask = ctx->GetInternalMask();
llvm::Value *oldFunctionMask = ctx->GetFunctionMask();
ctx->SetInternalMask(LLVMMaskAllOn);
ctx->SetFunctionMask(LLVMMaskAllOn);
stmts->EmitCode(ctx);
ctx->SetInternalMask(oldInternalMask);
ctx->SetFunctionMask(oldFunctionMask);
}
void
UnmaskedStmt::Print(int indent) const {
printf("%*cUnmasked Stmt", indent, ' ');
pos.Print();
printf("\n");
printf("%*cStmts:\n", indent+4, ' ');
if (stmts != NULL)
stmts->Print(indent+8);
else
printf("NULL");
printf("\n");
}
Stmt *
UnmaskedStmt::TypeCheck() {
return this;
}
int
UnmaskedStmt::EstimateCost() const {
return COST_ASSIGN;
}
///////////////////////////////////////////////////////////////////////////
// ReturnStmt