mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-16 04:11:25 +00:00
tint: Use ProgramBuilder::Return()
Change-Id: I2de08d2d9274b0a849e44a5dafbeaf2a731318ce Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118984 Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
6adb65c488
commit
1ebada0dad
@ -1392,7 +1392,7 @@ bool FunctionEmitter::EmitEntryPointAsWrapper() {
|
|||||||
return_type = builder_.ty.Of(str);
|
return_type = builder_.ty.Of(str);
|
||||||
|
|
||||||
// Add the return-value statement.
|
// Add the return-value statement.
|
||||||
stmts.Push(create<ast::ReturnStatement>(
|
stmts.Push(builder_.Return(
|
||||||
source, builder_.Call(source, return_type, std::move(return_exprs))));
|
source, builder_.Call(source, return_type, std::move(return_exprs))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3124,14 +3124,14 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) {
|
|||||||
const auto& terminator = *(block_info.basic_block->terminator());
|
const auto& terminator = *(block_info.basic_block->terminator());
|
||||||
switch (opcode(terminator)) {
|
switch (opcode(terminator)) {
|
||||||
case spv::Op::OpReturn:
|
case spv::Op::OpReturn:
|
||||||
AddStatement(create<ast::ReturnStatement>(Source{}));
|
AddStatement(builder_.Return(Source{}));
|
||||||
return true;
|
return true;
|
||||||
case spv::Op::OpReturnValue: {
|
case spv::Op::OpReturnValue: {
|
||||||
auto value = MakeExpression(terminator.GetSingleWordInOperand(0));
|
auto value = MakeExpression(terminator.GetSingleWordInOperand(0));
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
AddStatement(create<ast::ReturnStatement>(Source{}, value.expr));
|
AddStatement(builder_.Return(Source{}, value.expr));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case spv::Op::OpKill:
|
case spv::Op::OpKill:
|
||||||
@ -3145,11 +3145,10 @@ bool FunctionEmitter::EmitNormalTerminator(const BlockInfo& block_info) {
|
|||||||
{
|
{
|
||||||
const auto* result_type = type_mgr_->GetType(function_.type_id());
|
const auto* result_type = type_mgr_->GetType(function_.type_id());
|
||||||
if (result_type->AsVoid() != nullptr) {
|
if (result_type->AsVoid() != nullptr) {
|
||||||
AddStatement(create<ast::ReturnStatement>(Source{}));
|
AddStatement(builder_.Return(Source{}));
|
||||||
} else {
|
} else {
|
||||||
auto* ast_type = parser_impl_.ConvertType(function_.type_id());
|
auto* ast_type = parser_impl_.ConvertType(function_.type_id());
|
||||||
AddStatement(create<ast::ReturnStatement>(
|
AddStatement(builder_.Return(Source{}, parser_impl_.MakeNullValue(ast_type)));
|
||||||
Source{}, parser_impl_.MakeNullValue(ast_type)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1904,7 +1904,7 @@ Maybe<const ast::ReturnStatement*> ParserImpl::return_statement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (peek_is(Token::Type::kSemicolon)) {
|
if (peek_is(Token::Type::kSemicolon)) {
|
||||||
return create<ast::ReturnStatement>(source, nullptr);
|
return builder_.Return(source, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto expr = expression();
|
auto expr = expression();
|
||||||
@ -1913,7 +1913,7 @@ Maybe<const ast::ReturnStatement*> ParserImpl::return_statement() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO(bclayton): Check matched?
|
// TODO(bclayton): Check matched?
|
||||||
return create<ast::ReturnStatement>(source, expr.value);
|
return builder_.Return(source, expr.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// variable_statement
|
// variable_statement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user