[webkit-changes] [WebKit/WebKit] 664ece: [WGSL] Implement entire WGSL AST
Dan Glastonbury
noreply at github.com
Tue Jan 31 21:37:07 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 664eceb30ec0355555f0781181f2b312f64896e2
https://github.com/WebKit/WebKit/commit/664eceb30ec0355555f0781181f2b312f64896e2
Author: Dan Glastonbury <djg at apple.com>
Date: 2023-01-31 (Tue, 31 Jan 2023)
Changed paths:
M Source/WTF/WTF.xcodeproj/project.pbxproj
M Source/WTF/wtf/CMakeLists.txt
A Source/WTF/wtf/RefVector.h
M Source/WebGPU/WGSL/AST/AST.h
A Source/WebGPU/WGSL/AST/ASTAbstractFloatLiteral.h
A Source/WebGPU/WGSL/AST/ASTAbstractIntegerLiteral.h
A Source/WebGPU/WGSL/AST/ASTAlignAttribute.h
R Source/WebGPU/WGSL/AST/ASTArrayAccess.h
M Source/WebGPU/WGSL/AST/ASTAssignmentStatement.h
M Source/WebGPU/WGSL/AST/ASTAttribute.h
A Source/WebGPU/WGSL/AST/ASTBinaryExpression.cpp
M Source/WebGPU/WGSL/AST/ASTBinaryExpression.h
M Source/WebGPU/WGSL/AST/ASTBindingAttribute.h
A Source/WebGPU/WGSL/AST/ASTBitcastExpression.h
A Source/WebGPU/WGSL/AST/ASTBoolLiteral.h
A Source/WebGPU/WGSL/AST/ASTBreakStatement.h
M Source/WebGPU/WGSL/AST/ASTBuiltinAttribute.h
A Source/WebGPU/WGSL/AST/ASTCallExpression.h
R Source/WebGPU/WGSL/AST/ASTCallableExpression.h
A Source/WebGPU/WGSL/AST/ASTCompoundAssignmentStatement.h
M Source/WebGPU/WGSL/AST/ASTCompoundStatement.h
A Source/WebGPU/WGSL/AST/ASTConstAttribute.h
A Source/WebGPU/WGSL/AST/ASTConstantValue.h
A Source/WebGPU/WGSL/AST/ASTContinueStatement.h
R Source/WebGPU/WGSL/AST/ASTDecl.h
A Source/WebGPU/WGSL/AST/ASTDeclaration.h
A Source/WebGPU/WGSL/AST/ASTDecrementIncrementStatement.h
A Source/WebGPU/WGSL/AST/ASTDirective.h
A Source/WebGPU/WGSL/AST/ASTDiscardStatement.h
M Source/WebGPU/WGSL/AST/ASTExpression.h
A Source/WebGPU/WGSL/AST/ASTFieldAccessExpression.h
A Source/WebGPU/WGSL/AST/ASTFloat32Literal.h
A Source/WebGPU/WGSL/AST/ASTForStatement.h
M Source/WebGPU/WGSL/AST/ASTForward.h
A Source/WebGPU/WGSL/AST/ASTFunction.h
R Source/WebGPU/WGSL/AST/ASTFunctionDecl.h
R Source/WebGPU/WGSL/AST/ASTGlobalDirective.h
M Source/WebGPU/WGSL/AST/ASTGroupAttribute.h
A Source/WebGPU/WGSL/AST/ASTIdAttribute.h
A Source/WebGPU/WGSL/AST/ASTIdentifier.h
M Source/WebGPU/WGSL/AST/ASTIdentifierExpression.h
M Source/WebGPU/WGSL/AST/ASTIdentityExpression.h
A Source/WebGPU/WGSL/AST/ASTIfStatement.h
A Source/WebGPU/WGSL/AST/ASTIndexAccessExpression.h
A Source/WebGPU/WGSL/AST/ASTInterpolateAttribute.h
A Source/WebGPU/WGSL/AST/ASTInvariantAttribute.h
A Source/WebGPU/WGSL/AST/ASTLetValue.h
M Source/WebGPU/WGSL/AST/ASTLiteralExpressions.h
M Source/WebGPU/WGSL/AST/ASTLocationAttribute.h
A Source/WebGPU/WGSL/AST/ASTLoopStatement.h
M Source/WebGPU/WGSL/AST/ASTNode.h
A Source/WebGPU/WGSL/AST/ASTOverrideValue.h
A Source/WebGPU/WGSL/AST/ASTParameterValue.h
A Source/WebGPU/WGSL/AST/ASTPhonyStatement.h
M Source/WebGPU/WGSL/AST/ASTPointerDereference.h
M Source/WebGPU/WGSL/AST/ASTReturnStatement.h
M Source/WebGPU/WGSL/AST/ASTShaderModule.h
A Source/WebGPU/WGSL/AST/ASTSigned32Literal.h
A Source/WebGPU/WGSL/AST/ASTSizeAttribute.h
M Source/WebGPU/WGSL/AST/ASTStageAttribute.h
M Source/WebGPU/WGSL/AST/ASTStatement.h
A Source/WebGPU/WGSL/AST/ASTStaticAssertStatement.h
M Source/WebGPU/WGSL/AST/ASTStringDumper.cpp
M Source/WebGPU/WGSL/AST/ASTStringDumper.h
A Source/WebGPU/WGSL/AST/ASTStructure.h
R Source/WebGPU/WGSL/AST/ASTStructureAccess.h
R Source/WebGPU/WGSL/AST/ASTStructureDecl.h
A Source/WebGPU/WGSL/AST/ASTStructureMember.h
A Source/WebGPU/WGSL/AST/ASTSwitchStatement.h
R Source/WebGPU/WGSL/AST/ASTTypeDecl.h
A Source/WebGPU/WGSL/AST/ASTTypeName.h
A Source/WebGPU/WGSL/AST/ASTUnaryExpression.cpp
M Source/WebGPU/WGSL/AST/ASTUnaryExpression.h
A Source/WebGPU/WGSL/AST/ASTUnsigned32Literal.h
A Source/WebGPU/WGSL/AST/ASTValue.h
A Source/WebGPU/WGSL/AST/ASTVariable.h
R Source/WebGPU/WGSL/AST/ASTVariableDecl.h
M Source/WebGPU/WGSL/AST/ASTVariableQualifier.h
M Source/WebGPU/WGSL/AST/ASTVariableStatement.h
M Source/WebGPU/WGSL/AST/ASTVisitor.cpp
M Source/WebGPU/WGSL/AST/ASTVisitor.h
A Source/WebGPU/WGSL/AST/ASTWhileStatement.h
M Source/WebGPU/WGSL/AST/ASTWorkgroupSizeAttribute.h
M Source/WebGPU/WGSL/CallGraph.cpp
M Source/WebGPU/WGSL/CallGraph.h
M Source/WebGPU/WGSL/EntryPointRewriter.cpp
M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
M Source/WebGPU/WGSL/Parser.cpp
M Source/WebGPU/WGSL/ParserPrivate.h
M Source/WebGPU/WGSL/ResolveTypeReferences.cpp
M Source/WebGPU/WGSL/SourceSpan.h
M Source/WebGPU/WebGPU.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WGSL/ConstLiteralTests.cpp
M Tools/TestWebKitAPI/Tests/WGSL/LexerTests.cpp
M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp
Log Message:
-----------
[WGSL] Implement entire WGSL AST
https://bugs.webkit.org/show_bug.cgi?id=246559
rdar://problem/101198259
Reviewed by Tadeu Zagallo.
Implement the entirety of an AST to represent WGSL programs as specified in
https://bugs.webkit.org/show_bug.cgi?id=246559.
* The naming convention is to use full forwards for names, not abbreviations, so
`Structure` not `Struct`.
* All node kinds have been unified into a global `NodeKind`. `TypeCastTraits`
are implemented for AST nodes, and `is<AST::Node>(node)` pattern is used
instead of direct comparison of `node.kind()` to enum values.
* Identifier has been added. It's current a wrapper around `WTF::String` but
could become an interned string type, such as `WTF::AtomString` in the future.
* GlobarVars are just `Variable`s. What makes them global is that they're
accessible from the `ShaderModule`.
Differences from the AST tree outlined in the bug:
* The AST in the bug eliminated the abstract integer types. It's unclear whether
those can be removed, so they've been kept as distinct node types.
* Due to lack of node hierarchy representation for types, `Declaration` is kept
as a base-class for `Function`, `Structure` and `Variable`.
* `TypeDecl` really represented the spelling of type name and has been renamed
to `TypeName`, with the eventual goal of collapsing named, parameterized and
array types names into one node type. Due to lack of type hierarchy,
StructDecl and ReferenceDecl have been kept but renamed StructTypeName and
ReferenceTypeName even though this doesn't really fit.
Canonical link: https://commits.webkit.org/259661@main
More information about the webkit-changes
mailing list