On Mon, Jul 22, 2019 at 12:42:13AM -0500, Segher Boessenkool wrote: > Hi! > > On Sat, Jul 20, 2019 at 12:13:08PM -0400, Michael Meissner wrote: > > 2019-07-20 Michael Meissner <meiss...@linux.ibm.com> > > > > * config/rs6000/rs6000-internal.h (rs6000_hard_regno_mode_ok_p): > > Move various declarations relating to addressing and register > > allocation to rs6000-internal.h from rs6000.c so that in the > > future we can move things out of rs6000.c. > > Just say > (rs6000_hard_regno_mode_ok_p): New declaration. > for the things that only had a definition before. > > > Make the static arrays global, > > That's not this entry. Say that in the entries where it applies. > > > and define them in rs6000.c. > > Say that in the corresponding entry for rs6000.c . > > > (enum rs6000_reg_type): Likewise. > > This one always was a declaration.
This was a mechanical patch, just moving the swath of code from rs6000.c to rs6000-internal.h. > (... ten gazillion "Likewise." ...) > Most of those are *not* the same thing. Don't say "likewise" if not > the same comment applies. > > If it is hard to write a proper changelog, your patch series probably > could use some restructuring. Or sometimes the changelog you need just > is more work than you would prefer. > > You don't necessarily have to keep the same order in the changelog as > in the patch, if that helps. But roughly the same order helps review, > so please consider that too ;-) Well yes, while in general I would prefer to group things logically together for ChangeLog, I don't tend to do it because as you say it makes it easier for the review. > We haven't had GO_IF_LEGITIMATE_ADDRESS for ten years now, please don't > introduce new references to it ;-) Yep. > > +#define RELOAD_REG_VALID 0x0001 /* Mode valid in register.. */ > > +#define RELOAD_REG_MULTIPLE 0x0002 /* Mode takes multiple > > registers. */ > > +#define RELOAD_REG_INDEXED 0x0004 /* Reg+reg addressing. */ > > +#define RELOAD_REG_OFFSET 0x0008 /* Reg+offset addressing. */ > > +#define RELOAD_REG_PRE_INCDEC 0x0010 /* PRE_INC/PRE_DEC valid. */ > > +#define RELOAD_REG_PRE_MODIFY 0x0020 /* PRE_MODIFY valid. */ > > +#define RELOAD_REG_AND_M16 0x0040 /* AND -16 addressing. */ > > +#define RELOAD_REG_QUAD_OFFSET 0x0080 /* quad offset is limited. */ > > Why all the extra zeroes? If you introduce some 0x100 later, just leave > the 0x80 as 0x80 please, that is much more readable. As I mentioned, I will be adding at least one new bit (RELOAD_REG_DS_OFFSET), but I have potential patches that add a few more (those are still in flux), and those would need the extra column. I personally DO NOT find mask definitions like: #define RELOAD_REG_VALID 0x01 /* Mode valid in register.. */ #define RELOAD_REG_MULTIPLE 0x02 /* Mode takes multiple registers. */ #define RELOAD_REG_INDEXED 0x04 /* Reg+reg addressing. */ #define RELOAD_REG_OFFSET 0x08 /* Reg+offset addressing. */ #define RELOAD_REG_PRE_INCDEC 0x10 /* PRE_INC/PRE_DEC valid. */ #define RELOAD_REG_PRE_MODIFY 0x20 /* PRE_MODIFY valid. */ #define RELOAD_REG_AND_M16 0x40 /* AND -16 addressing. */ #define RELOAD_REG_QUAD_OFFSET 0x80 /* quad offset is limited. */ #define RELOAD_REG_DS_OFFSET 0x100 /* bottom 2 bits must be zero. */ to be readable. So in change, I can go back to just: #define RELOAD_REG_VALID 0x01 /* Mode valid in register.. */ #define RELOAD_REG_MULTIPLE 0x02 /* Mode takes multiple registers. */ #define RELOAD_REG_INDEXED 0x04 /* Reg+reg addressing. */ #define RELOAD_REG_OFFSET 0x08 /* Reg+offset addressing. */ #define RELOAD_REG_PRE_INCDEC 0x10 /* PRE_INC/PRE_DEC valid. */ #define RELOAD_REG_PRE_MODIFY 0x20 /* PRE_MODIFY valid. */ #define RELOAD_REG_AND_M16 0x40 /* AND -16 addressing. */ #define RELOAD_REG_QUAD_OFFSET 0x80 /* quad offset is limited. */ And in the next patch, change it all to: #define RELOAD_REG_VALID 0x001 /* Mode valid in register.. */ #define RELOAD_REG_MULTIPLE 0x002 /* Mode takes multiple registers. */ #define RELOAD_REG_INDEXED 0x004 /* Reg+reg addressing. */ #define RELOAD_REG_OFFSET 0x008 /* Reg+offset addressing. */ #define RELOAD_REG_PRE_INCDEC 0x010 /* PRE_INC/PRE_DEC valid. */ #define RELOAD_REG_PRE_MODIFY 0x020 /* PRE_MODIFY valid. */ #define RELOAD_REG_AND_M16 0x040 /* AND -16 addressing. */ #define RELOAD_REG_QUAD_OFFSET 0x080 /* quad offset is limited. */ #define RELOAD_REG_DS_OFFSET 0x100 /* bottom 2 bits must be 0. */ Some time later if I continue with the current code, that would be changed to: #define RELOAD_REG_VALID 0x0001 /* Mode valid in register.. */ #define RELOAD_REG_MULTIPLE 0x0002 /* Mode takes multiple registers. */ #define RELOAD_REG_INDEXED 0x0004 /* Reg+reg addressing. */ #define RELOAD_REG_OFFSET 0x0008 /* Reg+offset addressing. */ #define RELOAD_REG_PRE_INCDEC 0x0010 /* PRE_INC/PRE_DEC valid. */ #define RELOAD_REG_PRE_MODIFY 0x0020 /* PRE_MODIFY valid. */ #define RELOAD_REG_AND_M16 0x0040 /* AND -16 addressing. */ #define RELOAD_REG_QUAD_OFFSET 0x0080 /* DQ-form (bottom 4 bits 0). */ #define RELOAD_REG_DS_OFFSET 0x0100 /* DS-form (bottom 2 bits 0). */ /* The following are flags used in address decoding, but are not currently stored in the addr_mask field of reg_addr. */ #define RELOAD_REG_SINGLE 0x0200 /* Address is a single register. */ #define RELOAD_REG_IS_PREFIXED 0x0400 /* Address uses prefix encoding. */ #define RELOAD_REG_NOT_PREFIXED 0x0800 /* Address does not use a prefix. */ #define RELOAD_REG_PCREL_LOCAL 0x1000 /* Pc-relative to local symbol. */ #define RELOAD_REG_PCREL_EXT 0x2000 /* Pc-relative to external symbol. */ #define RELOAD_REG_LO_SUM 0x4000 /* Address uses LO_SUM (TOC, etc). */ I was just trying to save a step since I was moving the definitions any way to add the alignment. > > It's hard to tell whether the problem is factored sanely, or if this > creates a big mountain of spaghetti instead. Can you show how this is > used later? The intention is to move bits to other files. In particular, I want to create a new rs6000-prefixed.c file that contains the bits specific to prefixed addressing. However, a lot of the bits need access to the reg_addr array. When you have the reg_addr array, all of the mode_supports_* functions also become useful in the other files. In addition to reg_array, the code that determines if something is a traditional instruction or a prefixed instruction needs the register type classificiation (rs6000_reg_type). The issue is in some instructions it depends on whether the offset is an instruction using the DS encoding or D encoding. For example, loading floating point scalars to a traditional FPR register uses the D encoding, but loading floating point scalars to an altivec register uses the DS encoding. However, longer term, it would be nice to move other things from rs6000.c to other files, such as the functions that deal with p8 fusion, and the legitimate address functions (which I still tend to mentally classify as GO_IF_LEGITIMATE type functions, even as you mention, we no longer have GO_IF_LEGITIMATE*). > Normally, you send a whole series, and then perhaps many of the first > are preparatory only, but a reviewer can see where things are headed, > and *then* simple refactorings like this can make sense. The way this > patch looks now you are just making a lot of data global. This was intended to be just a mechanical patch to move things to the .h file. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797