This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFC: PowerPC GAS changes


Recently while adding the PPC405 instructions to the assembler I came
upon a problem with the PowerPC assembler.  From what I understand all
(32-Bit) PowerPC processors are treated as the same CPUs when it comes
to assembler instructions.

i.e. when you specify -m405 to gas, you can still use instructions that
don't exist on the 405 without so much as a warning.

IMHO, this is a serious bug which has caused developers who I have
talked to problems.  They think an instruction is legal and use it, the
assembler doesn't complain and their code gets an illegal instruction. 
(Simple to fix yes, but annoying that the assembler doesn't warn or
error.)

I propose a fix.  (Which I will do myself, I just want feedback if I'm
heading the right direction.)

1st, in the opcodes/ppc-opc.c set the "flags" attribute to the type of
instruction.  (Similar to what is there now, very little change)  PPC,
PPCOM, PWR, PWRCOM, etc.  However remove the PPC403, PPC405, PPC750, etc
instructions and set those to a new flag called "ANY" (or PPC?) to
indicate they are a PPC instruction or are not really a PPC or PWR
instruction.

2nd, add a new item to the data structure that contains flags for which
CPUs that instruction is NOT for.  So the default value (0) would be ok
for any CPU, as long as it fits in with the "flags".  That way I can set
on a per instruction basis if the instruction is for just a PPC403,
PPC405, PPC860, etc.; or even that the instruction is for everyone
except a given type.

This will have the effect of being able to control what instructions are
declared legal for the assember, and the disassember (objdump, or
anything else that uses opcodes/ppc-dis.c).  The only down side I see to
this is suddenly the table no longer fits on a standard 80 column line.

Suggestions?  Comments?

Thanks,
Mark Hatle

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]