[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 03/24] disas/nanomips: Delete NMD class field
From: |
Milica Lazarevic |
Subject: |
[PATCH v3 03/24] disas/nanomips: Delete NMD class field |
Date: |
Mon, 12 Sep 2022 14:26:14 +0200 |
The m_requested_instruction_categories field always has the same value,
ALL_ATTRIBUTES. The only use of that field is within the if statement.
When replaced with a specific value, the if statement is always false,
so it has been removed.
Now, when the only use of the m_requested_instruction_categories field
is removed, we can delete the field declaration and initialization in
the NMD class. Also, we're changing the way of the construction of the
NMD object in the nanomips_dis function.
Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
---
disas/nanomips.cpp | 13 +------------
disas/nanomips.h | 4 +---
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index bdc640b38b..721ca3f52b 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -51,7 +51,7 @@ int nanomips_dis(char *buf,
uint16 bits[3] = {one, two, three};
TABLE_ENTRY_TYPE type;
- NMD d(address, ALL_ATTRIBUTES);
+ NMD d(address);
int size = d.Disassemble(bits, disasm, type);
strcpy(buf, disasm.c_str());
@@ -812,17 +812,6 @@ int NMD::Disassemble(const uint16 * data, std::string &
dis,
(table[i].type == call_instruction) ||
(table[i].type == branch_instruction) ||
(table[i].type == return_instruction)) {
- if ((table[i].attributes != 0) &&
- (m_requested_instruction_categories &
- table[i].attributes) == 0) {
- /*
- * failed due to instruction having
- * an ASE attribute and the requested version
- * not having that attribute
- */
- dis = "ASE attribute mismatch";
- return -5;
- }
disassembly_function dis_fn = table[i].disassembly;
if (dis_fn == 0) {
dis = "disassembler failure - bad table entry";
diff --git a/disas/nanomips.h b/disas/nanomips.h
index f65a0957b8..5bdfe1e30b 100644
--- a/disas/nanomips.h
+++ b/disas/nanomips.h
@@ -65,9 +65,8 @@ class NMD
{
public:
- NMD(img_address pc, TABLE_ATTRIBUTE_TYPE requested_instruction_categories)
+ NMD(img_address pc)
: m_pc(pc)
- , m_requested_instruction_categories(requested_instruction_categories)
{
}
@@ -77,7 +76,6 @@ public:
private:
img_address m_pc;
- TABLE_ATTRIBUTE_TYPE m_requested_instruction_categories;
typedef std::string(NMD:: *disassembly_function)(uint64 instruction);
typedef bool(NMD:: *conditional_function)(uint64 instruction);
--
2.25.1
- [PATCH v3 0/24] Convert nanoMIPS disassembler from C++ to C, Milica Lazarevic, 2022/09/12
- [PATCH v3 02/24] disas/nanomips: Extract enums out of the NMD class, Milica Lazarevic, 2022/09/12
- [PATCH v3 01/24] disas/nanomips: Remove namespace img, Milica Lazarevic, 2022/09/12
- [PATCH v3 05/24] disas/nanomips: Remove helper methods from class, Milica Lazarevic, 2022/09/12
- [PATCH v3 06/24] disas/nanomips: Remove __cond methods from class, Milica Lazarevic, 2022/09/12
- [PATCH v3 03/24] disas/nanomips: Delete NMD class field,
Milica Lazarevic <=
- [PATCH v3 04/24] disas/nanomips: Delete NMD class second field, Milica Lazarevic, 2022/09/12
- [PATCH v3 08/24] disas/nanomips: Remove Pool tables from the class, Milica Lazarevic, 2022/09/12
- [PATCH v3 07/24] disas/nanomips: Remove disasm methods from class, Milica Lazarevic, 2022/09/12
- [PATCH v3 09/24] disas/nanomips: Remove NMD class, Milica Lazarevic, 2022/09/12
- [PATCH v3 10/24] disas/nanomips: Move typedefs etc to nanomips.cpp, Milica Lazarevic, 2022/09/12
- [PATCH v3 11/24] disas/nanomips: Delete nanomips.h, Milica Lazarevic, 2022/09/12
- [PATCH v3 12/24] disas/nanomips: Remove #inlcude <sstream>, Milica Lazarevic, 2022/09/12
- [PATCH v3 14/24] disas/nanomips: Delete wrapper functions, Milica Lazarevic, 2022/09/12