From: Jeffrey Oldham Date: Fri, 23 Feb 2001 17:47:52 +0000 (+0000) Subject: Makefile.in (resource.o): Add params.h dependence. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d5d063d72d9fd5a9623f987ac21d9dcd7fee8969;p=gcc.git Makefile.in (resource.o): Add params.h dependence. 2001-02-23 Jeffrey Oldham * Makefile.in (resource.o): Add params.h dependence. * params.def (MAX_DELAY_SLOT_LIVE_SEARCH): New parameter. * params.h (MAX_DELAY_SLOT_LIVE_SEARCH): Likewise. * resource.c: Add dependence on params.h. (current_live_regs): Fix explanatory comment. (find_basic_block): Add new parameter to permit limiting search for a BARRIER. (mark_target_live_regs): Add new argument to find_basic_block call. (incr_ticks_for_insn): Likewise. From-SVN: r40001 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e87303d23e7..1d36d96ae02 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2001-02-23 Jeffrey Oldham + + * Makefile.in (resource.o): Add params.h dependence. + * params.def (MAX_DELAY_SLOT_LIVE_SEARCH): New parameter. + * params.h (MAX_DELAY_SLOT_LIVE_SEARCH): Likewise. + * resource.c: Add dependence on params.h. + (current_live_regs): Fix explanatory comment. + (find_basic_block): Add new parameter to permit limiting search + for a BARRIER. + (mark_target_live_regs): Add new argument to find_basic_block call. + (incr_ticks_for_insn): Likewise. + 2001-02-23 Gabriel Dos Reis * diagnostic.c (output_to_stream): Rename to diff --git a/gcc/Makefile.in b/gcc/Makefile.in index ba4187574e6..bc6067e6b12 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1429,7 +1429,7 @@ sibcall.o : sibcall.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) function.h \ hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \ $(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \ - $(INSN_ATTR_H) except.h + $(INSN_ATTR_H) except.h params.h lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \ real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) ssa.o : ssa.c $(CONFIG_H) system.h $(REGS_H) varray.h \ diff --git a/gcc/params.def b/gcc/params.def index 61c3600d902..aae706839ed 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -55,6 +55,17 @@ DEFPARAM (PARAM_MAX_DELAY_SLOT_INSN_SEARCH, "The maximum number of instructions to consider to fill a delay slot", 100) +/* When trying to fill delay slots, the maximum number of instructions + to consider when searching for a block with valid live register + information. Increasing this arbitrarily chosen value means more + aggressive optimization, increasing the compile time. This + parameter should be removed when the delay slot code is rewritten + to maintain the control-flow graph. */ +DEFPARAM(PARAM_MAX_DELAY_SLOT_LIVE_SEARCH, + "max-delay-slot-live-search", + "The maximum number of instructions to consider to find accurate live register information", + 333) + /* Local variables: mode:c diff --git a/gcc/params.h b/gcc/params.h index b60d29db349..d5336f2c70d 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -86,5 +86,7 @@ typedef enum compiler_param PARAM_VALUE (PARAM_MAX_INLINE_INSNS) #define MAX_DELAY_SLOT_INSN_SEARCH \ PARAM_VALUE (PARAM_MAX_DELAY_SLOT_INSN_SEARCH) +#define MAX_DELAY_SLOT_LIVE_SEARCH \ + PARAM_VALUE (PARAM_MAX_DELAY_SLOT_LIVE_SEARCH) #endif /* PARAMS_H */ diff --git a/gcc/resource.c b/gcc/resource.c index 8266321c95a..de1189d2b3b 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */ #include "resource.h" #include "except.h" #include "insn-attr.h" +#include "params.h" /* This structure is used to record liveness information at the targets or fallthrough insns of branches. We will most likely need the information @@ -66,7 +67,7 @@ static struct target_info **target_hash_table = NULL; static int *bb_ticks; /* Marks registers possibly live at the current place being scanned by - mark_target_live_regs. Used only by next two function. */ + mark_target_live_regs. Also used by update_live_status. */ static HARD_REG_SET current_live_regs; @@ -76,7 +77,7 @@ static HARD_REG_SET current_live_regs; static HARD_REG_SET pending_dead_regs; static void update_live_status PARAMS ((rtx, rtx, void *)); -static int find_basic_block PARAMS ((rtx)); +static int find_basic_block PARAMS ((rtx, int)); static rtx next_insn_no_annul PARAMS ((rtx)); static rtx find_dead_or_set_registers PARAMS ((rtx, struct resources*, rtx*, int, struct resources, @@ -115,25 +116,38 @@ update_live_status (dest, x, data) CLEAR_HARD_REG_BIT (pending_dead_regs, i); } } -/* Find the number of the basic block that starts closest to INSN. Return -1 - if we couldn't find such a basic block. */ + +/* Find the number of the basic block with correct live register + information that starts closest to INSN. Return -1 if we couldn't + find such a basic block or the beginning is more than + SEARCH_LIMIT instructions before INSN. Use SEARCH_LIMIT = -1 for + an unlimited search. + + The delay slot filling code destroys the control-flow graph so, + instead of finding the basic block containing INSN, we search + backwards toward a BARRIER where the live register information is + correct. */ static int -find_basic_block (insn) +find_basic_block (insn, search_limit) rtx insn; + int search_limit; { int i; /* Scan backwards to the previous BARRIER. Then see if we can find a label that starts a basic block. Return the basic block number. */ - for (insn = prev_nonnote_insn (insn); - insn && GET_CODE (insn) != BARRIER; - insn = prev_nonnote_insn (insn)) + insn && GET_CODE (insn) != BARRIER && search_limit != 0; + insn = prev_nonnote_insn (insn), --search_limit) ; + /* The closest BARRIER is too far away. */ + if (search_limit == 0) + return -1; + /* The start of the function is basic block zero. */ - if (insn == 0) + else if (insn == 0) return 0; /* See if any of the upcoming CODE_LABELs start a basic block. If we reach @@ -925,7 +939,7 @@ mark_target_live_regs (insns, target, res) } if (b == -1) - b = find_basic_block (target); + b = find_basic_block (target, MAX_DELAY_SLOT_LIVE_SEARCH); if (target_hash_table != NULL) { @@ -1294,7 +1308,7 @@ void incr_ticks_for_insn (insn) rtx insn; { - int b = find_basic_block (insn); + int b = find_basic_block (insn, MAX_DELAY_SLOT_LIVE_SEARCH); if (b != -1) bb_ticks[b]++;