This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: RFC: PowerPC GAS changes
- To: fray at mvista dot com
- Subject: Re: RFC: PowerPC GAS changes
- From: Geoff Keating <geoffk at cygnus dot com>
- Date: Wed, 6 Sep 2000 15:20:15 -0700
- CC: binutils at sourceware dot cygnus dot com
- References: <39B6C148.4474C805@mvista.com>
> Date: Wed, 06 Sep 2000 15:12:24 -0700
> From: Mark Hatle <fray@mvista.com>
> 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?
There is support for doing this kind of thing already. For instance,
try using the POWER instruction 'mfmq' with -mppc:
[geoffk@envy geoffk]$ cat > t.s
mfmq %r3
[geoffk@envy geoffk]$ as -m601 t.s -o t.o
[geoffk@envy geoffk]$ as -mpwr t.s -o t.o
[geoffk@envy geoffk]$ as -mppc t.s -o t.o
t.s: Assembler messages:
t.s:1: Error: Unrecognized opcode: `mfmq'
it's just a question of getting the flag arrangement right.
--
- Geoffrey Keating <geoffk@cygnus.com>