[PATCH] powerpc: Add helper functions for synthesising instructions at runtime

Michael Ellerman michael at ellerman.id.au
Thu Oct 20 10:49:39 EST 2005


On Thu, 20 Oct 2005 08:53, Paul Mackerras wrote:
> Michael Ellerman writes:
> > +typedef enum {
> > +	BRANCH_RELATIVE,
> > +	BRANCH_RELATIVE_LINK,
> > +	BRANCH_ABSOLUTE,
> > +	BRANCH_ABSOLUTE_LINK
> > +} branch_t;
>
> Just to pursue this thread a bit further...
>
> I think your branch_t is folding together two things that are really
> orthogonal, and this is causing your code to get longer and more
> confusing than necessary.
>
> I would just have defined two separate flags, say BRANCH_ABSOLUTE and
> BRANCH_LINK (either with #define or enum), and then declared the
> "type" argument to create_branch as "bitwise".  Then you can simply OR
> the type argument into the instruction word, and you can do tests like
> if (!(type & BRANCH_ABSOLUTE)) quite naturally.
>
> This ends up being almost exactly what Segher suggested, but maybe
> a little less obfuscated.

OK, you're the boss.

We're going to have a very nice create_branch() macro at the end of this. On 
the other hand page.h might be a big pile of merge-poo, but no-one seems 
interested in it! :D

-- 
Michael Ellerman
IBM OzLabs

email: michael:ellerman.id.au
inmsg: mpe:jabber.org
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person



More information about the Linuxppc64-dev mailing list