From 2a52137ca42b18b06325bd4495a3f608c1463753 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Nov 2023 19:37:29 +0000 Subject: [PATCH] Logger log_instruction updated to the master version. --- include/nil/blueprint/logger.hpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/nil/blueprint/logger.hpp b/include/nil/blueprint/logger.hpp index 94bf8a81..6027fd72 100644 --- a/include/nil/blueprint/logger.hpp +++ b/include/nil/blueprint/logger.hpp @@ -55,25 +55,20 @@ namespace nil { void debug(std::string_view debug_message) { BOOST_LOG_TRIVIAL(debug) << debug_message; } - + void log_instruction(const llvm::Instruction *inst) { if (inst->getFunction() != current_function) { current_function = inst->getFunction(); - BOOST_LOG_TRIVIAL(debug) << current_function->getName().str(); } if (inst->getParent() != current_block) { current_block = inst->getParent(); - - BOOST_LOG_TRIVIAL(debug) << current_block->getNameOrAsOperand(); - } - std::string inst_name = inst->getNameOrAsOperand(); - const char *opcode_name = inst->getOpcodeName(); - if (inst_name == "") { - BOOST_LOG_TRIVIAL(debug) << "\t\t" << opcode_name; - } else { - BOOST_LOG_TRIVIAL(debug) << "\t\t" << opcode_name << " -> " << inst_name; + BOOST_LOG_TRIVIAL(debug) << "\t" << current_block->getNameOrAsOperand(); } + std::string str; + llvm::raw_string_ostream ss(str); + inst->print(ss); + BOOST_LOG_TRIVIAL(debug) << "\t\t" << str; } }; } // namespace blueprint