summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/llvm-spirv/llvm-spirv.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/llvm-spirv/llvm-spirv.cpp b/tools/llvm-spirv/llvm-spirv.cpp
index 906f718..436af59 100644
--- a/tools/llvm-spirv/llvm-spirv.cpp
+++ b/tools/llvm-spirv/llvm-spirv.cpp
@@ -93,6 +93,11 @@ IsRegularization("s", cl::desc(
"Regularize LLVM to be representable by SPIR-V"));
#ifdef _SPIRV_SUPPORT_TEXT_FMT
+namespace SPIRV {
+// Use textual format for SPIRV.
+extern bool SPIRVUseTextFormat;
+}
+
static cl::opt<bool>
ToText("to-text", cl::desc("Convert input SPIR-V binary to internal textual format"));
@@ -139,7 +144,8 @@ convertLLVMToSPIRV() {
if (InputFile == "-")
OutputFile = "-";
else
- OutputFile = removeExt(InputFile) + kExt::SpirvBinary;
+ OutputFile = removeExt(InputFile) +
+ (SPIRV::SPIRVUseTextFormat ? kExt::SpirvText : kExt::SpirvBinary);
}
llvm::StringRef outFile(OutputFile);