tint: Use ProgramBuilder::CallStmt()

Change-Id: I963d1c859b5bbb8d86f67194e7c0963dfc0e5b29
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118985
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2023-02-07 21:28:09 +00:00
parent 1ebada0dad
commit d775a26d82
4 changed files with 10 additions and 16 deletions

View File

@ -2058,9 +2058,7 @@ TEST_F(InspectorGetUniformBufferResourceBindingsTest, MultipleUniformBuffers) {
AddReferenceFunc("ub_bar_func", "ub_bar"); AddReferenceFunc("ub_bar_func", "ub_bar");
AddReferenceFunc("ub_baz_func", "ub_baz"); AddReferenceFunc("ub_baz_func", "ub_baz");
auto FuncCall = [&](const std::string& callee) { auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
return create<ast::CallStatement>(Call(callee));
};
Func("ep_func", utils::Empty, ty.void_(), Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{ utils::Vector{
@ -2239,9 +2237,7 @@ TEST_F(InspectorGetStorageBufferResourceBindingsTest, MultipleStorageBuffers) {
AddReferenceFunc("sb_bar_func", "sb_bar"); AddReferenceFunc("sb_bar_func", "sb_bar");
AddReferenceFunc("sb_baz_func", "sb_baz"); AddReferenceFunc("sb_baz_func", "sb_baz");
auto FuncCall = [&](const std::string& callee) { auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
return create<ast::CallStatement>(Call(callee));
};
Func("ep_func", utils::Empty, ty.void_(), Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{ utils::Vector{
@ -2464,9 +2460,7 @@ TEST_F(InspectorGetReadOnlyStorageBufferResourceBindingsTest, MultipleStorageBuf
AddReferenceFunc("sb_bar_func", "sb_bar"); AddReferenceFunc("sb_bar_func", "sb_bar");
AddReferenceFunc("sb_baz_func", "sb_baz"); AddReferenceFunc("sb_baz_func", "sb_baz");
auto FuncCall = [&](const std::string& callee) { auto FuncCall = [&](const std::string& callee) { return CallStmt(Call(callee)); };
return create<ast::CallStatement>(Call(callee));
};
Func("ep_func", utils::Empty, ty.void_(), Func("ep_func", utils::Empty, ty.void_(),
utils::Vector{ utils::Vector{

View File

@ -5212,7 +5212,7 @@ bool FunctionEmitter::EmitFunctionCall(const spvtools::opt::Instruction& inst) {
} }
if (result_type->Is<Void>()) { if (result_type->Is<Void>()) {
return nullptr != AddStatement(create<ast::CallStatement>(Source{}, call_expr)); return nullptr != AddStatement(builder_.CallStmt(Source{}, call_expr));
} }
return EmitConstDefOrWriteToHoistedVar(inst, {result_type, call_expr}); return EmitConstDefOrWriteToHoistedVar(inst, {result_type, call_expr});
@ -5246,14 +5246,14 @@ bool FunctionEmitter::EmitControlBarrier(const spvtools::opt::Instruction& inst)
if (memory != uint32_t(spv::Scope::Workgroup)) { if (memory != uint32_t(spv::Scope::Workgroup)) {
return Fail() << "workgroupBarrier requires workgroup memory scope"; return Fail() << "workgroupBarrier requires workgroup memory scope";
} }
AddStatement(create<ast::CallStatement>(builder_.Call("workgroupBarrier"))); AddStatement(builder_.CallStmt(builder_.Call("workgroupBarrier")));
semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::WorkgroupMemory); semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::WorkgroupMemory);
} }
if (semantics & uint32_t(spv::MemorySemanticsMask::UniformMemory)) { if (semantics & uint32_t(spv::MemorySemanticsMask::UniformMemory)) {
if (memory != uint32_t(spv::Scope::Device)) { if (memory != uint32_t(spv::Scope::Device)) {
return Fail() << "storageBarrier requires device memory scope"; return Fail() << "storageBarrier requires device memory scope";
} }
AddStatement(create<ast::CallStatement>(builder_.Call("storageBarrier"))); AddStatement(builder_.CallStmt(builder_.Call("storageBarrier")));
semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::UniformMemory); semantics &= ~static_cast<uint32_t>(spv::MemorySemanticsMask::UniformMemory);
} }
if (semantics) { if (semantics) {
@ -5675,7 +5675,7 @@ bool FunctionEmitter::EmitImageAccess(const spvtools::opt::Instruction& inst) {
} else { } else {
// It's an image write. No value is returned, so make a statement out // It's an image write. No value is returned, so make a statement out
// of the call. // of the call.
AddStatement(create<ast::CallStatement>(Source{}, call_expr)); AddStatement(builder_.CallStmt(Source{}, call_expr));
} }
return success(); return success();
} }
@ -5803,7 +5803,7 @@ bool FunctionEmitter::EmitAtomicOp(const spvtools::opt::Instruction& inst) {
TypedExpression expr{result_type, call}; TypedExpression expr{result_type, call};
return EmitConstDefOrWriteToHoistedVar(inst, expr); return EmitConstDefOrWriteToHoistedVar(inst, expr);
} }
AddStatement(create<ast::CallStatement>(call)); AddStatement(builder_.CallStmt(call));
return true; return true;
}; };

View File

@ -2434,7 +2434,7 @@ Maybe<const ast::CallStatement*> ParserImpl::func_call_statement() {
return Failure::kErrored; return Failure::kErrored;
} }
return create<ast::CallStatement>( return builder_.CallStmt(
t.source(), t.source(),
create<ast::CallExpression>( create<ast::CallExpression>(
t.source(), t.source(),

View File

@ -218,7 +218,7 @@ TEST_P(SideEffectsBuiltinTest, Test) {
attrs.Push(WorkgroupSize(Expr(1_u))); attrs.Push(WorkgroupSize(Expr(1_u)));
} }
stmts.Push(create<ast::CallStatement>(expr)); stmts.Push(CallStmt(expr));
Func("func", utils::Empty, ty.void_(), stmts, attrs); Func("func", utils::Empty, ty.void_(), stmts, attrs);