Convert private variables to function scope.
authorSteven Perron <stevenperron@google.com>
Mon, 11 Dec 2017 18:10:24 +0000 (13:10 -0500)
committerSteven Perron <stevenperron@google.com>
Tue, 19 Dec 2017 19:21:04 +0000 (14:21 -0500)
commitb86eb6842b4d95860828c58fd6f44a91801334be
treeae899a77a83a307f4f42e8c002aa311f9bcd13ea
parent8135dd6375b7b99442089bd1352d5c4f4db8aecc
Convert private variables to function scope.

When a private variable is used in a single function, it can be
converted to a function scope variable in that function.  This adds a
pass that does that.  The pass can be enabled using the option
`--private-to-local`.

This transformation allows other transformations to act on these
variables.

Also moved `FindPointerToType` from the inline class to the type manager.
15 files changed:
Android.mk
include/spirv-tools/optimizer.hpp
source/opt/CMakeLists.txt
source/opt/inline_pass.cpp
source/opt/inline_pass.h
source/opt/ir_context.h
source/opt/optimizer.cpp
source/opt/passes.h
source/opt/private_to_local_pass.cpp [new file with mode: 0644]
source/opt/private_to_local_pass.h [new file with mode: 0644]
source/opt/type_manager.cpp
source/opt/type_manager.h
test/opt/CMakeLists.txt
test/opt/private_to_local_test.cpp [new file with mode: 0644]
tools/opt/opt.cpp