diff options
author | Diego Novillo <dnovillo@google.com> | 2017-08-30 14:19:22 -0400 |
---|---|---|
committer | David Neto <dneto@google.com> | 2017-10-10 12:14:09 -0400 |
commit | c90d7305e7d88af45313bff8de91d4d0bbf65b12 (patch) | |
tree | 73417f431c2dbc46d7b4841d663c5ae722a68a4e /include | |
parent | c26778fa99ac1a282bb6815229811578a26b3c6a (diff) | |
download | spirv-tools-c90d7305e7d88af45313bff8de91d4d0bbf65b12.tar.gz |
Add -O, -Os and -Oconfig flags.
These flags are expanded to a series of spirv-opt flags with the
following semantics:
-O: expands to passes that attempt to improve the performance of the
generated code.
-Os: expands to passes that attempt to reduce the size of the generated
code.
-Oconfig=<file> expands to the sequence of passes determined by the
flags specified in the user-provided file.
Diffstat (limited to 'include')
-rw-r--r-- | include/spirv-tools/optimizer.hpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/spirv-tools/optimizer.hpp b/include/spirv-tools/optimizer.hpp index e513120f..a7611d50 100644 --- a/include/spirv-tools/optimizer.hpp +++ b/include/spirv-tools/optimizer.hpp @@ -77,17 +77,32 @@ class Optimizer { // method. Optimizer& RegisterPass(PassToken&& pass); + // Registers passes that attempt to improve performance of generated code. + // This sequence of passes is subject to constant review and will change + // from time to time. + Optimizer& RegisterPerformancePasses(); + + // Registers passes that attempt to improve the size of generated code. + // This sequence of passes is subject to constant review and will change + // from time to time. + Optimizer& RegisterSizePasses(); + // Optimizes the given SPIR-V module |original_binary| and writes the // optimized binary into |optimized_binary|. // Returns true on successful optimization, whether or not the module is // modified. Returns false if errors occur when processing |original_binary| // using any of the registered passes. In that case, no further passes are - // excuted and the contents in |optimized_binary| may be invalid. + // executed and the contents in |optimized_binary| may be invalid. // // It's allowed to alias |original_binary| to the start of |optimized_binary|. bool Run(const uint32_t* original_binary, size_t original_binary_size, std::vector<uint32_t>* optimized_binary) const; + // Returns a vector of strings with all the pass names added to this + // optimizer's pass manager. These strings are valid until the associated + // pass manager is destroyed. + std::vector<const char *> GetPassNames() const; + private: struct Impl; // Opaque struct for holding internal data. std::unique_ptr<Impl> impl_; // Unique pointer to internal data. |