[patch] Enable power7 disassembling

Peter Bergner bergner@vnet.ibm.com
Sat Mar 7 05:59:00 GMT 2009


On Sat, 2009-03-07 at 10:48 +1030, Alan Modra wrote:
> On Fri, Mar 06, 2009 at 07:23:51AM -0600, Peter Bergner wrote:
> > I guess there's still the question of why -Many didn't print out
> > the extended mnemonic.  It is listed earlier in the table unlike
> > the earlier problems you found.  I'll have a look today.
> 
> No mystery there.  -Many works by first trying to disassemble using
> the instructions selected by any other options.  In these cases this
> succeeded.

Right, but there were no other explicit options, only -Many.  However, in
ppc-dis.c:powerpc_init_dialect(), there is a long "if else if else if..."
sequence that ends in a:

  else
    dialect |= (PPC_OPCODE_403 | PPC_OPCODE_601 | PPC_OPCODE_CLASSIC
                | PPC_OPCODE_COMMON | PPC_OPCODE_ALTIVEC);

Since "any" isn't one of the conditions tested for in the sequence
of "if else if...", we basically get the implicit options above.
Later, you, I and others added the tests for power4, power5, power6
power7, cell and "any" after this, so they too would include the cpu
flags above during their disassembly.  Seems kind of odd to me that
we can disassemble 403 mnemonics with -Mpower4, etc.

I think this "default" cpu flags was probably an oversight and that
we should combine the power4, power5, etc. "if" tests into the chain
of "if else if..." sequence.

It also seems like ppc-dis.c:powerpc_init_dialect() and tc-ppc.c:parse_cpu()
are basically doing the same thing and that they could be combined.  It also
looks like tc-ppc.c:parse_cpu() has a more complete listing of cpus than
ppc-dis.c:powerpc_init_dialect()'s limited list.

Alan, does this look like something that should be cleaned up, or do we just
leave well enough alone?

Peter





More information about the Binutils mailing list