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.
diff --git a/include/spirv-tools/optimizer.hpp b/include/spirv-tools/optimizer.hpp
index e513120..a7611d5 100644
--- a/include/spirv-tools/optimizer.hpp
+++ b/include/spirv-tools/optimizer.hpp
@@ -77,17 +77,32 @@
// 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.