[PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set

Bruno Larsen (billionai) posted 5 patches 4 years, 1 month ago
[PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
Posted by Bruno Larsen (billionai) 4 years, 1 month ago
Before this patch, when PPC_DUMP_CPU is set, oname is added to
opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
was set as well.

This patch changes it so those changes would happen when PPC_DUMP_CPU is
set, but not statistics, because the latter is being removed.

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 target/ppc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index ea200f9637..6c0f424d81 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -1345,7 +1345,7 @@ typedef struct opcode_t {
 /*****************************************************************************/
 /* PowerPC instructions table                                                */
 
-#if defined(DO_PPC_STATISTICS)
+#if defined(PPC_DUMP_CPU)
 #define GEN_OPCODE(name, op1, op2, op3, invl, _typ, _typ2)                    \
 {                                                                             \
     .opc1 = op1,                                                              \
-- 
2.17.1


RE: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
Posted by Luis Fernando Fujita Pires 4 years, 1 month ago
From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> Before this patch, when PPC_DUMP_CPU is set, oname is added to
> opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
> was set as well.
> 
> This patch changes it so those changes would happen when PPC_DUMP_CPU is
> set, but not statistics, because the latter is being removed.
> 
> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> ---
>  target/ppc/translate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I suggest removing dump_ppc_insns() altogether and 'oname' along with it.

Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.

Luis

Re: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
Posted by Richard Henderson 4 years, 1 month ago
On 5/26/21 2:13 PM, Luis Fernando Fujita Pires wrote:
> From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>> Before this patch, when PPC_DUMP_CPU is set, oname is added to
>> opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
>> was set as well.
>>
>> This patch changes it so those changes would happen when PPC_DUMP_CPU is
>> set, but not statistics, because the latter is being removed.
>>
>> Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
>> ---
>>   target/ppc/translate.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> I suggest removing dump_ppc_insns() altogether and 'oname' along with it.
> 
> Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.

Agreed.

r~

Re: [PATCH 1/5] target/ppc: fixed GEN_OPCODE behavior when PPC_DUMP_CPU is set
Posted by david@gibson.dropbear.id.au 4 years, 1 month ago
On Wed, May 26, 2021 at 02:24:51PM -0700, Richard Henderson wrote:
> On 5/26/21 2:13 PM, Luis Fernando Fujita Pires wrote:
> > From: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > > Before this patch, when PPC_DUMP_CPU is set, oname is added to
> > > opc_handler_t, but GEN_OPCODE* wouldn't set it unless DO_PPC_STATISTICS
> > > was set as well.
> > > 
> > > This patch changes it so those changes would happen when PPC_DUMP_CPU is
> > > set, but not statistics, because the latter is being removed.
> > > 
> > > Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
> > > ---
> > >   target/ppc/translate.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > I suggest removing dump_ppc_insns() altogether and 'oname' along with it.
> > 
> > Now that we're moving to decodetree, dump_ppc_insns() wouldn't show all the available opcodes anyway. And the only other locations where 'oname' is being used are when registering more than one handler for the same opcode by mistake, which won't happen anymore, as any new instructions should use decodetree.
> 
> Agreed.

I'll wait for a follow up doing this then.

> 
> r~
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson