summaryrefslogtreecommitdiff
path: root/gcc/web.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-10 12:30:29 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-10 12:30:29 +0000
commit9a3f5556e4426864f76a4e21de8a56e52ba677ef (patch)
tree6d2fd7f0a84684d261a4502ba271f2632ef66f24 /gcc/web.c
parent26f5b5ddb37ed33d4e6aca1cc7522b7cea7c7e33 (diff)
downloadgcc-9a3f5556e4426864f76a4e21de8a56e52ba677ef.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158187 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/web.c')
-rw-r--r--gcc/web.c61
1 files changed, 44 insertions, 17 deletions
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;