summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2015-11-02 23:40:00 -0500
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2015-11-02 23:40:00 -0500
commitc6d76c25cb2ac8839cf38267fb5239a2be6457af (patch)
tree5fe75d43ac956843243f393a814008c684f5235e /tools
parent51715a27da7e9c30035de816cd45f2b91286c7fc (diff)
[SPIRV] Add processing SPIR-V metadata.
Add translation of SPIR 1.2/2.0 metadata to SPIR-V metadata Fix OpExtension/OpSourceExtension to have one extension string instead of spaced separated multiple extension strings in each instruction. Fix OpExecutionMode for ExecutionModeVectorTypeHint to use encoding instead of type id/string. Fix bug about reading empty string in text format SPIR-V. Allow llvm_spirv to use -o - for output to stdout. Fix OpEntryPoint to add name of entry pointer function.
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-spirv/llvm-spirv.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/llvm-spirv/llvm-spirv.cpp b/tools/llvm-spirv/llvm-spirv.cpp
index 604e268..0c19d83 100644
--- a/tools/llvm-spirv/llvm-spirv.cpp
+++ b/tools/llvm-spirv/llvm-spirv.cpp
@@ -142,8 +142,10 @@ convertLLVMToSPIRV() {
OutputFile = removeExt(InputFile) + kExt::SpirvBinary;
}
- std::ofstream OFS(OutputFile, std::ios::binary);
- if (!WriteSPIRV(M.get(), OFS, Err)) {
+ std::ofstream OFS;
+ std::ostream *OS = OutputFile == "-" ? &std::cout :
+ (OFS.open(OutputFile, std::ios::binary), &OFS);
+ if (!WriteSPIRV(M.get(), *OS, Err)) {
errs() << "Fails to save LLVM as SPIRV: " << Err << '\n';
return -1;
}