Post-reload life analysis, v2
Jeffrey A Law
Fri Oct 16 01:54:00 GMT 1998
In message <Pine.SOL.3.90.981008134917.2965Cfirstname.lastname@example.org
> Here's an updated patch for post-reload life analysis. This one should
> handle fixed regs, global regs and uneliminated regs properly by marking
> them as live everywhere and not creating death notes for them. It also
> fixes a minor problem where the previous patch would create a REG_UNUSED
> note for every call-clobbered reg, on every call insn, and one abort when
> it found a CLOBBER insn that was generated by reload outside of a basic
> I managed to build a Linux-2.1.124 kernel with this patch. glibc-2.0.96
> doesn't quite build, but that seems to be a different problem (an asm
> that needs too many reloads).
> For some reason, the part in jump.c already seems to have crept into the
> egcs repository, which is fortunately harmless. I've included it anyway
> in the patch.
> * jump.c (jump_optimize): Unconditionally use the code that was
> previously conditional on PRESERVE_DEATH_INFO_REGNO_P.
> * reload1.c (reload): When reloading is finished, delete all
> REG_DEAD and REG_UNUSED notes.
> (emit_reload_insns): Delete all code that was conditional on
> (eliminable_regs, eliminated_regs, not_eliminated_regs): New static
> (update_eliminables): Compute their values.
> (init_elim_table): Likewise.
> (set_regs, set_regs_nonote, used_regs, live_regs): New static
> (find_set_and_used_regs): New function.
> (calc_reg_usage): New function.
> (reload_life_analysis): New function.
> (no_longer_dead_regs): Delete variable.
> (reload_cse_delete_death_notes): Delete function.
> (reload_cse_no_longer_dead): Delete function.
> (reload_cse_regs_1): Delete all code to handle deletion of death
> (reload_cse_noop_set_p): Likewise.
> (reload_cse_simplify_set): Likewise.
> (reload_cse_simplify_operands): Likewise.
> (reload_cse_move2add): Likewise.
> * reorg.c (used_spill_regs): Delete declaration.
> (max_label_num_after_reload): Delete declaration.
> (find_dead_or_set_registers): Don't assume that spill regs are
> dead at a CODE_LABEL.
> * rtl.h (reload_life_analysis): Declare function.
> * rtlanal.c (dead_or_set_regno_p): Death notes are always accurate,
> even after reload.
> * sched.c (sched_analyze_insn): Likewise.
> (update_flow_info): Likewise.
> * haifa-sched.c (sched_analyze_insn): Likewise.
> (update_flow_info): Likewise.
> * tm.texi (PRESERVE_DEATH_INFO_REGNO_P): Delete documentation.
> * toplev.c (max_label_num_after_reload): Delete variable.
> (rest_of_compilation): Don't set max_label_num_after_reload.
> Call reload_life_analysis after reload_cse_regs if optimizing.
> * config/gmicro/gmicro.h: Delete comment referring to
> * config/i386/i386.h: Likewise.
> * config/m88k/m88k.h: Likewise.
> * config/m32r/m32r.h (PRESERVE_DEATH_INFO_REGNO_P): Delete definition.
> * config/sh/sh.h: Likewise.
I have installed the cleanup part of this patch plus fairly simple changes
to allow us to call the existing life_analysis code after reload.
I did tweak the existing life analysis code to avoid multiple scans over the
insn chains for the call after reload, to avoid creating new autoinc addresses
and to avoid dead code elimination.
I expect to optimize the second call to life_analysis more in the future. For
example, with some fairly straightforward work it should be possible to avoid
calling find_basic_blocks and to incrementally update uid_block_number and
some of the other state computed by find_basic_blocks.
More information about the Gcc-patches