[pypy-dev] PPC backend design questions

Michael Hudson-Doyle micahel at gmail.com
Wed Aug 10 15:34:17 CEST 2011


On Aug 10, 2011 2:23 PM, "David Edelsohn" <dje.gcc at gmail.com> wrote:
>
> On Wed, Aug 10, 2011 at 4:26 AM, Michael Hudson-Doyle <micahel at gmail.com> wrote:
>
> > There are already fields that behave in unusual ways -- see
> >
> > https://bitbucket.org/pypy/pypy/src/f8c92c646275/pypy/jit/backend/ppc/ppcgen/ppc_field.py#cl-55
> >
> > I think you should be able to add your fields in this fashion -- in
> > fact, the IField looks a teensy bit like how the displacement field
> > should be already.  The split encodings should be fairly easy too,
> > although there might be some paranoid code checking that fields don't
> > overlap that you need to change.
>
> Yes and no.  The ds displacement field for 64 bit loads is similar to
> the LI field of branches.  But the shift fields are not like the spr
> field -- the value is split between multiple fields with different bit
> ranges, not just permuted within the field.

Well sure, but at the end of the day the instruction is assembled by
doing roughly this:

insn = 0
for field in fields:
    insn |= field.encode()

-- nothing prevents a field returning a value that is split between
multiple bit ranges.  There is a bit of scaffolding that assumes
contiguous bit ranges but nothing fundamental (and as I said, I think
this is mostly for checking that fields don't overlap, and there would
be other ways of doing that).

Cheers,
mwh


More information about the pypy-dev mailing list