Hello,

I have a problem with reload. I am working on a private variation of the i386
port. I am using GCC 4.1.2.

The insn

(insn 38 36 39 1 x.c:30 (parallel [
            (set (reg:SI 2 cx [80])
                (ashift:SI (reg:SI 6 bp [81])
                    (subreg:QI (reg:SI 1 dx [78]) 3)))
            (clobber (reg:CC 17 flags))
        ]) 409 {*ashlsi3_1} (insn_list:REG_DEP_TRUE 36 (nil))
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_DEAD (reg:SI 1 dx [78])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))

gets the reloads

Reloads for insn # 38
Reload 0: reload_in (SI) = (reg:SI 6 bp [81])
        reload_out (SI) = (reg:SI 2 cx [80])
        GENERAL_REGS, RELOAD_OTHER (opnum = 0)
        reload_in_reg: (reg:SI 6 bp [81])
        reload_out_reg: (reg:SI 2 cx [80])
        reload_reg_rtx: (reg:SI 2 cx [80])
Reload 1: reload_in (QI) = (reg:QI 1 dx)
        CREG, RELOAD_FOR_INPUT (opnum = 2), can't combine
        reload_in_reg: (subreg:QI (reg:SI 1 dx [78]) 3)

and reload fails later down beacuse it cannot find a register for the Reload 1.
The register "cx" is the only register in class CREG, and it is already taken
for Reload 0.

That Reload has class GENERAL_REGS, but find_dummy_reload decided to use the
output register as the reload register.

What is the best correction for the problem? I can think of three possible
solutions:
1. Avoid using a critical register in find_dummy_reload. Before choosing the
   register check whether it is in a small register class.
2. In find_reload_regs, recover from a situation when no register could be
   found. Remove the reload registers already fixed by find_dummy_reload and try
   again.
3. Have an additional check between find_reloads and find_reload_regs. Check
   whether any reload class is a small register class. If so, check the other
   reloads whether they have taken a register of that class. Remove the register
   assignment in case of a conflict.

Thanks in advance,

        Erwin

--
Erwin Unruh
IP SW LP AD 2
Fujitsu Siemens Computers GmbH
Domagkstrasse 28
D-80807 München

Telefon:                +49 (0)89 3222 3825
Telefax:                +49 (0)89 3222 3802
Email:          mailto:[EMAIL PROTECTED]
Internet:               http://www.fujitsu-siemens.de
Firmenangaben:  http://www.fujitsu-siemens.de/imprint.html

Reply via email to