Commit 4b6c5340 by Bernd Schmidt Committed by Bernd Schmidt

Use cselib for alias analysis in sched_ebb

From-SVN: r44716
parent d26f648a
...@@ -5,6 +5,15 @@ ...@@ -5,6 +5,15 @@
* config/ia64/ia64.md (cond_opsi2_internal, cond_opsi2_internal_b): * config/ia64/ia64.md (cond_opsi2_internal, cond_opsi2_internal_b):
Turn into define_insn_and_split. Turn into define_insn_and_split.
* sched-deps.c: Include "cselib.h".
(add_insn_mem_dependence, sched_analyze_1, sched_analyze_2):
Use cselib to turn memory addresses into VALUEs.
(sched_analyze): Call cselib_init/cselib_finish if necessary.
* sched-int.h (struct sched_info): New member USE_CSELIB.
* sched-ebb.c (ebb_sched_info): Initialize it.
* sched-rgn.c (rgn_sched_info): Likewise.
* Makefile.in (sched-deps.o): Update dependencies.
2001-08-08 Graham Stott <grahams@redhat.com> 2001-08-08 Graham Stott <grahams@redhat.com>
......
...@@ -1529,7 +1529,7 @@ haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ ...@@ -1529,7 +1529,7 @@ haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h $(PARAMS_H) $(TM_P_H)
sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \ $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h function.h \
$(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H)
......
...@@ -39,6 +39,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -39,6 +39,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "recog.h" #include "recog.h"
#include "sched-int.h" #include "sched-int.h"
#include "params.h" #include "params.h"
#include "cselib.h"
extern char *reg_known_equiv_p; extern char *reg_known_equiv_p;
extern rtx *reg_known_value; extern rtx *reg_known_value;
...@@ -482,6 +483,11 @@ add_insn_mem_dependence (deps, insn_list, mem_list, insn, mem) ...@@ -482,6 +483,11 @@ add_insn_mem_dependence (deps, insn_list, mem_list, insn, mem)
link = alloc_INSN_LIST (insn, *insn_list); link = alloc_INSN_LIST (insn, *insn_list);
*insn_list = link; *insn_list = link;
if (current_sched_info->use_cselib)
{
mem = shallow_copy_rtx (mem);
XEXP (mem, 0) = cselib_subst_to_values (XEXP (mem, 0));
}
link = alloc_EXPR_LIST (VOIDmode, mem, *mem_list); link = alloc_EXPR_LIST (VOIDmode, mem, *mem_list);
*mem_list = link; *mem_list = link;
...@@ -676,6 +682,14 @@ sched_analyze_1 (deps, x, insn) ...@@ -676,6 +682,14 @@ sched_analyze_1 (deps, x, insn)
else if (GET_CODE (dest) == MEM) else if (GET_CODE (dest) == MEM)
{ {
/* Writing memory. */ /* Writing memory. */
rtx t = dest;
if (current_sched_info->use_cselib)
{
t = shallow_copy_rtx (dest);
cselib_lookup (XEXP (t, 0), Pmode, 1);
XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
}
if (deps->pending_lists_length > MAX_PENDING_LIST_LENGTH) if (deps->pending_lists_length > MAX_PENDING_LIST_LENGTH)
{ {
...@@ -695,7 +709,7 @@ sched_analyze_1 (deps, x, insn) ...@@ -695,7 +709,7 @@ sched_analyze_1 (deps, x, insn)
pending_mem = deps->pending_read_mems; pending_mem = deps->pending_read_mems;
while (pending) while (pending)
{ {
if (anti_dependence (XEXP (pending_mem, 0), dest)) if (anti_dependence (XEXP (pending_mem, 0), t))
add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI); add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
pending = XEXP (pending, 1); pending = XEXP (pending, 1);
...@@ -706,7 +720,7 @@ sched_analyze_1 (deps, x, insn) ...@@ -706,7 +720,7 @@ sched_analyze_1 (deps, x, insn)
pending_mem = deps->pending_write_mems; pending_mem = deps->pending_write_mems;
while (pending) while (pending)
{ {
if (output_dependence (XEXP (pending_mem, 0), dest)) if (output_dependence (XEXP (pending_mem, 0), t))
add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT); add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT);
pending = XEXP (pending, 1); pending = XEXP (pending, 1);
...@@ -838,12 +852,19 @@ sched_analyze_2 (deps, x, insn) ...@@ -838,12 +852,19 @@ sched_analyze_2 (deps, x, insn)
/* Reading memory. */ /* Reading memory. */
rtx u; rtx u;
rtx pending, pending_mem; rtx pending, pending_mem;
rtx t = x;
if (current_sched_info->use_cselib)
{
t = shallow_copy_rtx (t);
cselib_lookup (XEXP (t, 0), Pmode, 1);
XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
}
pending = deps->pending_read_insns; pending = deps->pending_read_insns;
pending_mem = deps->pending_read_mems; pending_mem = deps->pending_read_mems;
while (pending) while (pending)
{ {
if (read_dependence (XEXP (pending_mem, 0), x)) if (read_dependence (XEXP (pending_mem, 0), t))
add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI); add_dependence (insn, XEXP (pending, 0), REG_DEP_ANTI);
pending = XEXP (pending, 1); pending = XEXP (pending, 1);
...@@ -855,7 +876,7 @@ sched_analyze_2 (deps, x, insn) ...@@ -855,7 +876,7 @@ sched_analyze_2 (deps, x, insn)
while (pending) while (pending)
{ {
if (true_dependence (XEXP (pending_mem, 0), VOIDmode, if (true_dependence (XEXP (pending_mem, 0), VOIDmode,
x, rtx_varies_p)) t, rtx_varies_p))
add_dependence (insn, XEXP (pending, 0), 0); add_dependence (insn, XEXP (pending, 0), 0);
pending = XEXP (pending, 1); pending = XEXP (pending, 1);
...@@ -1237,6 +1258,9 @@ sched_analyze (deps, head, tail) ...@@ -1237,6 +1258,9 @@ sched_analyze (deps, head, tail)
register rtx u; register rtx u;
rtx loop_notes = 0; rtx loop_notes = 0;
if (current_sched_info->use_cselib)
cselib_init ();
for (insn = head;; insn = NEXT_INSN (insn)) for (insn = head;; insn = NEXT_INSN (insn))
{ {
if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN) if (GET_CODE (insn) == INSN || GET_CODE (insn) == JUMP_INSN)
...@@ -1386,8 +1410,14 @@ sched_analyze (deps, head, tail) ...@@ -1386,8 +1410,14 @@ sched_analyze (deps, head, tail)
CONST_OR_PURE_CALL_P (loop_notes) = CONST_OR_PURE_CALL_P (insn); CONST_OR_PURE_CALL_P (loop_notes) = CONST_OR_PURE_CALL_P (insn);
} }
if (current_sched_info->use_cselib)
cselib_process_insn (insn);
if (insn == tail) if (insn == tail)
return; {
if (current_sched_info->use_cselib)
cselib_finish ();
return;
}
} }
abort (); abort ();
} }
......
...@@ -193,7 +193,7 @@ static struct sched_info ebb_sched_info = ...@@ -193,7 +193,7 @@ static struct sched_info ebb_sched_info =
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
0 0, 1
}; };
/* Schedule a single extended basic block, defined by the boundaries HEAD /* Schedule a single extended basic block, defined by the boundaries HEAD
......
...@@ -146,7 +146,12 @@ struct sched_info ...@@ -146,7 +146,12 @@ struct sched_info
rtx head, tail; rtx head, tail;
/* If nonzero, enables an additional sanity check in schedule_block. */ /* If nonzero, enables an additional sanity check in schedule_block. */
int queue_must_finish_empty; unsigned int queue_must_finish_empty:1;
/* Nonzero if we should use cselib for better alias analysis. This
must be 0 if the dependency information is used after sched_analyze
has completed, e.g. if we're using it to initialize state for successor
blocks in region scheduling. */
unsigned int use_cselib:1;
}; };
extern struct sched_info *current_sched_info; extern struct sched_info *current_sched_info;
......
...@@ -2352,7 +2352,7 @@ static struct sched_info region_sched_info = ...@@ -2352,7 +2352,7 @@ static struct sched_info region_sched_info =
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
0 0, 0
}; };
/* Add dependences so that branches are scheduled to run last in their /* Add dependences so that branches are scheduled to run last in their
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment