[webkit-changes] [WebKit/WebKit] 42bb0c: [WGSL] Implement if statement codegen

Dan Glastonbury noreply at github.com
Tue Apr 11 23:08:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 42bb0c9d8cd6a9f358091ab7079db850d87177fd
      https://github.com/WebKit/WebKit/commit/42bb0c9d8cd6a9f358091ab7079db850d87177fd
  Author: Dan Glastonbury <djg at apple.com>
  Date:   2023-04-11 (Tue, 11 Apr 2023)

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTStringDumper.cpp
    M Source/WebGPU/WGSL/AST/ASTStringDumper.h
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    A Source/WebGPU/WGSL/tests/valid/if.wgsl

  Log Message:
  -----------
  [WGSL] Implement if statement codegen
https://bugs.webkit.org/show_bug.cgi?id=255267
rdar://problem/107862445

Reviewed by Tadeu Zagallo.

Implement type-checking and codegen for if statements.

Minor cleanup of indentation handling in FunctionDefinitionWriter to allow `else
if` to format nicely.

* Source/WebGPU/WGSL/AST/ASTStringDumper.cpp:
(WGSL::AST::StringDumper::visit):
* Source/WebGPU/WGSL/AST/ASTStringDumper.h:
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
Map WGSL if statement to C if statement.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):
Type check if statement but checking that the type of the test expression is
boolean.
* Source/WebGPU/WGSL/tests/valid/if.wgsl: Added.
Test for parsing, type-checking and codegen of if statements.

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




More information about the webkit-changes mailing list