[WHLSL] Metal code generation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Sep 2018 02:06:43 +0000 (02:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Sep 2018 02:06:43 +0000 (02:06 +0000)
commitc4230965523cdff491ef3c85f267954098ef13bf
tree8bec029c3dbcf917fcec69bff62e572395a796fb
parent584ac8a452ff78df81f2b456d5e006040bd13ad4
[WHLSL] Metal code generation
https://bugs.webkit.org/show_bug.cgi?id=187735

Patch by Thomas Denney <tdenney@apple.com> on 2018-09-20
Reviewed by Myles C. Maxfield.

Adds support for generating Metal Shading Language from WHLSL. Clients
should include the file MetalCodegenAll.js and then call whlslToMsl
with their program source code to compile to Metal.

* WebGPUShadingLanguageRI/ArrayType.js:
(ArrayType.prototype.get arrayRefType): Adds the arrayRefType method to
all types to find the type of that expression when it is used in a
MakeArrayRefExpression.
* WebGPUShadingLanguageRI/MakeArrayRefExpression.js:
(MakeArrayRefExpression):
(MakeArrayRefExpression.prototype.get type): Uses the new arrayRefType
getter on all types to find the type of the expression.
* WebGPUShadingLanguageRI/Metal/MSLBackend.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLCodegenAll.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLCompileResult.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLConstexprEmitter.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLFunctionDeclaration.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLFunctionDefinition.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLFunctionForwardDeclaration.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLNameMangler.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLNativeFunctionCall.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLStatementEmitter.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLTypeAttributes.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLTypeAttributesMap.js: Added.
* WebGPUShadingLanguageRI/Metal/MSLTypeUnifier.js: Added.
* WebGPUShadingLanguageRI/Metal/TypeOf.js: Added.
* WebGPUShadingLanguageRI/Metal/WhlslToMsl.js: Added.
* WebGPUShadingLanguageRI/PropertyResolver.js:
* WebGPUShadingLanguageRI/SynthesizeStructAccessors.js:
* WebGPUShadingLanguageRI/Test.js: Added awkward tests for the compiler
to generate code for.
(tests.incrementAndDecrement):
(tests.returnIntLiteralUint):
(tests.returnIntLiteralFloat):
(tests.nestedSubscriptWithArraysInStructs):
(tests.nestedSubscript):
(tests.lotsOfLocalVariables):
* WebGPUShadingLanguageRI/Type.js:
(Type.prototype.get arrayRefType): See above.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Tools/ChangeLog
Tools/WebGPUShadingLanguageRI/ArrayType.js
Tools/WebGPUShadingLanguageRI/MakeArrayRefExpression.js
Tools/WebGPUShadingLanguageRI/Metal/MSLBackend.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLCodegenAll.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLCompileResult.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLConstexprEmitter.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLFunctionDeclaration.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLFunctionDefinition.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLFunctionForwardDeclaration.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLNameMangler.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLNativeFunctionCall.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLStatementEmitter.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLTypeAttributes.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLTypeAttributesMap.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/MSLTypeUnifier.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/TypeOf.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/Metal/WhlslToMsl.js [new file with mode: 0644]
Tools/WebGPUShadingLanguageRI/PropertyResolver.js
Tools/WebGPUShadingLanguageRI/SynthesizeStructAccessors.js
Tools/WebGPUShadingLanguageRI/Test.js
Tools/WebGPUShadingLanguageRI/Type.js