This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

post_modify and reload


I am working on a processor port that is more restrictive about what is
allowed when using post_modify. My architecture requires that index
registers only modify the base register they are paired with. (i.e.
base reg 0 can only be modified by index reg 0.) The current
find_reloads_address_1 does not support this restriction, it reloads
the base register and index register separately, making sure that they
are each in BASE_REG_CLASS and INDEX_REG_CLASS. I have figured out a
way of modifying the function so that it does a push_reload passing a
class which only has the correct base register in it to go with the
previously selected index register. That works and I get correct code.
The problem is that GCC moves the value into the register immediately
before use, and out immediately after.

(insn 95 25 26 1 0x0 (set (reg:HI 9 a1)
        (reg/v/f:HI 8 a0 [32])) 3 {*match_movhi} (nil)
    (expr_list:REG_DEAD (reg/v/f:HI 8 a0 [32])
        (nil)))

(insn 26 95 96 1 0x1a243390 (set (reg:HI 4 d0 [37])
        (mem:HI (post_modify:HI (reg:HI 9 a1)
                (plus:HI (reg:HI 9 a1)
                    (reg:HI 17 m1 [40]))) [3 S2 A16])) 3 {*match_movhi} (insn_list 95 (nil))
    (expr_list:REG_INC (reg:HI 9 a1)
        (nil)))

(insn 96 26 27 1 0x0 (set (reg/v/f:HI 8 a0 [32])
        (reg:HI 9 a1)) 3 {*match_movhi} (insn_list 26 (nil))
    (expr_list:REG_DEAD (reg:HI 9 a1)
        (nil)))

This would not be such a big problem, except that these extra two
moves are emitted inside an inner loop, what's worse is that a0 is
dead at the end of the loop and a1 is never used within the function.

So my question to you all is: Now that I have correct code, can
someone point me in the direction of how to make this code a bit more
efficient?

Thank you.
Jonah

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]