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]

Live range splitting in new allocator



So, i've implemented live range splitting in the new allocator (it takes
up ~30 lines, thanks to the dataflow routines). However, cse keeps
raping me.
It works like this:
For each definition of a register besides the first, generate a new
pseudo, and replace all uses of *that* particular definition, with the new
pseudo, and then replace the definition so it uses the right register.

This works perfectly.
I then update *all* the info (because i've been trying to figure out why
this problem occurrs, updating more and more info as i go along).
This means, I reset the log_links and reg_notes, then do this:

  find_basic_blocks(get_insns(), max_reg_num(), rtl_dump_file);
  max_regno = max_reg_num();
  fprintf(stderr, "New max_regno:%d, max_reg_num():%d", max_regno, max_reg_num());
  reg_scan(get_insns(), max_reg_num(), 1);
  allocate_reg_info(max_regno, FALSE, TRUE);
  update_equiv_regs();
  cleanup_cfg (get_insns());
  count_or_remove_death_notes(0,1);
  update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
                      PROP_FINAL);
  regclass(get_insns(), max_reg_num(), rtl_dump_file);
  schedule_insns(rtl_dump_file);


We now properly allocate registers, including for the new pseudos.

After reload, but before reload_cse_regs, for one of the new pseudos, we
have this:

(insn 41 34 281 (set (reg:SI 4 [151])
        (const_int 0 [0x0])) 282 {*movsi_internal1} (nil)
    (nil))

After reload_cse_regs starts processing, something up and changes this to:
(insn 41 34 281 (set (reg:SI 805875168 [4])
        (const_int 0 [0x0])) 282 {*movsi_internal1} (nil)
    (nil))

It's already like that by the time it calls reload_cse_simplify on the
insn.
(gdb) c
Continuing.

Breakpoint 6, reload_cse_regs_1 (first=0x300926a0) at
../../gcc/reload1.c:8134
8134            reload_cse_simplify (insn);
(gdb) p debug_rtx(insn)

(jump_insn 23 22 24 (set (pc)
        (label_ref 175)) 467 {jump} (insn_list:REG_DEP_ANTI 21 (insn_list
22 (nil)))
    (nil))
$29 = void
(gdb) c
Continuing.

Breakpoint 6, reload_cse_regs_1 (first=0x300926a0) at
../../gcc/reload1.c:8134
8134            reload_cse_simplify (insn);
(gdb) p debug_rtx(insn)

(insn 41 34 281 (set (reg:SI 805875168 [4])
        (const_int 0 [0x0])) 282 {*movsi_internal1} (nil)
    (nil))
$30 = void


WTF is going on?

Something is turning the register numbers on the new pseudos to garbage.
It's not a memory overwrite, or at least, electricfence doesn't catch it.
If i remove the call to reload_cse_regs, something else turns it to the
same exact garbage a little later, etc.

It's really annoying me.
Am i generating the new pseudos wrong? I'm using gen_reg_rtx.

--dan


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