[llvm-commits] PATCH: Tablegen - Add HWEncoding field to Register class and generate getHWEncoding() function

Tom Stellard thomas.stellard at amd.com
Fri May 4 14:22:33 PDT 2012


On Fri, May 04, 2012 at 10:09:24PM +0100, Tim Northover wrote:
> > The attached patch causes tablegen with the -gen-register-info flag to
> > generate a getHWEncoding function that returns the encoding for the given
> > register.  This is useful for targets like R600 that have hundreds of
> > registers, which makes it very tedious to write a function like this by
> > hand.
> 
> Don't suppose I could convince you to do the reverse mapping too? Or
> does R600 not need that? Obviously it would be with respect to a given
> register class, but I've always considered "bitwise-encoding+RegClass
> -> LLVM register" the uglier set of functions.

I'm not sure reverse mapping would be useful for R600, but it shouldn't
be too hard to add.  What would a reverse mapping be used for?  Disassembly?

> 
> Other than that, I'm not really a reviewer I'm afraid so just consider
> this biekshedding if you want, but for what it's worth:
>   * I do like the name "HWEncoding" over the recently removed "Num" field.
>   * Tests or documentation would be good. Particularly as R600 isn't
> in tree yet, I can't see how anyone would find out about this nice
> feature without it.

I submitted the R600 backend for review to the list several weeks ago,
but I'm still waiting for reviews.  In the mean time, I've
pushed an updated R600 branch that uses this new functionality
here: http://cgit.freedesktop.org/~tstellar/llvm/ r600-tablegen-reg-encoding

-Tom

> 
> Tim.
> 





More information about the llvm-commits mailing list