[webkit-changes] [WebKit/WebKit] 4697ea: [WGSL] Add a name mangling pass

Tadeu Zagallo noreply at github.com
Wed Feb 1 02:10:21 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4697eaccd00f7f8e11b01e96fe00b5976d8e047f
      https://github.com/WebKit/WebKit/commit/4697eaccd00f7f8e11b01e96fe00b5976d8e047f
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M Source/WebGPU/WGSL/CallGraph.h
    A Source/WebGPU/WGSL/MangleNames.cpp
    A Source/WebGPU/WGSL/MangleNames.h
    M Source/WebGPU/WGSL/WGSL.cpp
    M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
    M Source/WebGPU/WebGPU/ShaderModule.mm

  Log Message:
  -----------
  [WGSL] Add a name mangling pass
https://bugs.webkit.org/show_bug.cgi?id=251441
rdar://104872078

Reviewed by Myles C. Maxfield.

Initial name mangling pass implementation. It's still a bit bare bones, and until
we implement the type checking we can't rename struct fields, but everything else
(that is currently supported) works. The implementation is a bit rough, just
renaming everything in place, but it's fairly concise and gets the job done, at
least for the time being.

* Source/WebGPU/WGSL/AST/ASTFunctionDecl.h:
* Source/WebGPU/WGSL/AST/ASTIdentifierExpression.h:
* Source/WebGPU/WGSL/AST/ASTStructureAccess.h:
* Source/WebGPU/WGSL/AST/ASTStructureDecl.h:
* Source/WebGPU/WGSL/AST/ASTTypeDecl.h:
* Source/WebGPU/WGSL/AST/ASTVariableDecl.h:
* Source/WebGPU/WGSL/CallGraph.h:
(WGSL::CallGraph::ast const):
(WGSL::CallGraph::entrypoints const):
(WGSL::CallGraph::ast): Deleted.
(WGSL::CallGraph::entrypoints): Deleted.
* Source/WebGPU/WGSL/MangleNames.cpp: Added.
(WGSL::MangledName::toString const):
(WGSL::NameManglerVisitor::NameManglerVisitor):
(WGSL::NameManglerVisitor::Context::Context):
(WGSL::NameManglerVisitor::Context::lookup const):
(WGSL::NameManglerVisitor::Context::add):
(WGSL::NameManglerVisitor::ContextScope::ContextScope):
(WGSL::NameManglerVisitor::ContextScope::~ContextScope):
(WGSL::NameManglerVisitor::run):
(WGSL::NameManglerVisitor::visit):
(WGSL::NameManglerVisitor::visitFunctionBody):
(WGSL::NameManglerVisitor::visitVariableDeclaration):
(WGSL::NameManglerVisitor::def):
(WGSL::NameManglerVisitor::makeMangledName):
(WGSL::NameManglerVisitor::read const):
(WGSL::mangleNames):
* Source/WebGPU/WGSL/MangleNames.h: Copied from Source/WebGPU/WGSL/CallGraph.h.
* Source/WebGPU/WGSL/WGSL.cpp:
(WGSL::prepare):
* Source/WebGPU/WebGPU.xcodeproj/project.pbxproj:
* Source/WebGPU/WebGPU/ShaderModule.mm:
(WebGPU::ShaderModule::getNamedFunction const):

Canonical link: https://commits.webkit.org/259671@main




More information about the webkit-changes mailing list