From 4143fd3683c4720401b400cc110f848685d11c09 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Sat, 10 Apr 2010 12:30:29 +0000 Subject: [PATCH] Makefile.in (web.o): Depend on insn-config.h and $(RECOG_H). * Makefile.in (web.o): Depend on insn-config.h and $(RECOG_H). * web.c: Include "insn-config.h" and "recog.h". (union_match_dups): New function. (web_main): Call it. (union_defs): Don't try to recognize match_dups. From-SVN: r158187 --- gcc/ChangeLog | 8 ++++++- gcc/Makefile.in | 2 +- gcc/web.c | 61 +++++++++++++++++++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6353e85a38..5b2f0f05fbb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,7 +2,13 @@ * ira-costs.c (record_reg_classes): Ignore alternatives that are not enabled. - + + * Makefile.in (web.o): Depend on insn-config.h and $(RECOG_H). + * web.c: Include "insn-config.h" and "recog.h". + (union_match_dups): New function. + (web_main): Call it. + (union_defs): Don't try to recognize match_dups. + 2010-04-09 Uros Bizjak PR target/43707 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 20529d0b2a0..99811e78351 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2959,7 +2959,7 @@ fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) domwalk.h web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \ - $(DF_H) $(OBSTACK_H) $(TIMEVAR_H) $(TREE_PASS_H) + insn-config.h $(RECOG_H) $(DF_H) $(OBSTACK_H) $(TIMEVAR_H) $(TREE_PASS_H) gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(GGC_H) \ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \ diff --git a/gcc/web.c b/gcc/web.c index 7e15c2ce4c9..ff917333f59 100644 --- a/gcc/web.c +++ b/gcc/web.c @@ -48,6 +48,8 @@ along with GCC; see the file COPYING3. If not see #include "output.h" #include "df.h" #include "function.h" +#include "insn-config.h" +#include "recog.h" #include "timevar.h" #include "tree-pass.h" @@ -85,6 +87,46 @@ unionfind_union (struct web_entry *first, struct web_entry *second) return false; } +/* For INSN, union all defs and uses that are linked by match_dup. + FUN is the function that does the union. */ + +static void +union_match_dups (rtx insn, struct web_entry *def_entry, + struct web_entry *use_entry, + bool (*fun) (struct web_entry *, struct web_entry *)) +{ + struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); + df_ref *use_link = DF_INSN_INFO_USES (insn_info); + df_ref *def_link = DF_INSN_INFO_DEFS (insn_info); + int i; + + extract_insn (insn); + + for (i = 0; i < recog_data.n_dups; i++) + { + int op = recog_data.dup_num[i]; + enum op_type type = recog_data.operand_type[op]; + df_ref *ref, *dupref; + struct web_entry *entry; + + for (dupref = use_link; *dupref; dupref++) + if (DF_REF_LOC (*dupref) == recog_data.dup_loc[i]) + break; + + if (*dupref == NULL + || DF_REF_REGNO (*dupref) < FIRST_PSEUDO_REGISTER) + continue; + + ref = type == OP_IN ? use_link : def_link; + entry = type == OP_IN ? use_entry : def_entry; + for (; *ref; ref++) + if (DF_REF_LOC (*ref) == recog_data.operand_loc[op]) + break; + + (*fun) (use_entry + DF_REF_ID (*dupref), entry + DF_REF_ID (*ref)); + } +} + /* For each use, all possible defs reaching it must come in the same register, union them. FUN is the function that does the union. @@ -101,7 +143,6 @@ union_defs (df_ref use, struct web_entry *def_entry, { struct df_insn_info *insn_info = DF_REF_INSN_INFO (use); struct df_link *link = DF_REF_CHAIN (use); - df_ref *use_link; df_ref *eq_use_link; df_ref *def_link; rtx set; @@ -109,7 +150,6 @@ union_defs (df_ref use, struct web_entry *def_entry, if (insn_info) { rtx insn = insn_info->insn; - use_link = DF_INSN_INFO_USES (insn_info); eq_use_link = DF_INSN_INFO_EQ_USES (insn_info); def_link = DF_INSN_INFO_DEFS (insn_info); set = single_set (insn); @@ -117,26 +157,12 @@ union_defs (df_ref use, struct web_entry *def_entry, else { /* An artificial use. It links up with nothing. */ - use_link = NULL; eq_use_link = NULL; def_link = NULL; set = NULL; } - /* Some instructions may use match_dup for their operands. In case the - operands are dead, we will assign them different pseudos, creating - invalid instructions, so union all uses of the same operand for each - insn. */ - - if (use_link) - while (*use_link) - { - if (use != *use_link - && DF_REF_REAL_REG (use) == DF_REF_REAL_REG (*use_link)) - (*fun) (use_entry + DF_REF_ID (use), - use_entry + DF_REF_ID (*use_link)); - use_link++; - } + /* Union all occurrences of the same register in reg notes. */ if (eq_use_link) while (*eq_use_link) @@ -329,6 +355,7 @@ web_main (void) if (NONDEBUG_INSN_P (insn)) { df_ref *use_rec; + union_match_dups (insn, def_entry, use_entry, unionfind_union); for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++) { df_ref use = *use_rec; -- 2.30.2