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
This commit is contained in:
Bernd Schmidt 2010-04-10 12:30:29 +00:00 committed by Bernd Schmidt
parent 979740a089
commit 4143fd3683
3 changed files with 52 additions and 19 deletions

View File

@ -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 <ubizjak@gmail.com>
PR target/43707

View File

@ -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) \

View File

@ -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;