From 5f24e0dcf6344dda90214aed59753203dac14b4b Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 15 Feb 2003 13:06:16 -0800 Subject: [PATCH] cfgcleanup.c: Include params.h. * cfgcleanup.c: Include params.h. (try_crossjump_bb): Use PARAM_MAX_CROSSJUMP_EDGES. Fix test for too many outgoing edges from a block. * Makefile.in (cfgcleanup.o): Depend on PARAMS_H. * params.def (max-crossjump-edges): New. * doc/invoke.texi: Document it. From-SVN: r62942 --- gcc/ChangeLog | 9 +++++++++ gcc/Makefile.in | 7 ++++--- gcc/cfgcleanup.c | 13 ++++++++----- gcc/doc/invoke.texi | 7 +++++++ gcc/params.def | 6 ++++++ 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2315a03cc60..bba56b8a3a1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2003-02-15 Richard Henderson + + * cfgcleanup.c: Include params.h. + (try_crossjump_bb): Use PARAM_MAX_CROSSJUMP_EDGES. Fix test for + too many outgoing edges from a block. + * Makefile.in (cfgcleanup.o): Depend on PARAMS_H. + * params.def (max-crossjump-edges): New. + * doc/invoke.texi: Document it. + 2003-02-15 Richard Henderson * recog.c (split_all_insns): Include new blocks in life update; diff --git a/gcc/Makefile.in b/gcc/Makefile.in index f4e26b769e1..8af0a704c59 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1593,9 +1593,10 @@ cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \ insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \ function.h except.h $(GGC_H) -cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ - $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h \ - $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) +cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ + $(RTL_H) $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h \ + $(RECOG_H) toplev.h $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) \ + $(PARAMS_H) cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h $(TM_H) \ $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \ diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 338281a6990..3607fc3fcdd 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -45,6 +45,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "recog.h" #include "toplev.h" #include "cselib.h" +#include "params.h" #include "tm_p.h" #include "target.h" @@ -1464,7 +1465,7 @@ try_crossjump_bb (mode, bb) { edge e, e2, nexte2, nexte, fallthru; bool changed; - int n = 0; + int n = 0, max; /* Nothing to do if there is not at least two incoming edges. */ if (!bb->pred || !bb->pred->pred_next) @@ -1473,11 +1474,13 @@ try_crossjump_bb (mode, bb) /* It is always cheapest to redirect a block that ends in a branch to a block that falls through into BB, as that adds no branches to the program. We'll try that combination first. */ - for (fallthru = bb->pred; fallthru; fallthru = fallthru->pred_next, n++) + fallthru = NULL; + max = PARAM_VALUE (PARAM_MAX_CROSSJUMP_EDGES); + for (e = bb->pred; e ; e = e->pred_next, n++) { - if (fallthru->flags & EDGE_FALLTHRU) - break; - if (n > 100) + if (e->flags & EDGE_FALLTHRU) + fallthru = e; + if (n > max) return false; } diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 36e14113c09..0c6f4eb4dd7 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -4346,6 +4346,13 @@ In each case, the @var{value} is an integer. The allowable choices for @var{name} are given in the following table: @table @gcctabopt +@item max-crossjump-edges +The maximum number of incoming edges to consider for crossjumping. +The algorithm used by @option(-fcrossjumping) is @math{O(N^2)} in +the number of edges incoming to each block. Increasing values mean +more aggressive optimization, making the compile time increase with +probably small improvement in executable size. + @item max-delay-slot-insn-search The maximum number of instructions to consider when looking for an instruction to fill a delay slot. If more than this arbitrary number of diff --git a/gcc/params.def b/gcc/params.def index 998b40d386b..66d823164d2 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -202,6 +202,12 @@ DEFPARAM(TRACER_MIN_BRANCH_PROBABILITY, this threshold (in percents). Used when profile feedback is not available", 50) +/* The maximum number of incoming edges to consider for crossjumping. */ +DEFPARAM(PARAM_MAX_CROSSJUMP_EDGES, + "max-crossjump-edges", + "The maximum number of incoming edges to consider for crossjumping", + 100) + #ifdef ENABLE_GC_ALWAYS_COLLECT # define GGC_MIN_EXPAND_DEFAULT 0 # define GGC_MIN_HEAPSIZE_DEFAULT 0 -- 2.30.2