summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2018-01-04 12:59:50 -0500
committerDavid Neto <dneto@google.com>2018-01-04 18:34:18 -0500
commitc32e79eeefe1554076c4e094a61aa9a98d97c540 (patch)
tree99b9e1510b43aa95764969ae1aa8deaa72613f3a /tools
parent702852bd22bf2cb15ff10043eefe8ae0417f65d6 (diff)
Add --print-all optimizer option
Adds optimizer API to write disassembly to a given output stream before each pass, and after the last pass. Adds spirv-opt --print-all option to write disassembly to stderr before each pass, and after the last pass.
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index ead001bc..2f62b4c4 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -218,6 +218,9 @@ Options (in lexicographical order):
'spirv-opt --merge-blocks -O ...' applies the transformation
--merge-blocks followed by all the transformations implied by
-O.
+ --print-all
+ Print SPIR-V assembly to standard error output before each pass
+ and after the last pass.
--private-to-local
Change the scope of private variables that are used in a single
function to that function.
@@ -457,6 +460,8 @@ OptStatus ParseFlags(int argc, const char** argv, Optimizer* optimizer,
}
} else if (0 == strcmp(cur_arg, "--ccp")) {
optimizer->RegisterPass(CreateCCPPass());
+ } else if (0 == strcmp(cur_arg, "--print-all")) {
+ optimizer->SetPrintAll(&std::cerr);
} else if ('\0' == cur_arg[1]) {
// Setting a filename of "-" to indicate stdin.
if (!*in_file) {