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]

Re: local alloc / global alloc / reload problem


> So what happened before the regmove change in terms of global alloc
> and reload?  ie, what hard reg was pseudo 28 assigned to?  Presumably
> that hard reg did not end up being used as a spill.

With the old regmove:

(insn 29 27 31 (set (reg:SI 28)
        (xor:SI (reg/v:SI 21)
            (const_int 1))) -1 (nil)
    (nil))

(insn 31 29 33 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
        (reg:SI 28)) -1 (insn_list 29 (nil))
    (expr_list:REG_DEAD (reg:SI 28)
        (nil)))

is turned into (in other words ... no change):

(insn 29 27 31 (set (reg:SI 28)
        (xor:SI (reg/v:SI 21)
            (const_int 1))) 189 {xorsi3} (nil)
    (nil))

(insn 31 29 33 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
        (reg:SI 28)) 50 {movsi-2} (insn_list 29 (nil))
    (expr_list:REG_DEAD (reg:SI 28)
        (nil)))

Local register allocation allocates hard register 0 for reg 28.
Global register allocation is performed and reload is called.  Hard
register 0 is spilled placing reg 28 on the stack.  Reload notices
that the xor needs fixing since the RTL template is:

  [(set (match_operand:SI 0 "nonimmediate_operand" "=rm,r")
	(xor:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
		(match_operand:SI 2 "general_operand" "ri,rm")))]

The result after global register allocation and reload is:

(insn 281 27 29 (set (reg:SI 1 %edx)
        (mem:SI (plus:SI (reg:SI 6 %ebp)
                (const_int 8)))) 54 {movsi+2} (nil)
    (nil))

(insn:HI 29 281 31 (set (reg:SI 1 %edx)
        (xor:SI (reg:SI 1 %edx)
            (const_int 1))) 189 {xorsi3} (nil)
    (nil))

(insn:QI 31 29 33 (set (mem:SI (pre_dec:SI (reg:SI 7 %esp)))
        (reg:SI 1 %edx)) 50 {movsi-2} (insn_list 29 (nil))
    (expr_list:REG_DEAD (reg:SI 1 %edx)
        (nil)))

The difference is that with the new regmove reload didn't need to
fix up the xor so it left reg 28 on the stack.  With the old regmove
reload needs to fix up the xor which results in a register being
used.

-- John Wehle
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



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