| 1 | // Copyright (c) 2018 Google Inc. | 
|---|
| 2 | // | 
|---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|---|
| 4 | // you may not use this file except in compliance with the License. | 
|---|
| 5 | // You may obtain a copy of the License at | 
|---|
| 6 | // | 
|---|
| 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 8 | // | 
|---|
| 9 | // Unless required by applicable law or agreed to in writing, software | 
|---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 12 | // See the License for the specific language governing permissions and | 
|---|
| 13 | // limitations under the License. | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef SOURCE_DISASSEMBLE_H_ | 
|---|
| 16 | #define SOURCE_DISASSEMBLE_H_ | 
|---|
| 17 |  | 
|---|
| 18 | #include <string> | 
|---|
| 19 |  | 
|---|
| 20 | #include "spirv-tools/libspirv.h" | 
|---|
| 21 |  | 
|---|
| 22 | namespace spvtools { | 
|---|
| 23 |  | 
|---|
| 24 | // Decodes the given SPIR-V instruction binary representation to its assembly | 
|---|
| 25 | // text. The context is inferred from the provided module binary. The options | 
|---|
| 26 | // parameter is a bit field of spv_binary_to_text_options_t. Decoded text will | 
|---|
| 27 | // be stored into *text. Any error will be written into *diagnostic if | 
|---|
| 28 | // diagnostic is non-null. | 
|---|
| 29 | std::string spvInstructionBinaryToText(const spv_target_env env, | 
|---|
| 30 | const uint32_t* inst_binary, | 
|---|
| 31 | const size_t inst_word_count, | 
|---|
| 32 | const uint32_t* binary, | 
|---|
| 33 | const size_t word_count, | 
|---|
| 34 | const uint32_t options); | 
|---|
| 35 |  | 
|---|
| 36 | }  // namespace spvtools | 
|---|
| 37 |  | 
|---|
| 38 | #endif  // SOURCE_DISASSEMBLE_H_ | 
|---|
| 39 |  | 
|---|