[lra] patch mostly implementing pseudo live range split
Vladimir Makarov
vmakarov@redhat.com
Wed Nov 30 02:00:00 GMT 2011
This patch contains a part of my several last weeks work on LRA.
1. The major change is to add pseudo live range split transformation to the
existing inheritance transformations. The idea is to create a new
split pseudo, add save/restore code using the split pseudo in EBB
for a pseudo got hard register which intersects a few reload
pseudos live ranges with high register pressure, and assign the
original pseudo hard register to the split pseudo. The
transformation is undone if the split pseudo did not change his hard
register or was not spilled in the assignment pass which is between
the passes doing and undoing inheritance/split transformations.
This new functionality of LRA (pseudo range splitting) permits to
move a separate caller saves pass into inheritance/split
transformation pass. This makes LRA smaller and a bit faster.
2. The patch adds the code for correct update of debug insns for
inheritance/split transformations. So I believe that now LRA deals
with debug info not worse than reload pass.
3. The patch rewrite the way of dealing with the secondary memory
moves in constraint pass of LRA. Previously we generated secondary
moves if macro SECONDARY_MEMORY_NEEDED says so. Unfortunately, the
macro is usually defined inaccurately. Therefore now we emit
secondary moves only if insn constraints are not satisfied (in
other words we need reloads for given move). This change permitted
to solve last degradations on GCC testsuite for x86-64/x86 in
comparison when the reload pass is used.
4. The patch also rewrites code for dealing with secondary memory
moves in PPC. PPC port is single one allocating explicitly stack
slot for secondary memory of given mode through using macro
SECONDARY_MEMORY_NEEDED_RTX. The patch rejects this approach for
LRA and uses a pseudo for secondary memory and this pseudo gets
memory as in standard mechanism for spilling in LRA. This permits
reuse the slots allocated for secondary memory for other spilled
pseudo decreasing allocated stack slot size in some case. This
change will permit to remove SECONDARY_MEMORY_NEEDED_RTX (as many
others) if LRA is in GCC finally.
5. There are other small and insignificant changes in the patch mostly
to fix some bugs and testsuite degradations.
The patch was successfully bootstrapped on x86/x86-64, ppc64, and
itanium. Arm bootstrap is still going.
Committed to LRA branch as rev. 181820.
2011-11-29 Vladimir Makarov<vmakarov@redhat.com>
* config/rs6000/rs6000.h (SECONDARY_MEMORY_NEEDED_MODE): New
macro.
* config/rs6000/rs6000-protos.h
(rs6000_secondary_memory_needed_mode): New prototype.
* config/rs6000/rs6000.c (rs6000_emit_move): Rewrite the code for
LRA for emitting secondary memory moves based on class of the
pseudo denoting the secondary memory.
(rs6000_secondary_memory_needed_mode): New function.
(rs6000_check_sdmode): Do nothing for LRA.
* config/i386/i386.c (inline_secondary_memory_needed): Switch off
an assert for LRA.
* lra-int.h (lra_split_pseudos): New external.
* lra-assigns.c (lra_setup_reg_renumber): Add code for printing
split pseudos.
(assign_candidates_bitmap, assign_candidates, assigned_pseudos):
Remove.
(spill_for): Add code for dealing with the split pseudos.
(assign_by_spills): Ditto.
* lra.c (lra_split_pseudos): New bitmap.
(lra): Initialize and finalize lra_split_pseudos. Remove call of
lra_save_restore. Always do inheritance/split pass on the first
iteration when caller_save_needed.
* lra-constraints.c (lra_secondary_memory): Remove.
(get_secondary_mem): Ditto.
(get_reload_reg): Make value of output reload pseudo unique.
(emit_secondary_memory_move): Rename emit_spill_move. Process
subregs.
(check_and_process_move): Add new argument. Don't emit secondary
memory moves, only report them. Make values of scratch and
secondary pseudos unique.
(curr_insn_transform): Emit secondary memory moves only if insn
does not satisfy all constraints.
(MAX_RELOAD_INSNS_NUMBER): Increase it to LRA_MAX_INSN_RELOADS.
(lra_contraints_init): Remove code initializing
lra_secondary_memory.
(usage_insns_check): Remove.
(reloads_num, calls_num): New.
(struct usage_insns): New.
(usage_insns): Change the type.
(inherit_reload_reg): Improve formatting. Add more asserts.
(need_for_call_save_p, need_for_split_p, choose_split_class): New
functions.
(split_pseudo): New function.
(update_ebb_live_info): Process insns even if EBB contains one BB.
(get_live_on_other_edges, get_non_debug_insn): New functions.
(temp_bitmap): New bitmap.
(add_next_usage_insn): New function.
(inherit_in_ebb): Change the prototype. Add code for pseudo range
splitting.
(lra_inheritance): Call update_ebb_live_info if the changes were
made in inherit_in_ebb.
(get_pseudo_regno): New function.
(remove_inheritance_pseudos): Add code for undoing pseudo live
range split and dealing with subregs. Update debug info too.
(lra_undo_inheritance): Add code for undoing pseudo live range
split. Add printing more debug info.
* lra-saves.c: Remove.
* Makefile.in (OBJS): Remove lra-saves.o
(lra-saves.o): Remove the entry.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: nov29.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111130/c3147bdc/attachment.ksh>
More information about the Gcc-patches
mailing list