rtl-factoring.c: Add sequence abstraction algorithm.
2006-01-16 Gabor Loki <loki@gcc.gnu.org> * rtl-factoring.c : Add sequence abstraction algorithm. * cfgcleanup.c (outgoing_edges_match): Extra checks. (try_crossjump_to_edge): Avoid deleting preserve label when redirecting ABNORMAL edges. (block_has_preserve_label): New function. * common.opt: Register new pass. * Makefile.in: Ditto. * passes.c: Ditto. * timevar.def: Ditto. * tree-pass.h: Ditto. * emit-rtl.c (make_jump_insn_raw): Remove forward decl. * rtl.h (make_jump_insn_raw): Add forward decl. * doc/invoke.texi: Add documentation for -frtl-abstract-sequences. From-SVN: r109750
This commit is contained in:
parent
292f30c5d7
commit
38109dab82
@ -995,7 +995,8 @@ OBJS-common = \
|
||||
tree-profile.o rtlhooks.o cfgexpand.o lambda-mat.o \
|
||||
lambda-trans.o lambda-code.o tree-loop-linear.o tree-ssa-sink.o \
|
||||
tree-vrp.o tree-stdarg.o tree-cfgcleanup.o tree-ssa-reassoc.o \
|
||||
tree-ssa-structalias.o tree-object-size.o
|
||||
tree-ssa-structalias.o tree-object-size.o \
|
||||
rtl-factoring.o
|
||||
|
||||
|
||||
OBJS-md = $(out_object_file)
|
||||
@ -1891,6 +1892,9 @@ tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \
|
||||
$(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h $(HASHTAB_H) toplev.h \
|
||||
tree-ssa-propagate.h
|
||||
rtl-factoring.o : rtl-factoring.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
|
||||
coretypes.h $(TM_H) $(BASIC_BLOCK_H) $(GGC_H) $(REGS_H) $(PARAMS_H) $(EXPR_H) \
|
||||
$(TM_P_H) tree-pass.h tree-flow.h timevar.h output.h
|
||||
tree-tailcall.o : tree-tailcall.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) function.h $(TM_H) coretypes.h \
|
||||
$(TREE_DUMP_H) $(DIAGNOSTIC_H) except.h tree-pass.h $(FLAGS_H) langhooks.h \
|
||||
|
@ -1589,11 +1589,43 @@ outgoing_edges_match (int mode, basic_block bb1, basic_block bb2)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We don't need to match the rest of edges as above checks should be enough
|
||||
to ensure that they are equivalent. */
|
||||
/* The same checks as in try_crossjump_to_edge. It is required for RTL
|
||||
version of sequence abstraction. */
|
||||
FOR_EACH_EDGE (e1, ei, bb2->succs)
|
||||
{
|
||||
edge e2;
|
||||
edge_iterator ei;
|
||||
basic_block d1 = e1->dest;
|
||||
|
||||
if (FORWARDER_BLOCK_P (d1))
|
||||
d1 = EDGE_SUCC (d1, 0)->dest;
|
||||
|
||||
FOR_EACH_EDGE (e2, ei, bb1->succs)
|
||||
{
|
||||
basic_block d2 = e2->dest;
|
||||
if (FORWARDER_BLOCK_P (d2))
|
||||
d2 = EDGE_SUCC (d2, 0)->dest;
|
||||
if (d1 == d2)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!e2)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Returns true if BB basic block has a preserve label. */
|
||||
|
||||
static bool
|
||||
block_has_preserve_label (basic_block bb)
|
||||
{
|
||||
return (bb
|
||||
&& block_label (bb)
|
||||
&& LABEL_PRESERVE_P (block_label (bb)));
|
||||
}
|
||||
|
||||
/* E1 and E2 are edges with the same destination block. Search their
|
||||
predecessors for common code. If found, redirect control flow from
|
||||
(maybe the middle of) E1->SRC to (maybe the middle of) E2->SRC. */
|
||||
@ -1669,6 +1701,11 @@ try_crossjump_to_edge (int mode, edge e1, edge e2)
|
||||
&& (newpos1 != BB_HEAD (src1)))
|
||||
return false;
|
||||
|
||||
/* Avoid deleting preseve label when redirecting ABNORMAL edeges. */
|
||||
if (block_has_preserve_label (e1->dest)
|
||||
&& (e1->flags & EDGE_ABNORMAL))
|
||||
return false;
|
||||
|
||||
/* Here we know that the insns in the end of SRC1 which are common with SRC2
|
||||
will be deleted.
|
||||
If we have tablejumps in the end of SRC1 and SRC2
|
||||
|
@ -783,6 +783,10 @@ fsched-stalled-insns-dep=
|
||||
Common RejectNegative Joined UInteger
|
||||
-fsched-stalled-insns-dep=<number> Set dependence distance checking in premature scheduling of queued insns
|
||||
|
||||
frtl-abstract-sequences
|
||||
Common Report Var(flag_rtl_seqabstr)
|
||||
Perform sequence abstraction optimization on RTL
|
||||
|
||||
fshared-data
|
||||
Common Report Var(flag_shared_data)
|
||||
Mark data as shared rather than private
|
||||
|
@ -326,7 +326,8 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-fregmove -frename-registers @gol
|
||||
-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
|
||||
-frerun-cse-after-loop -frerun-loop-opt @gol
|
||||
-frounding-math -fschedule-insns -fschedule-insns2 @gol
|
||||
-frounding-math -frtl-abstract-sequences @gol
|
||||
-fschedule-insns -fschedule-insns2 @gol
|
||||
-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
|
||||
-fsched-spec-load-dangerous @gol
|
||||
-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
|
||||
@ -5530,6 +5531,14 @@ Future versions of GCC may provide finer control of this setting
|
||||
using C99's @code{FENV_ACCESS} pragma. This command line option
|
||||
will be used to specify the default state for @code{FENV_ACCESS}.
|
||||
|
||||
@item -frtl-abstract-sequences
|
||||
@opindex frtl-abstract-sequences
|
||||
It is a size optimization method. This option is to find identical
|
||||
sequences of code, which can be turned into pseudo-procedures and
|
||||
then replace all occurrences with calls to the newly created
|
||||
subroutine. It is kind of an opposite of @option{-finline-functions}.
|
||||
This optimization runs at RTL level.
|
||||
|
||||
@item -fsignaling-nans
|
||||
@opindex fsignaling-nans
|
||||
Compile code assuming that IEEE signaling NaNs may generate user-visible
|
||||
|
@ -164,7 +164,6 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (struct rtx_def)))
|
||||
#define last_location (cfun->emit->x_last_location)
|
||||
#define first_label_num (cfun->emit->x_first_label_num)
|
||||
|
||||
static rtx make_jump_insn_raw (rtx);
|
||||
static rtx make_call_insn_raw (rtx);
|
||||
static rtx find_line_note (rtx);
|
||||
static rtx change_address_1 (rtx, enum machine_mode, rtx, int);
|
||||
@ -3344,7 +3343,7 @@ make_insn_raw (rtx pattern)
|
||||
|
||||
/* Like `make_insn_raw' but make a JUMP_INSN instead of an insn. */
|
||||
|
||||
static rtx
|
||||
rtx
|
||||
make_jump_insn_raw (rtx pattern)
|
||||
{
|
||||
rtx insn;
|
||||
|
@ -667,6 +667,7 @@ init_optimization_passes (void)
|
||||
NEXT_PASS (pass_postreload_cse);
|
||||
NEXT_PASS (pass_gcse2);
|
||||
NEXT_PASS (pass_flow2);
|
||||
NEXT_PASS (pass_rtl_seqabstr);
|
||||
NEXT_PASS (pass_stack_adjustments);
|
||||
NEXT_PASS (pass_peephole2);
|
||||
NEXT_PASS (pass_if_after_reload);
|
||||
|
1448
gcc/rtl-factoring.c
Normal file
1448
gcc/rtl-factoring.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1462,6 +1462,7 @@ extern rtx emit_note (int);
|
||||
extern rtx emit_note_copy (rtx);
|
||||
extern rtx emit_line_note (location_t);
|
||||
extern rtx make_insn_raw (rtx);
|
||||
extern rtx make_jump_insn_raw (rtx);
|
||||
extern void add_function_usage_to (rtx, rtx);
|
||||
extern rtx last_call_insn (void);
|
||||
extern rtx previous_insn (rtx);
|
||||
|
@ -149,6 +149,7 @@ DEFTIMEVAR (TV_SCHED , "scheduling")
|
||||
DEFTIMEVAR (TV_LOCAL_ALLOC , "local alloc")
|
||||
DEFTIMEVAR (TV_GLOBAL_ALLOC , "global alloc")
|
||||
DEFTIMEVAR (TV_RELOAD_CSE_REGS , "reload CSE regs")
|
||||
DEFTIMEVAR (TV_SEQABSTR , "sequence abstraction")
|
||||
DEFTIMEVAR (TV_GCSE_AFTER_RELOAD , "load CSE after reload")
|
||||
DEFTIMEVAR (TV_FLOW2 , "flow 2")
|
||||
DEFTIMEVAR (TV_IFCVT2 , "if-conversion 2")
|
||||
|
@ -379,6 +379,7 @@ extern struct tree_opt_pass pass_convert_to_eh_region_ranges;
|
||||
extern struct tree_opt_pass pass_shorten_branches;
|
||||
extern struct tree_opt_pass pass_set_nothrow_function_flags;
|
||||
extern struct tree_opt_pass pass_final;
|
||||
extern struct tree_opt_pass pass_rtl_seqabstr;
|
||||
|
||||
/* The root of the compilation pass tree, once constructed. */
|
||||
extern struct tree_opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes;
|
||||
|
Loading…
Reference in New Issue
Block a user