diff options
author | Francisco Jerez <[email protected]> | 2016-05-17 16:02:58 +0200 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2016-07-11 20:34:33 -0700 |
commit | 26fa9bfd0dfccf06358180ae740121522d09b51f (patch) | |
tree | f66981bb4264bd6404a5f3ec7c7c15f05d2932f6 /src/gallium/state_trackers | |
parent | f0721020ad6ba20110705cb1d927de09e0e25edc (diff) |
clover/llvm: Define function for bitcode print-out.
Reviewed-by: Serge Martin <[email protected]>
Tested-by: Jan Vesely <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/clover/llvm/invocation.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp index d4c8addeea3..a51411d9df6 100644 --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp @@ -433,6 +433,14 @@ namespace { c); } + std::string + print_module_bitcode(const ::llvm::Module &mod) { + std::string s; + ::llvm::raw_string_ostream os { s }; + mod.print(os, NULL); + return os.str(); + } + std::vector<char> emit_code(::llvm::Module &mod, const target &target, TargetMachine::CodeGenFileType ft, @@ -572,13 +580,8 @@ clover::compile_program_llvm(const std::string &source, optimize(*mod, c->getCodeGenOpts().OptimizationLevel); - if (has_flag(debug::llvm)) { - std::string log; - raw_string_ostream s_log(log); - mod->print(s_log, NULL); - s_log.flush(); - debug::log(".ll", log); - } + if (has_flag(debug::llvm)) + debug::log(".ll", print_module_bitcode(*mod)); module m; // Build the clover::module |