This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[cfg-branch] web pass tweeks
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, gcc-pdo at atrey dot karlin dot mff dot cuni dot cz
- Date: Tue, 20 Nov 2001 17:18:02 +0100
- Subject: [cfg-branch] web pass tweeks
Hi,
this patch improves web pass register duplication code, so the flags are not
thrown away and avoids converting of noop moves to non-noop.
Tue Nov 20 16:57:57 CET 2001 Jan Hubicka <jh@suse.cz>
* web.c: Include function.h
(union_defs): Copy pseudo's flags; union noop moves.
Index: web.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Attic/web.c,v
retrieving revision 1.1.2.3
diff -c -3 -p -r1.1.2.3 web.c
*** web.c 2001/11/19 17:38:34 1.1.2.3
--- web.c 2001/11/20 15:52:35
*************** Software Foundation, 59 Temple Place - S
*** 52,57 ****
--- 52,58 ----
#include "basic-block.h"
#include "output.h"
#include "df.h"
+ #include "function.h"
/* This entry is allocated for each reference in the insn stream. */
*************** union_defs (df, use, def_entry, use_entr
*** 116,128 ****
struct web_entry *def_entry;
struct web_entry *use_entry;
{
struct df_link *link = DF_REF_CHAIN (use);
! struct df_link *use_link = DF_INSN_USES (df, DF_REF_INSN (use));
/* Some instructions may use match_dup for it's operands. In case the
operands are dead, we will assign them different pseudos creating
invalid instruction, so union all uses of the same operands for each
insn. */
while (use_link)
{
if (use != use_link->ref
--- 117,133 ----
struct web_entry *def_entry;
struct web_entry *use_entry;
{
+ rtx insn = DF_REF_INSN (use);
struct df_link *link = DF_REF_CHAIN (use);
! struct df_link *use_link = DF_INSN_USES (df, insn);
! struct df_link *def_link = DF_INSN_DEFS (df, insn);
! rtx set = single_set (insn);
/* Some instructions may use match_dup for it's operands. In case the
operands are dead, we will assign them different pseudos creating
invalid instruction, so union all uses of the same operands for each
insn. */
+
while (use_link)
{
if (use != use_link->ref
*************** union_defs (df, use, def_entry, use_entr
*** 131,136 ****
--- 136,158 ----
use_entry + DF_REF_ID (use_link->ref));
use_link = use_link->next;
}
+
+ /* Recognize trivial noop moves and attempt to keep them noop.
+ While most of noop moves should be removed we still keep some at
+ libcall boundaries and such. */
+
+ if (set
+ && SET_SRC (set) == DF_REF_REG (use)
+ && SET_SRC (set) == SET_DEST (set))
+ {
+ while (def_link)
+ {
+ if (DF_REF_REAL_REG (use) == DF_REF_REAL_REG (def_link->ref))
+ unionfind_union (use_entry + DF_REF_ID (use),
+ def_entry + DF_REF_ID (def_link->ref));
+ def_link = def_link->next;
+ }
+ }
while (link)
{
unionfind_union (use_entry + DF_REF_ID (use),
*************** entry_register (entry, ref, used, use_ad
*** 196,201 ****
--- 218,228 ----
else
{
newreg = gen_reg_rtx (GET_MODE (reg));
+ REG_USERVAR_P (newreg) = REG_USERVAR_P (reg);
+ REG_POINTER (newreg) = REG_POINTER (reg);
+ REG_LOOP_TEST_P (newreg) = REG_LOOP_TEST_P (reg);
+ RTX_UNCHANGING_P (newreg) = RTX_UNCHANGING_P (reg);
+ REGNO_DECL (REGNO (newreg)) = REGNO_DECL (REGNO (reg));
if (rtl_dump_file)
fprintf (rtl_dump_file, "Web oldreg=%i newreg=%i\n", REGNO (reg),
REGNO (newreg));