diff options
author | Henning Baldersheim <balder@oath.com> | 2018-08-08 09:35:14 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-08-08 09:35:14 +0200 |
commit | 922b0b3b4ec730329561b1954b7055c152fd45b9 (patch) | |
tree | 427ddb8f403190ba7e163067798208b658dffb3b /eval | |
parent | ad4e3a8ca7dd8d6a90555de93c37b04107f10df0 (diff) |
dump -> print(stream)
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/tests/eval/compiled_function/compiled_function_test.cpp | 2 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp | 12 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/llvm/llvm_wrapper.h | 10 |
3 files changed, 11 insertions, 13 deletions
diff --git a/eval/src/tests/eval/compiled_function/compiled_function_test.cpp b/eval/src/tests/eval/compiled_function/compiled_function_test.cpp index 0e9806d5381..151a4cf5dd5 100644 --- a/eval/src/tests/eval/compiled_function/compiled_function_test.cpp +++ b/eval/src/tests/eval/compiled_function/compiled_function_test.cpp @@ -178,7 +178,7 @@ TEST("dump ir code to verify lazy casting") { Function function = Function::parse({"a", "b"}, "12==2+if(a==3&&a<10||b,10,5)"); LLVMWrapper wrapper; size_t id = wrapper.make_function(function.num_params(), PassParams::SEPARATE, function.root(), {}); - wrapper.compile(true); // dump module before compiling it + wrapper.compile(llvm::dbgs()); // dump module before compiling it using fun_type = double (*)(double, double); fun_type fun = (fun_type) wrapper.get_function_address(id); EXPECT_EQUAL(0.0, fun(0.0, 0.0)); diff --git a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp index 7a1211752f4..799a76656c9 100644 --- a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp +++ b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.cpp @@ -48,8 +48,7 @@ double vespalib_eval_forest_proxy(Forest::eval_function eval_forest, const Fores } } -namespace vespalib { -namespace eval { +namespace vespalib::eval { using namespace nodes; @@ -656,11 +655,11 @@ LLVMWrapper::make_forest_fragment(size_t num_params, const std::vector<const Nod } void -LLVMWrapper::compile(bool dump_module) +LLVMWrapper::compile(llvm::raw_ostream * dumpStream) { std::lock_guard<std::recursive_mutex> guard(_global_llvm_lock); - if (dump_module) { - _module->dump(); + if (dumpStream) { + _module->print(*dumpStream, nullptr); } _engine.reset(llvm::EngineBuilder(std::move(_module)).setOptLevel(llvm::CodeGenOpt::Aggressive).create()); assert(_engine && "llvm jit not available for your platform"); @@ -684,5 +683,4 @@ LLVMWrapper::~LLVMWrapper() { _context.reset(); } -} // namespace vespalib::eval -} // namespace vespalib +} diff --git a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.h b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.h index 6860be922f4..db29771ee9e 100644 --- a/eval/src/vespa/eval/eval/llvm/llvm_wrapper.h +++ b/eval/src/vespa/eval/eval/llvm/llvm_wrapper.h @@ -21,8 +21,7 @@ extern "C" { double vespalib_eval_elu(double a); }; -namespace vespalib { -namespace eval { +namespace vespalib::eval { /** * Simple interface used to track and clean up custom state. This is @@ -52,6 +51,7 @@ private: static std::recursive_mutex _global_llvm_lock; + void compile(llvm::raw_ostream * dumpStream); public: LLVMWrapper(); LLVMWrapper(LLVMWrapper &&rhs) = default; @@ -60,11 +60,11 @@ public: const gbdt::Optimize::Chain &forest_optimizers); size_t make_forest_fragment(size_t num_params, const std::vector<const nodes::Node *> &fragment); const std::vector<gbdt::Forest::UP> &get_forests() const { return _forests; } - void compile(bool dump_module = false); + void compile(llvm::raw_ostream & dumpStream) { compile(&dumpStream); } + void compile() { compile(nullptr); } void *get_function_address(size_t function_id); ~LLVMWrapper(); }; -} // namespace vespalib::eval -} // namespace vespalib +} |