[pypy-dev] PPC backend design questions

David Edelsohn dje.gcc at gmail.com
Wed Aug 10 02:04:40 CEST 2011


The nop mnemonic is defined twice in ppc_assmbler.py:

In class PPCAssembler

    # F.9 Recommended Simplified Mnemonics

    nop = BA.ori(rS=0, rA=0, UIMM=0)

and in class PPCBuilder

    def nop(self):
        self.ori(0, 0, 0)

Which one should be removed?  I assume the one in PPCBuilder.


Some PPC64 instructions have complicated encodings that split operands
among multiple fields, such as shift immediate instructions, or
truncates fields, such as load and store displacements.  I implemented
the instructions exposing all of the fields, but that does not match
the way instructions are written in assembly language.  These aren't
simplified mnemonics.

For example,

    sradi 3, 4, 33

splits the shift count of the third operand between two fields in the
instruction representation.  Or

    ld 3, 0x8000(9)

does not place the displacement 0x8000 in the instruction, but shifts
the value by 2 bits -- displacements always are word aligned.  The
base address can be anything, so addresses themselves are not strictly
aligned, but the displacement is word aligned.  However, the
programmer does not write the shifted address.

My inclination is to implement the instructions the way they are
written by a programmer in PPCAssembler and change the names in
BasicPPCAssembler.  Is that reasonable and is there a precedent I
should use for the names?

Thanks, David


More information about the pypy-dev mailing list