This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Remove maybe_encapsulate_block
Richard Guenther wrote:
On Fri, May 30, 2008 at 6:09 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
Hi,
The attached patch removes maybe_encapsulate_block.
Bootstrapped and tested on ia64-linux, powerpc64-linux, and
x86_64-linux, and tested there too (with multilibs where applicable).
The testing on powerpc uncovered some untested code paths in rs6000.c,
which I have already fixed. If anything like that happens in another
port, let me know and I'll try to help and fix that ASAP.
This is ok.
Thanks,
Richard.
2008-05-30 Steven Bosscher <stevenb.gcc@gmail.com>
* optabs.c (maybe_encapsulate_block): Remove.
(emit_libcall_block): Adjust accordingly.
* optabs.h (maybe_encapsulate_block): Remove prototype.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address):
Don't use maybe_encapsulate_block.
Committed for stevenb as revision 136217.
kenny
* optabs.c (maybe_encapsulate_block): Remove.
(emit_libcall_block): Adjust accordingly.
* optabs.h (maybe_encapsulate_block): Remove prototype.
* config/rs6000/rs6000.c (rs6000_legitimize_tls_address):
Don't use maybe_encapsulate_block.
Index: optabs.c
===================================================================
*** optabs.c (revision 135395)
--- optabs.c (working copy)
*************** no_conflict_move_test (rtx dest, const_r
*** 3829,3866 ****
p->must_stay = true;
}
- /* Encapsulate the block starting at FIRST and ending with LAST, which is
- logically equivalent to EQUIV, so it gets manipulated as a unit if it
- is possible to do so. */
-
- void
- maybe_encapsulate_block (rtx first, rtx last, rtx equiv)
- {
- if (!flag_non_call_exceptions || !may_trap_p (equiv))
- {
- /* We can't attach the REG_LIBCALL and REG_RETVAL notes when the
- encapsulated region would not be in one basic block, i.e. when
- there is a control_flow_insn_p insn between FIRST and LAST. */
- bool attach_libcall_retval_notes = true;
- rtx insn, next = NEXT_INSN (last);
-
- for (insn = first; insn != next; insn = NEXT_INSN (insn))
- if (control_flow_insn_p (insn))
- {
- attach_libcall_retval_notes = false;
- break;
- }
-
- if (attach_libcall_retval_notes)
- {
- REG_NOTES (first) = gen_rtx_INSN_LIST (REG_LIBCALL, last,
- REG_NOTES (first));
- REG_NOTES (last) = gen_rtx_INSN_LIST (REG_RETVAL, first,
- REG_NOTES (last));
- }
- }
- }
-
/* Emit code to make a call to a constant function or a library call.
--- 3829,3834 ----
*************** maybe_encapsulate_block (rtx first, rtx
*** 3872,3896 ****
loading constants into registers; doing so allows them to be safely cse'ed
between blocks. Then we emit all the other insns in the block, followed by
an insn to move RESULT to TARGET. This last insn will have a REQ_EQUAL
! note with an operand of EQUIV.
!
! Moving assignments to pseudos outside of the block is done to improve
! the generated code, but is not required to generate correct code,
! hence being unable to move an assignment is not grounds for not making
! a libcall block. There are two reasons why it is safe to leave these
! insns inside the block: First, we know that these pseudos cannot be
! used in generated RTL outside the block since they are created for
! temporary purposes within the block. Second, CSE will not record the
! values of anything set inside a libcall block, so we know they must
! be dead at the end of the block.
- Except for the first group of insns (the ones setting pseudos), the
- block is delimited by REG_RETVAL and REG_LIBCALL notes. */
void
emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
{
rtx final_dest = target;
! rtx prev, next, first, last, insn;
/* If this is a reg with REG_USERVAR_P set, then it could possibly turn
into a MEM later. Protect the libcall block from this change. */
--- 3840,3852 ----
loading constants into registers; doing so allows them to be safely cse'ed
between blocks. Then we emit all the other insns in the block, followed by
an insn to move RESULT to TARGET. This last insn will have a REQ_EQUAL
! note with an operand of EQUIV. */
void
emit_libcall_block (rtx insns, rtx target, rtx result, rtx equiv)
{
rtx final_dest = target;
! rtx prev, next, last, insn;
/* If this is a reg with REG_USERVAR_P set, then it could possibly turn
into a MEM later. Protect the libcall block from this change. */
*************** emit_libcall_block (rtx insns, rtx targe
*** 3936,3949 ****
for (insn = insns; insn; insn = next)
{
rtx set = single_set (insn);
- rtx note;
-
- /* Some ports (cris) create a libcall regions at their own. We must
- avoid any potential nesting of LIBCALLs. */
- if ((note = find_reg_note (insn, REG_LIBCALL, NULL)) != NULL)
- remove_note (insn, note);
- if ((note = find_reg_note (insn, REG_RETVAL, NULL)) != NULL)
- remove_note (insn, note);
next = NEXT_INSN (insn);
--- 3892,3897 ----
*************** emit_libcall_block (rtx insns, rtx targe
*** 3992,4016 ****
if (optab_handler (mov_optab, GET_MODE (target))->insn_code
!= CODE_FOR_nothing)
set_unique_reg_note (last, REG_EQUAL, copy_rtx (equiv));
- else
- {
- /* Remove any existing REG_EQUAL note from "last", or else it will
- be mistaken for a note referring to the full contents of the
- libcall value when found together with the REG_RETVAL note added
- below. An existing note can come from an insn expansion at
- "last". */
- remove_note (last, find_reg_note (last, REG_EQUAL, NULL_RTX));
- }
if (final_dest != target)
emit_move_insn (final_dest, target);
-
- if (prev == 0)
- first = get_insns ();
- else
- first = NEXT_INSN (prev);
-
- maybe_encapsulate_block (first, last, equiv);
}
/* Nonzero if we can perform a comparison of mode MODE straightforwardly.
--- 3940,3948 ----
Index: optabs.h
===================================================================
*** optabs.h (revision 135395)
--- optabs.h (working copy)
*************** extern rtx expand_copysign (rtx, rtx, rt
*** 723,732 ****
an input. */
extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
- /* Excapsulate the block in REG_LIBCALL, and REG_RETVAL reg notes and add
- REG_LIBCALL_ID notes to all insns in block. */
- extern void maybe_encapsulate_block (rtx, rtx, rtx);
-
/* Emit one rtl insn to compare two rtx's. */
extern void emit_cmp_insn (rtx, rtx, enum rtx_code, rtx, enum machine_mode,
int);
--- 723,728 ----
Index: config/rs6000/rs6000.c
===================================================================
*** config/rs6000/rs6000.c (revision 135395)
--- config/rs6000/rs6000.c (working copy)
*************** rs6000_legitimize_tls_address (rtx addr,
*** 3885,3891 ****
emit_insn (gen_addsi3 (tmp3, tmp1, tmp2));
last = emit_move_insn (got, tmp3);
set_unique_reg_note (last, REG_EQUAL, gsym);
- maybe_encapsulate_block (first, last, gsym);
}
}
}
--- 3885,3890 ----