From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Stefan Pejic" <stefan.pejic@syrmia.com>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Paul Burton" <paulburton@kernel.org>,
"Milica Lazarevic" <milica.lazarevic@syrmia.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PULL 20/55] disas/nanomips: Remove __cond methods from class
Date: Sun, 30 Oct 2022 23:28:06 +0100 [thread overview]
Message-ID: <20221030222841.42377-21-philmd@linaro.org> (raw)
In-Reply-To: <20221030222841.42377-1-philmd@linaro.org>
From: Milica Lazarevic <milica.lazarevic@syrmia.com>
NMD class methods with the conditional_function type like
NMD::ADDIU_32__cond, NMD::ADDIU_RS5__cond, etc. are removed from the NMD
class. They're now declared global static functions. Therefore, typedef
of the function pointer, conditional_function is defined outside of the
class.
Now that conditional_function type functions are not part of the NMD
class we can't access them using the this pointer. Thus, the use of
the this pointer has been deleted.
Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220912122635.74032-7-milica.lazarevic@syrmia.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
disas/nanomips.cpp | 42 +++++++++++++++++++++---------------------
disas/nanomips.h | 14 ++------------
2 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 271afcde07..98a632a3fc 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -784,7 +784,7 @@ int NMD::Disassemble(const uint16 * data, std::string & dis,
if ((op_code & table[i].mask) == table[i].value) {
/* possible match */
conditional_function cond = table[i].condition;
- if ((cond == 0) || (this->*cond)(op_code)) {
+ if ((cond == NULL) || cond(op_code)) {
try
{
if (table[i].type == pool) {
@@ -1672,28 +1672,28 @@ static uint64 extract_u_3_2_1_0__s1(uint64 instruction)
-bool NMD::ADDIU_32__cond(uint64 instruction)
+static bool ADDIU_32__cond(uint64 instruction)
{
uint64 rt = extract_rt_25_24_23_22_21(instruction);
return rt != 0;
}
-bool NMD::ADDIU_RS5__cond(uint64 instruction)
+static bool ADDIU_RS5__cond(uint64 instruction)
{
uint64 rt = extract_rt_9_8_7_6_5(instruction);
return rt != 0;
}
-bool NMD::BALRSC_cond(uint64 instruction)
+static bool BALRSC_cond(uint64 instruction)
{
uint64 rt = extract_rt_25_24_23_22_21(instruction);
return rt != 0;
}
-bool NMD::BEQC_16__cond(uint64 instruction)
+static bool BEQC_16__cond(uint64 instruction)
{
uint64 rs3 = extract_rs3_6_5_4(instruction);
uint64 rt3 = extract_rt3_9_8_7(instruction);
@@ -1702,7 +1702,7 @@ bool NMD::BEQC_16__cond(uint64 instruction)
}
-bool NMD::BNEC_16__cond(uint64 instruction)
+static bool BNEC_16__cond(uint64 instruction)
{
uint64 rs3 = extract_rs3_6_5_4(instruction);
uint64 rt3 = extract_rt3_9_8_7(instruction);
@@ -1711,35 +1711,35 @@ bool NMD::BNEC_16__cond(uint64 instruction)
}
-bool NMD::MOVE_cond(uint64 instruction)
+static bool MOVE_cond(uint64 instruction)
{
uint64 rt = extract_rt_9_8_7_6_5(instruction);
return rt != 0;
}
-bool NMD::P16_BR1_cond(uint64 instruction)
+static bool P16_BR1_cond(uint64 instruction)
{
uint64 u = extract_u_3_2_1_0__s1(instruction);
return u != 0;
}
-bool NMD::PREF_S9__cond(uint64 instruction)
+static bool PREF_S9__cond(uint64 instruction)
{
uint64 hint = extract_hint_25_24_23_22_21(instruction);
return hint != 31;
}
-bool NMD::PREFE_cond(uint64 instruction)
+static bool PREFE_cond(uint64 instruction)
{
uint64 hint = extract_hint_25_24_23_22_21(instruction);
return hint != 31;
}
-bool NMD::SLTU_cond(uint64 instruction)
+static bool SLTU_cond(uint64 instruction)
{
uint64 rd = extract_rd_15_14_13_12_11(instruction);
return rd != 0;
@@ -16692,7 +16692,7 @@ NMD::Pool NMD::P_ADDIU[2] = {
0xffe00000, 0x00000000, 0 , 0,
0x0 }, /* P.RI */
{ instruction , 0 , 0 , 32,
- 0xfc000000, 0x00000000, &NMD::ADDIU_32_ , &NMD::ADDIU_32__cond ,
+ 0xfc000000, 0x00000000, &NMD::ADDIU_32_ , &ADDIU_32__cond ,
0x0 }, /* ADDIU[32] */
};
@@ -16790,7 +16790,7 @@ NMD::Pool NMD::P_SLTU[2] = {
0xfc00fbff, 0x20000390, 0 , 0,
0x0 }, /* P.DVP */
{ instruction , 0 , 0 , 32,
- 0xfc0003ff, 0x20000390, &NMD::SLTU , &NMD::SLTU_cond ,
+ 0xfc0003ff, 0x20000390, &NMD::SLTU , &SLTU_cond ,
0x0 }, /* SLTU */
};
@@ -21335,7 +21335,7 @@ NMD::Pool NMD::P_PREF_S9_[2] = {
0xffe07f00, 0xa7e01800, &NMD::SYNCI , 0,
0x0 }, /* SYNCI */
{ instruction , 0 , 0 , 32,
- 0xfc007f00, 0xa4001800, &NMD::PREF_S9_ , &NMD::PREF_S9__cond ,
+ 0xfc007f00, 0xa4001800, &NMD::PREF_S9_ , &PREF_S9__cond ,
0x0 }, /* PREF[S9] */
};
@@ -21547,7 +21547,7 @@ NMD::Pool NMD::P_PREFE[2] = {
0xffe07f00, 0xa7e01a00, &NMD::SYNCIE , 0,
CP0_ | EVA_ }, /* SYNCIE */
{ instruction , 0 , 0 , 32,
- 0xfc007f00, 0xa4001a00, &NMD::PREFE , &NMD::PREFE_cond ,
+ 0xfc007f00, 0xa4001a00, &NMD::PREFE , &PREFE_cond ,
CP0_ | EVA_ }, /* PREFE */
};
@@ -21719,7 +21719,7 @@ NMD::Pool NMD::P_BALRSC[2] = {
0xffe0f000, 0x48008000, &NMD::BRSC , 0,
0x0 }, /* BRSC */
{ call_instruction , 0 , 0 , 32,
- 0xfc00f000, 0x48008000, &NMD::BALRSC , &NMD::BALRSC_cond ,
+ 0xfc00f000, 0x48008000, &NMD::BALRSC , &BALRSC_cond ,
0x0 }, /* BALRSC */
};
@@ -22067,7 +22067,7 @@ NMD::Pool NMD::P16_MV[2] = {
0xffe0 , 0x1000 , 0 , 0,
0x0 }, /* P16.RI */
{ instruction , 0 , 0 , 16,
- 0xfc00 , 0x1000 , &NMD::MOVE , &NMD::MOVE_cond ,
+ 0xfc00 , 0x1000 , &NMD::MOVE , &MOVE_cond ,
0x0 }, /* MOVE */
};
@@ -22133,7 +22133,7 @@ NMD::Pool NMD::P_ADDIU_RS5_[2] = {
0xffe8 , 0x9008 , &NMD::NOP_16_ , 0,
0x0 }, /* NOP[16] */
{ instruction , 0 , 0 , 16,
- 0xfc08 , 0x9008 , &NMD::ADDIU_RS5_ , &NMD::ADDIU_RS5__cond ,
+ 0xfc08 , 0x9008 , &NMD::ADDIU_RS5_ , &ADDIU_RS5__cond ,
0x0 }, /* ADDIU[RS5] */
};
@@ -22170,10 +22170,10 @@ NMD::Pool NMD::P16_JRC[2] = {
NMD::Pool NMD::P16_BR1[2] = {
{ branch_instruction , 0 , 0 , 16,
- 0xfc00 , 0xd800 , &NMD::BEQC_16_ , &NMD::BEQC_16__cond ,
+ 0xfc00 , 0xd800 , &NMD::BEQC_16_ , &BEQC_16__cond ,
XMMS_ }, /* BEQC[16] */
{ branch_instruction , 0 , 0 , 16,
- 0xfc00 , 0xd800 , &NMD::BNEC_16_ , &NMD::BNEC_16__cond ,
+ 0xfc00 , 0xd800 , &NMD::BNEC_16_ , &BNEC_16__cond ,
XMMS_ }, /* BNEC[16] */
};
@@ -22183,7 +22183,7 @@ NMD::Pool NMD::P16_BR[2] = {
0xfc0f , 0xd800 , 0 , 0,
0x0 }, /* P16.JRC */
{ pool , P16_BR1 , 2 , 16,
- 0xfc00 , 0xd800 , 0 , &NMD::P16_BR1_cond ,
+ 0xfc00 , 0xd800 , 0 , &P16_BR1_cond ,
0x0 }, /* P16.BR1 */
};
diff --git a/disas/nanomips.h b/disas/nanomips.h
index 8eca843ef0..af803f4cc0 100644
--- a/disas/nanomips.h
+++ b/disas/nanomips.h
@@ -64,6 +64,8 @@ typedef struct Dis_info {
img_address m_pc;
} Dis_info;
+typedef bool (*conditional_function)(uint64 instruction);
+
class NMD
{
public:
@@ -75,7 +77,6 @@ private:
typedef std::string(NMD:: *disassembly_function)(uint64 instruction,
Dis_info *info);
- typedef bool(NMD:: *conditional_function)(uint64 instruction);
struct Pool {
TABLE_ENTRY_TYPE type;
@@ -94,17 +95,6 @@ private:
TABLE_ENTRY_TYPE & type, const Pool *table, int table_size,
Dis_info *info);
- bool ADDIU_32__cond(uint64 instruction);
- bool ADDIU_RS5__cond(uint64 instruction);
- bool BALRSC_cond(uint64 instruction);
- bool BEQC_16__cond(uint64 instruction);
- bool BNEC_16__cond(uint64 instruction);
- bool MOVE_cond(uint64 instruction);
- bool P16_BR1_cond(uint64 instruction);
- bool PREF_S9__cond(uint64 instruction);
- bool PREFE_cond(uint64 instruction);
- bool SLTU_cond(uint64 instruction);
-
std::string ABS_D(uint64 instruction, Dis_info *info);
std::string ABS_S(uint64 instruction, Dis_info *info);
std::string ABSQ_S_PH(uint64 instruction, Dis_info *info);
--
2.37.3
next prev parent reply other threads:[~2022-10-30 22:35 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-30 22:27 [PULL 00/55] MIPS patches for 2022-10-30 Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 01/55] hw/isa/vt82c686: Resolve chip-specific realize methods Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 02/55] hw/isa/vt82c686: Resolve unneeded attribute Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 03/55] hw/isa/vt82c686: Prefer pci_address_space() over get_system_memory() Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 04/55] hw/isa/vt82c686: Reuse errp Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 05/55] hw/isa/vt82c686: Introduce TYPE_VIA_IDE define Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 06/55] hw/isa/vt82c686: Instantiate IDE function in host device Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 07/55] hw/isa/vt82c686: Introduce TYPE_VT82C686B_USB_UHCI define Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 08/55] hw/isa/vt82c686: Instantiate USB functions in host device Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 09/55] hw/isa/vt82c686: Instantiate PM function " Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 10/55] hw/isa/vt82c686: Instantiate AC97 and MC97 functions " Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 11/55] hw/mips/fuloong2e: Inline vt82c686b_southbridge_init() and remove it Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 12/55] hw/isa/vt82c686: Embed RTCState in host device Philippe Mathieu-Daudé
2022-10-30 22:27 ` [PULL 13/55] hw/isa/vt82c686: Create rtc-time alias in boards instead Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 14/55] hw: Remove unused MAX_IDE_BUS define Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 15/55] disas/nanomips: Remove namespace img Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 16/55] disas/nanomips: Extract enums out of the NMD class Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 17/55] disas/nanomips: Delete NMD class field Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 18/55] disas/nanomips: Delete NMD class second field Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 19/55] disas/nanomips: Remove helper methods from class Philippe Mathieu-Daudé
2022-10-30 22:28 ` Philippe Mathieu-Daudé [this message]
2022-10-30 22:28 ` [PULL 21/55] disas/nanomips: Remove disasm " Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 22/55] disas/nanomips: Remove Pool tables from the class Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 23/55] disas/nanomips: Remove NMD class Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 24/55] disas/nanomips: Move typedefs etc to nanomips.cpp Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 25/55] disas/nanomips: Delete nanomips.h Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 26/55] disas/nanomips: Remove #include <sstream> Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 27/55] disas/nanomips: Delete copy functions Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 28/55] disas/nanomips: Delete wrapper functions Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 29/55] disas/nanomips: Replace std::string type Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 30/55] disas/nanomips: Remove IMMEDIATE functions Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 31/55] disas/nanomips: Remove CPR function Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 32/55] disas/nanomips: Prevent memory leaking Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 33/55] disas/nanomips: Remove function overloading Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 34/55] disas/nanomips: Expand Dis_info struct Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 35/55] disas/nanomips: Replace exception handling Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 36/55] disas/nanomips: Replace Cpp enums for C enums Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 37/55] disas/nanomips: Remove argument passing by ref Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 38/55] disas/nanomips: Rename nanomips.cpp to nanomips.c Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 39/55] disas/mips: Fix branch displacement for BEQZC and BNEZC Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 40/55] hw/i386/pc: Create DMA controllers in south bridges Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 41/55] hw/isa/piix3: Remove extra ';' outside of functions Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 42/55] hw/isa/piix3: Add size constraints to rcr_ops Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 43/55] hw/isa/piix3: Modernize reset handling Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 44/55] hw/isa/piix3: Prefer pci_address_space() over get_system_memory() Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 45/55] hw/isa/piix4: Rename wrongly named method Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 46/55] hw/ide/piix: Introduce TYPE_ macros for PIIX IDE controllers Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 47/55] hw/isa/piix3: Remove unused include Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 48/55] hw/mips/malta: Reuse dev variable Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 49/55] hw/isa/Kconfig: Fix dependencies of piix4 southbridge Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 50/55] hw/isa/piix4: Add missing initialization Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 51/55] hw/isa/piix4: Move pci_ide_create_devs() call to board code Philippe Mathieu-Daudé
2022-10-30 22:28 ` [PULL 52/55] hw/mips/boston: Don't set link_up for xilinx-pcie Philippe Mathieu-Daudé
2022-10-31 12:28 ` [PULL 00/55] MIPS patches for 2022-10-30 Philippe Mathieu-Daudé
2022-10-31 18:39 ` Stefan Hajnoczi
2022-11-08 13:59 ` Peter Maydell
2022-11-08 14:23 ` Philippe Mathieu-Daudé
2022-11-08 15:09 ` Thomas Huth
2022-11-08 15:23 ` Philippe Mathieu-Daudé
2022-11-08 17:56 ` Konstantin Kostiuk
2022-11-08 18:39 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221030222841.42377-21-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=aurelien@aurel32.net \
--cc=chenhuacai@kernel.org \
--cc=f4bug@amsat.org \
--cc=jiaxun.yang@flygoat.com \
--cc=milica.lazarevic@syrmia.com \
--cc=paulburton@kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefan.pejic@syrmia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).