From 9eb07760e7d920abdb62567fd0c050b6593b7aa3 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Tue, 29 Oct 2019 15:30:42 -0700 Subject: [PATCH] [MIPS/MIPS64] Remove another set of differences from upstream. --- .../MIPS/EmulateInstructionMIPS.cpp | 58 +++++-------------- .../MIPS64/EmulateInstructionMIPS64.cpp | 43 ++++---------- 2 files changed, 25 insertions(+), 76 deletions(-) diff --git a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp index e10dfb64353cb..21b6296745bd5 100644 --- a/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ b/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -1081,14 +1081,11 @@ bool EmulateInstructionMIPS::EvaluateInstruction(uint32_t evaluate_options) { * mc_insn.getOpcode() returns decoded opcode. However to make use * of llvm::Mips:: we would need "MipsGenInstrInfo.inc". */ - llvm::StringRef op_name_ref = m_insn_info->getName(mc_insn.getOpcode()); + const char *op_name = m_insn_info->getName(mc_insn.getOpcode()).data(); - if (op_name_ref.empty()) + if (op_name == nullptr) return false; - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); - /* * Decoding has been done already. Just get the call-back function * and emulate the instruction. @@ -1351,10 +1348,7 @@ bool EmulateInstructionMIPS::Emulate_SUBU_ADDU(llvm::MCInst &insn) { bool success = false; uint64_t result; uint8_t src, dst, rt; - - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); dst = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); src = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); @@ -1806,9 +1800,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops(llvm::MCInst &insn) { bool success = false; uint32_t rs, rt; int32_t offset, pc, target = 0, rs_val, rt_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); rt = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); @@ -1857,11 +1849,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops_C(llvm::MCInst &insn) { bool success = false; uint32_t rs, rt; int32_t offset, pc, target = 0, rs_val, rt_val; - - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); - + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); uint32_t current_inst_size = m_insn_info->get(insn.getOpcode()).getSize(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); @@ -1941,9 +1929,7 @@ bool EmulateInstructionMIPS::Emulate_Bcond_Link_C(llvm::MCInst &insn) { uint32_t rs; int32_t offset, pc, target = 0; int32_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -2012,9 +1998,7 @@ bool EmulateInstructionMIPS::Emulate_Bcond_Link(llvm::MCInst &insn) { uint32_t rs; int32_t offset, pc, target = 0; int32_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -2064,9 +2048,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops(llvm::MCInst &insn) { uint32_t rs; int32_t offset, pc, target = 0; int32_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -2119,9 +2101,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops_C(llvm::MCInst &insn) { uint32_t rs; int32_t offset, pc, target = 0; int32_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); uint32_t current_inst_size = m_insn_info->get(insn.getOpcode()).getSize(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); @@ -2207,9 +2187,7 @@ bool EmulateInstructionMIPS::Emulate_Branch_MM(llvm::MCInst &insn) { bool success = false; int32_t target = 0; uint32_t current_inst_size = m_insn_info->get(insn.getOpcode()).getSize(); - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); bool update_ra = false; uint32_t ra_offset = 0; @@ -2309,9 +2287,7 @@ bool EmulateInstructionMIPS::Emulate_Branch_MM(llvm::MCInst &insn) { bool EmulateInstructionMIPS::Emulate_JALRx16_MM(llvm::MCInst &insn) { bool success = false; uint32_t ra_offset = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); uint32_t rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); @@ -2350,9 +2326,7 @@ bool EmulateInstructionMIPS::Emulate_JALRx16_MM(llvm::MCInst &insn) { bool EmulateInstructionMIPS::Emulate_JALx(llvm::MCInst &insn) { bool success = false; uint32_t offset = 0, target = 0, pc = 0, ra_offset = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); /* * JALS target @@ -2700,9 +2674,7 @@ bool EmulateInstructionMIPS::Emulate_FP_branch(llvm::MCInst &insn) { bool success = false; uint32_t cc, fcsr; int32_t pc, offset, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); cc = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -2818,9 +2790,7 @@ bool EmulateInstructionMIPS::Emulate_3D_branch(llvm::MCInst &insn) { bool success = false; uint32_t cc, fcsr; int32_t pc, offset, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); cc = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); diff --git a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp index 85068c1a919bb..5fabbeb756ccd 100644 --- a/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ b/lldb/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -972,14 +972,11 @@ bool EmulateInstructionMIPS64::EvaluateInstruction(uint32_t evaluate_options) { * mc_insn.getOpcode() returns decoded opcode. However to make use * of llvm::Mips:: we would need "MipsGenInstrInfo.inc". */ - llvm::StringRef op_name_ref = m_insn_info->getName(mc_insn.getOpcode()); + const char *op_name = m_insn_info->getName(mc_insn.getOpcode()).data(); - if (op_name_ref.empty()) + if (op_name == nullptr) return false; - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); - /* * Decoding has been done already. Just get the call-back function * and emulate the instruction. @@ -1264,9 +1261,7 @@ bool EmulateInstructionMIPS64::Emulate_DSUBU_DADDU(llvm::MCInst &insn) { bool success = false; uint64_t result; uint8_t src, dst, rt; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); dst = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); src = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); @@ -1345,9 +1340,7 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops(llvm::MCInst &insn) { bool success = false; uint32_t rs, rt; int64_t offset, pc, rs_val, rt_val, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); rt = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); @@ -1399,9 +1392,7 @@ bool EmulateInstructionMIPS64::Emulate_Bcond_Link(llvm::MCInst &insn) { uint32_t rs; int64_t offset, pc, target = 0; int64_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -1511,9 +1502,7 @@ bool EmulateInstructionMIPS64::Emulate_Bcond_Link_C(llvm::MCInst &insn) { bool success = false; uint32_t rs; int64_t offset, pc, rs_val, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -1581,9 +1570,7 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops(llvm::MCInst &insn) { bool success = false; uint32_t rs; int64_t offset, pc, rs_val, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm(); @@ -1668,9 +1655,7 @@ bool EmulateInstructionMIPS64::Emulate_BXX_3ops_C(llvm::MCInst &insn) { bool success = false; uint32_t rs, rt; int64_t offset, pc, rs_val, rt_val, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); uint32_t current_inst_size = m_insn_info->get(insn.getOpcode()).getSize(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); @@ -1750,9 +1735,7 @@ bool EmulateInstructionMIPS64::Emulate_BXX_2ops_C(llvm::MCInst &insn) { uint32_t rs; int64_t offset, pc, target = 0; int64_t rs_val; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); uint32_t current_inst_size = m_insn_info->get(insn.getOpcode()).getSize(); rs = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); @@ -1992,9 +1975,7 @@ bool EmulateInstructionMIPS64::Emulate_FP_branch(llvm::MCInst &insn) { bool success = false; uint32_t cc, fcsr; int64_t pc, offset, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); /* * BC1F cc, offset @@ -2119,9 +2100,7 @@ bool EmulateInstructionMIPS64::Emulate_3D_branch(llvm::MCInst &insn) { bool success = false; uint32_t cc, fcsr; int64_t pc, offset, target = 0; - llvm::StringRef op_name_ref = m_insn_info->getName(insn.getOpcode()); - std::string op_name_str = op_name_ref; - const char *op_name = op_name_str.c_str(); + const char *op_name = m_insn_info->getName(insn.getOpcode()).data(); cc = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); offset = insn.getOperand(1).getImm();