2008/5/29 Jeff Law <[EMAIL PROTECTED]>: > Richard Sandiford wrote: >> >> Andy H <[EMAIL PROTECTED]> writes: >>>> >>>> If L_R_A does nothing with it, >>>> the normal reload handling will first try: >>>> >>>> (const:HI (plus:HI (symbol_ref:HI ("chk_fail_buf") (const_int 2)))) >>>> >>> >>> This worked just as your described after I added test of >>> reg_equiv_constant[] inside L_R_A . >>> >>> So I guess that looks like the fix for bug I posted. >>> >>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34641 >>> >>> To summarize >>> >>> LEGITIMIZE_RELOAD_ADDRESS should now always check reg_equiv_constant >>> before it trying to do any push_reload of register. >> >> TBH, I still think AVR is doing far too much in L_R_A. To quote >> the current version: > > [...] > Not only should there be some comments, those comments should clearly > explain how L_R_A is improving the generated code. That is LRA's job, to > implement target specific reload strategies which improve the generated > code. If the AVR port is using L_R_A for *correctness*, then the AVR port > is broken.
I wrote L_R_A for *correctness*, so in your terms AVR port is broken. It's because AVR have only 3 pointer registers (X,Y,Z) and only 2 of them Y and Z are base pointers. Y is a frame pointer, so only one general base pointer - Z. Offset also very limited -63 to +63. In L_R_A I play with POINTER_REGS (X,Y,Z) and BASE_POINTER_REGS (Y,Z). My experiments with reload show me that reload can't handle all difficult situations. Also, Jeff I know that you think that reload can. GCC havn't something like (define_address ...) and reload can't handle POINTER_REGS and BASE_POINTER_REGS differently. In my version of L_R_A I tried to do it. Denis.