Add semantic::Function, use it.

Pull the mutable semantic fields from ast::Function and into a new semantic::Function node.
Have the TypeDeterminer create these semantic::Function nodes.

Bug: tint:390
Change-Id: I237b1bed8709dd9a3cfa24d85d48fc77b7e532da
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/39902
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-02-03 16:43:20 +00:00
committed by Commit Bot service account
parent c694d43c75
commit 87c78ddabc
22 changed files with 744 additions and 512 deletions

View File

@@ -49,6 +49,7 @@
#include "src/clone_context.h"
#include "src/program.h"
#include "src/program_builder.h"
#include "src/semantic/function.h"
#include "src/type/struct_type.h"
#include "src/type/u32_type.h"
#include "src/type_determiner.h"
@@ -143,9 +144,10 @@ Transform::Output FirstIndexOffset::Run(const Program* in) {
if (buffer_var == nullptr) {
return nullptr; // no transform need, just clone func
}
auto* func_sem = in->Sem().Get(func);
ast::StatementList statements;
for (const auto& data :
func->local_referenced_builtin_variables()) {
func_sem->LocalReferencedBuiltinVariables()) {
if (data.second->value() == ast::Builtin::kVertexIndex) {
statements.emplace_back(CreateFirstIndexOffset(
in->Symbols().NameFor(vertex_index_sym), kFirstVertexName,