Mark Shinwell wrote: > This code is guarded by > > /* I is nonneg if this reload used a register. > If rld[r].reg_rtx is 0, this is an optional reload > that we opted to ignore. */ > > if (i >= 0 && rld[r].reg_rtx != 0) > > and in this [my original] case, i is negative (see my original patch). > > I don't understand the "I is nonneg ..." comment above: the surrounding > code seems to say that i is actually non-negative if the reload used a > _spill_ register (rather than just any register). Bernd, could you > clarify the precise meaning of "spill register" in this context? I've > not yet managed to completely pin this down.
The term "spill register" is a bit of a historical artifact, and I think we may be getting close to the root cause here (and it seems to be my fault.) In the early days of gcc, when a register was spilled, it was spilled for the whole function and became a spill register that reload could use freely. That means that none of these spill registers would be selected during find_reloads, as they don't appear in the insn anymore. These days, we are more selective and don't spill hard regs for the entire function. It appears that spill_reg_index is only set up for registers that go through the choose_reload_regs process, not for the ones selected during find_reloads. That's probably a bad thing, as a reg_rtx chosen in find_reloads could be used as a spill reg in a previous insn (as in your example). Bernd -- This footer brought to you by insane German lawmakers. Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368 Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif