Rename SpvTools to SpirvTools.
authorLei Zhang <antiagainst@google.com>
Fri, 16 Sep 2016 19:56:30 +0000 (15:56 -0400)
committerLei Zhang <antiagainst@google.com>
Wed, 21 Sep 2016 18:28:33 +0000 (14:28 -0400)
source/opt/build_module.cpp
source/opt/libspirv.cpp
source/opt/libspirv.hpp
test/cpp_interface.cpp
test/opt/pass_fixture.h
test/opt/test_def_use.cpp
test/opt/test_ir_loader.cpp

index ba4d1f3..1a4bc37 100644 (file)
@@ -64,7 +64,7 @@ std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
 std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
                                         MessageConsumer consumer,
                                         const std::string& text) {
-  SpvTools t(env);
+  SpirvTools t(env);
   t.SetMessageConsumer(consumer);
   std::vector<uint32_t> binary;
   if (!t.Assemble(text, &binary)) return nullptr;
index b3f89f1..fe09ed5 100644 (file)
@@ -22,7 +22,7 @@
 namespace spvtools {
 
 // Structs for holding the data members for SpvTools.
-struct SpvTools::Impl {
+struct SpirvTools::Impl {
   explicit Impl(spv_target_env env) : context(spvContextCreate(env)) {
     // The default consumer in spv_context_t is a null consumer, which provides
     // equivalent functionality (from the user's perspective) as a real consumer
@@ -33,16 +33,16 @@ struct SpvTools::Impl {
   spv_context context;  // C interface context object.
 };
 
-SpvTools::SpvTools(spv_target_env env) : impl_(new Impl(env)) {}
+SpirvTools::SpirvTools(spv_target_env env) : impl_(new Impl(env)) {}
 
-SpvTools::~SpvTools() {}
+SpirvTools::~SpirvTools() {}
 
-void SpvTools::SetMessageConsumer(MessageConsumer consumer) {
+void SpirvTools::SetMessageConsumer(MessageConsumer consumer) {
   SetContextMessageConsumer(impl_->context, std::move(consumer));
 }
 
-bool SpvTools::Assemble(const std::string& text,
-                        std::vector<uint32_t>* binary) const {
+bool SpirvTools::Assemble(const std::string& text,
+                          std::vector<uint32_t>* binary) const {
   spv_binary spvbinary = nullptr;
   spv_result_t status = spvTextToBinary(impl_->context, text.data(),
                                         text.size(), &spvbinary, nullptr);
@@ -53,8 +53,8 @@ bool SpvTools::Assemble(const std::string& text,
   return status == SPV_SUCCESS;
 }
 
-bool SpvTools::Disassemble(const std::vector<uint32_t>& binary,
-                           std::string* text, uint32_t options) const {
+bool SpirvTools::Disassemble(const std::vector<uint32_t>& binary,
+                             std::string* text, uint32_t options) const {
   spv_text spvtext = nullptr;
   spv_result_t status = spvBinaryToText(
       impl_->context, binary.data(), binary.size(), options, &spvtext, nullptr);
@@ -65,7 +65,7 @@ bool SpvTools::Disassemble(const std::vector<uint32_t>& binary,
   return status == SPV_SUCCESS;
 }
 
-bool SpvTools::Validate(const std::vector<uint32_t>& binary) const {
+bool SpirvTools::Validate(const std::vector<uint32_t>& binary) const {
   spv_const_binary_t b = {binary.data(), binary.size()};
   return spvValidate(impl_->context, &b, nullptr) == SPV_SUCCESS;
 }
index 63dde2f..ab18f14 100644 (file)
@@ -29,7 +29,7 @@ namespace spvtools {
 // provides methods for assembling, disassembling, and validating.
 //
 // Instances of this class provide basic thread-safety guarantee.
-class SpvTools {
+class SpirvTools {
  public:
   enum {
     // Default disassembling option used by Disassemble():
@@ -44,16 +44,16 @@ class SpvTools {
   // The constructed instance will have an empty message consumer, which just
   // ignores all messages from the library. Use SetMessageConsumer() to supply
   // one if messages are of concern.
-  explicit SpvTools(spv_target_env env);
+  explicit SpirvTools(spv_target_env env);
 
   // Disables copy/move constructor/assignment operations.
-  SpvTools(const SpvTools&) = delete;
-  SpvTools(SpvTools&&) = delete;
-  SpvTools& operator=(const SpvTools&) = delete;
-  SpvTools& operator=(SpvTools&&) = delete;
+  SpirvTools(const SpirvTools&) = delete;
+  SpirvTools(SpirvTools&&) = delete;
+  SpirvTools& operator=(const SpirvTools&) = delete;
+  SpirvTools& operator=(SpirvTools&&) = delete;
 
   // Destructs this instance.
-  ~SpvTools();
+  ~SpirvTools();
 
   // Sets the message consumer to the given |consumer|. The |consumer| will be
   // invoked once for each message communicated from the library.
index 7c49048..b7ca5b7 100644 (file)
@@ -25,7 +25,7 @@ using ::testing::ContainerEq;
 
 TEST(CppInterface, SuccessfulRoundTrip) {
   const std::string input_text = "%2 = OpSizeOf %1 %3\n";
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
 
   std::vector<uint32_t> binary;
   EXPECT_TRUE(t.Assemble(input_text, &binary));
@@ -52,7 +52,7 @@ TEST(CppInterface, SuccessfulRoundTrip) {
 
 TEST(CppInterface, AssembleEmptyModule) {
   std::vector<uint32_t> binary(10, 42);
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   EXPECT_TRUE(t.Assemble("", &binary));
   // We only have the header.
   EXPECT_EQ(5u, binary.size());
@@ -62,7 +62,7 @@ TEST(CppInterface, AssembleEmptyModule) {
 
 TEST(CppInterface, AssembleWithWrongTargetEnv) {
   const std::string input_text = "%r = OpSizeOf %type %pointer";
-  SpvTools t(SPV_ENV_UNIVERSAL_1_0);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_0);
   int invocation_count = 0;
   t.SetMessageConsumer(
       [&invocation_count](spv_message_level_t level, const char* source,
@@ -84,7 +84,7 @@ TEST(CppInterface, AssembleWithWrongTargetEnv) {
 
 TEST(CppInterface, DisassembleEmptyModule) {
   std::string text(10, 'x');
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   int invocation_count = 0;
   t.SetMessageConsumer(
       [&invocation_count](spv_message_level_t level, const char* source,
@@ -104,8 +104,8 @@ TEST(CppInterface, DisassembleEmptyModule) {
 
 TEST(CppInterface, DisassembleWithWrongTargetEnv) {
   const std::string input_text = "%r = OpSizeOf %type %pointer";
-  SpvTools t11(SPV_ENV_UNIVERSAL_1_1);
-  SpvTools t10(SPV_ENV_UNIVERSAL_1_0);
+  SpirvTools t11(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t10(SPV_ENV_UNIVERSAL_1_0);
   int invocation_count = 0;
   t10.SetMessageConsumer(
       [&invocation_count](spv_message_level_t level, const char* source,
@@ -130,7 +130,7 @@ TEST(CppInterface, DisassembleWithWrongTargetEnv) {
 TEST(CppInterface, SuccessfulValidation) {
   const std::string input_text =
       "OpCapability Shader\nOpMemoryModel Logical GLSL450";
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   int invocation_count = 0;
   t.SetMessageConsumer([&invocation_count](spv_message_level_t, const char*,
                                            const spv_position_t&, const char*) {
@@ -144,7 +144,7 @@ TEST(CppInterface, SuccessfulValidation) {
 }
 
 TEST(CppInterface, ValidateEmptyModule) {
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   int invocation_count = 0;
   t.SetMessageConsumer(
       [&invocation_count](spv_message_level_t level, const char* source,
@@ -165,7 +165,7 @@ TEST(CppInterface, ValidateEmptyModule) {
 // source code, we can get the given |optimized| source code.
 void CheckOptimization(const char* original, const char* optimized,
                        const Optimizer& opt) {
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   std::vector<uint32_t> original_binary;
   ASSERT_TRUE(t.Assemble(original, &original_binary));
 
@@ -179,7 +179,7 @@ void CheckOptimization(const char* original, const char* optimized,
 }
 
 TEST(CppInterface, OptimizeEmptyModule) {
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   std::vector<uint32_t> binary;
   EXPECT_TRUE(t.Assemble("", &binary));
 
@@ -246,7 +246,7 @@ TEST(CppInterface, OptimizeMoveAssignPassToken) {
 }
 
 TEST(CppInterface, OptimizeSameAddressForOriginalOptimizedBinary) {
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   std::vector<uint32_t> binary;
   ASSERT_TRUE(t.Assemble("OpSource GLSL 450", &binary));
 
index 08a78dc..dedd356 100644 (file)
@@ -134,7 +134,7 @@ class PassTest : public TestT {
 
  private:
   MessageConsumer consumer_;  // Message consumer.
-  SpvTools tools_;  // An instance for calling SPIRV-Tools functionalities.
+  SpirvTools tools_;  // An instance for calling SPIRV-Tools functionalities.
   std::unique_ptr<opt::PassManager> manager_;  // The pass manager.
 };
 
index 9d9089c..6e2af62 100644 (file)
@@ -32,7 +32,7 @@ using spvtools::opt::analysis::DefUseManager;
 
 // Disassembles the given |inst| and returns the disassembly.
 std::string DisassembleInst(ir::Instruction* inst) {
-  SpvTools tools(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools tools(SPV_ENV_UNIVERSAL_1_1);
 
   std::vector<uint32_t> binary;
   // We need this to generate the necessary header in the binary.
@@ -491,7 +491,7 @@ using ReplaceUseTest = ::testing::TestWithParam<ReplaceUseCase>;
 
 // Disassembles the given |module| and returns the disassembly.
 std::string DisassembleModule(ir::Module* module) {
-  SpvTools tools(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools tools(SPV_ENV_UNIVERSAL_1_1);
 
   std::vector<uint32_t> binary;
   module->ToBinary(&binary, /* skip_nop = */ false);
index b989380..4ef49bd 100644 (file)
@@ -23,7 +23,7 @@ namespace {
 using namespace spvtools;
 
 void DoRoundTripCheck(const std::string& text) {
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   std::unique_ptr<ir::Module> module =
       BuildModule(SPV_ENV_UNIVERSAL_1_1, IgnoreMessage, text);
   ASSERT_NE(nullptr, module) << "Failed to assemble\n" << text;
@@ -210,7 +210,7 @@ TEST(IrBuilder, OpUndefOutsideFunction) {
      "%double = OpTypeFloat 64\n";
   // clang-format on
 
-  SpvTools t(SPV_ENV_UNIVERSAL_1_1);
+  SpirvTools t(SPV_ENV_UNIVERSAL_1_1);
   std::unique_ptr<ir::Module> module =
       BuildModule(SPV_ENV_UNIVERSAL_1_1, IgnoreMessage, text);
   ASSERT_NE(nullptr, module);