[WHLSL] Simplify and eliminate redundant work in WHLSLFunctionWriter.cpp
authorrmorisset@apple.com <rmorisset@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Aug 2019 19:58:15 +0000 (19:58 +0000)
committerrmorisset@apple.com <rmorisset@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Aug 2019 19:58:15 +0000 (19:58 +0000)
commitd392591e9a1ade4cc477445db49434231f920880
treef5b002513591f6196553f08cf1666b1042c1e9e2
parent522abfa2d6150205c18cbef9f6c6a4f23f9c0016
[WHLSL] Simplify and eliminate redundant work in WHLSLFunctionWriter.cpp
https://bugs.webkit.org/show_bug.cgi?id=200460

Reviewed by Myles Maxfield.

2 trivial simplifications:
- Replace FunctionDeclarationWriter by a standalone function, there was no reason to make it a subclass of Visitor
- Avoid an exponential blow-up in the computation of reachable functions.

I have way too much noise on my system (swings back and forth between 7 and 12ms for this phase) to measure a performance win,
but since this patch simplifies things without adding complexity I think it is worth it.

No new test as there is no functional change intended.

* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::declareFunction):
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
(WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
(WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
(WebCore::WHLSL::Metal::sharedMetalFunctions):
(WebCore::WHLSL::Metal::metalFunctions):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248384 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp