diff options
Diffstat (limited to 'contrib/gcc/resource.c')
-rw-r--r-- | contrib/gcc/resource.c | 109 |
1 files changed, 38 insertions, 71 deletions
diff --git a/contrib/gcc/resource.c b/contrib/gcc/resource.c index a72dd9c..240cf23 100644 --- a/contrib/gcc/resource.c +++ b/contrib/gcc/resource.c @@ -1,5 +1,6 @@ /* Definitions for computing resource usage of specific insns. - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GCC. @@ -20,6 +21,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "toplev.h" #include "rtl.h" #include "tm_p.h" @@ -76,21 +79,18 @@ 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, int)); -static rtx next_insn_no_annul PARAMS ((rtx)); -static rtx find_dead_or_set_registers PARAMS ((rtx, struct resources*, - rtx*, int, struct resources, - struct resources)); +static void update_live_status (rtx, rtx, void *); +static int find_basic_block (rtx, int); +static rtx next_insn_no_annul (rtx); +static rtx find_dead_or_set_registers (rtx, struct resources*, + rtx*, int, struct resources, + struct resources); /* Utility function called from mark_target_live_regs via note_stores. It deadens any CLOBBERed registers and livens any SET registers. */ static void -update_live_status (dest, x, data) - rtx dest; - rtx x; - void *data ATTRIBUTE_UNUSED; +update_live_status (rtx dest, rtx x, void *data ATTRIBUTE_UNUSED) { int first_regno, last_regno; int i; @@ -129,9 +129,7 @@ update_live_status (dest, x, data) correct. */ static int -find_basic_block (insn, search_limit) - rtx insn; - int search_limit; +find_basic_block (rtx insn, int search_limit) { basic_block bb; @@ -157,7 +155,7 @@ find_basic_block (insn, search_limit) insn = next_nonnote_insn (insn)) { FOR_EACH_BB (bb) - if (insn == bb->head) + if (insn == BB_HEAD (bb)) return bb->index; } @@ -168,8 +166,7 @@ find_basic_block (insn, search_limit) an annulled branch. */ static rtx -next_insn_no_annul (insn) - rtx insn; +next_insn_no_annul (rtx insn) { if (insn) { @@ -208,10 +205,8 @@ next_insn_no_annul (insn) CALL_INSNs. */ void -mark_referenced_resources (x, res, include_delayed_effects) - rtx x; - struct resources *res; - int include_delayed_effects; +mark_referenced_resources (rtx x, struct resources *res, + int include_delayed_effects) { enum rtx_code code = GET_CODE (x); int i, j; @@ -441,12 +436,9 @@ mark_referenced_resources (x, res, include_delayed_effects) number of unconditional branches. */ static rtx -find_dead_or_set_registers (target, res, jump_target, jump_count, set, needed) - rtx target; - struct resources *res; - rtx *jump_target; - int jump_count; - struct resources set, needed; +find_dead_or_set_registers (rtx target, struct resources *res, + rtx *jump_target, int jump_count, + struct resources set, struct resources needed) { HARD_REG_SET scratch; rtx insn, next; @@ -624,7 +616,7 @@ find_dead_or_set_registers (target, res, jump_target, jump_count, set, needed) /* Given X, a part of an insn, and a pointer to a `struct resource', RES, indicate which resources are modified by the insn. If MARK_TYPE is MARK_SRC_DEST_CALL, also mark resources potentially - set by the called routine. If MARK_TYPE is MARK_DEST, only mark SET_DESTs + set by the called routine. If IN_DEST is nonzero, it means we are inside a SET. Otherwise, objects are being referenced instead of set. @@ -636,11 +628,8 @@ find_dead_or_set_registers (target, res, jump_target, jump_count, set, needed) our computation and thus may be placed in a delay slot. */ void -mark_set_resources (x, res, in_dest, mark_type) - rtx x; - struct resources *res; - int in_dest; - enum mark_resource_type mark_type; +mark_set_resources (rtx x, struct resources *res, int in_dest, + enum mark_resource_type mark_type) { enum rtx_code code; int i, j; @@ -727,8 +716,7 @@ mark_set_resources (x, res, in_dest, mark_type) || GET_CODE (SET_SRC (x)) != CALL), mark_type); - if (mark_type != MARK_DEST) - mark_set_resources (SET_SRC (x), res, 0, MARK_SRC_DEST); + mark_set_resources (SET_SRC (x), res, 0, MARK_SRC_DEST); return; case CLOBBER: @@ -758,12 +746,9 @@ mark_set_resources (x, res, in_dest, mark_type) case SIGN_EXTRACT: case ZERO_EXTRACT: - if (! (mark_type == MARK_DEST && in_dest)) - { - mark_set_resources (XEXP (x, 0), res, in_dest, MARK_SRC_DEST); - mark_set_resources (XEXP (x, 1), res, 0, MARK_SRC_DEST); - mark_set_resources (XEXP (x, 2), res, 0, MARK_SRC_DEST); - } + mark_set_resources (XEXP (x, 0), res, in_dest, MARK_SRC_DEST); + mark_set_resources (XEXP (x, 1), res, 0, MARK_SRC_DEST); + mark_set_resources (XEXP (x, 2), res, 0, MARK_SRC_DEST); return; case MEM: @@ -810,13 +795,6 @@ mark_set_resources (x, res, in_dest, mark_type) } return; - case STRICT_LOW_PART: - if (! (mark_type == MARK_DEST && in_dest)) - { - mark_set_resources (XEXP (x, 0), res, 0, MARK_SRC_DEST); - return; - } - case UNSPEC_VOLATILE: case ASM_INPUT: /* Traditional asm's are always volatile. */ @@ -900,10 +878,7 @@ mark_set_resources (x, res, in_dest, mark_type) init_resource_info () was invoked before we are called. */ void -mark_target_live_regs (insns, target, res) - rtx insns; - rtx target; - struct resources *res; +mark_target_live_regs (rtx insns, rtx target, struct resources *res) { int b = -1; unsigned int i; @@ -938,7 +913,7 @@ mark_target_live_regs (insns, target, res) information, we can get it from there unless the insn at the start of the basic block has been deleted. */ if (tinfo && tinfo->block != -1 - && ! INSN_DELETED_P (BLOCK_HEAD (tinfo->block))) + && ! INSN_DELETED_P (BB_HEAD (BASIC_BLOCK (tinfo->block)))) b = tinfo->block; } @@ -961,7 +936,7 @@ mark_target_live_regs (insns, target, res) { /* Allocate a place to put our results and chain it into the hash table. */ - tinfo = (struct target_info *) xmalloc (sizeof (struct target_info)); + tinfo = xmalloc (sizeof (struct target_info)); tinfo->uid = INSN_UID (target); tinfo->block = b; tinfo->next @@ -1004,7 +979,7 @@ mark_target_live_regs (insns, target, res) /* Get starting and ending insn, handling the case where each might be a SEQUENCE. */ - start_insn = (b == 0 ? insns : BLOCK_HEAD (b)); + start_insn = (b == 0 ? insns : BB_HEAD (BASIC_BLOCK (b))); stop_insn = target; if (GET_CODE (start_insn) == INSN @@ -1170,8 +1145,7 @@ mark_target_live_regs (insns, target, res) This should be invoked before the first call to mark_target_live_regs. */ void -init_resource_info (epilogue_insn) - rtx epilogue_insn; +init_resource_info (rtx epilogue_insn) { int i; @@ -1193,10 +1167,8 @@ init_resource_info (epilogue_insn) #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM); #endif -#ifdef EXIT_IGNORE_STACK if (! EXIT_IGNORE_STACK || current_function_sp_is_unchanging) -#endif SET_HARD_REG_BIT (end_of_function_needs.regs, STACK_POINTER_REGNUM); } else @@ -1238,16 +1210,15 @@ init_resource_info (epilogue_insn) MARK_SRC_DEST_CALL); /* Allocate and initialize the tables used by mark_target_live_regs. */ - target_hash_table = (struct target_info **) - xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); - bb_ticks = (int *) xcalloc (last_basic_block, sizeof (int)); + target_hash_table = xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); + bb_ticks = xcalloc (last_basic_block, sizeof (int)); } -/* Free up the resources allcated to mark_target_live_regs (). This +/* Free up the resources allocated to mark_target_live_regs (). This should be invoked after the last call to mark_target_live_regs (). */ void -free_resource_info () +free_resource_info (void) { if (target_hash_table != NULL) { @@ -1279,8 +1250,7 @@ free_resource_info () /* Clear any hashed information that we have stored for INSN. */ void -clear_hashed_info_for_insn (insn) - rtx insn; +clear_hashed_info_for_insn (rtx insn) { struct target_info *tinfo; @@ -1299,8 +1269,7 @@ clear_hashed_info_for_insn (insn) /* Increment the tick count for the basic block that contains INSN. */ void -incr_ticks_for_insn (insn) - rtx insn; +incr_ticks_for_insn (rtx insn) { int b = find_basic_block (insn, MAX_DELAY_SLOT_LIVE_SEARCH); @@ -1311,9 +1280,7 @@ incr_ticks_for_insn (insn) /* Add TRIAL to the set of resources used at the end of the current function. */ void -mark_end_of_function_resources (trial, include_delayed_effects) - rtx trial; - int include_delayed_effects; +mark_end_of_function_resources (rtx trial, int include_delayed_effects) { mark_referenced_resources (trial, &end_of_function_needs, include_delayed_effects); |