diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-27 20:23:15 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-05-27 20:23:15 +0000 |
commit | 3e9f123748453342eae2fa9a1bcf63730429b38d (patch) | |
tree | 2a3db5cb69837af35662b42fa3a1b95b877158ed /gcc/resource.c | |
parent | 5496faf1f5e781229d4ea5cfb2d3a9295845f661 (diff) | |
download | gcc-3e9f123748453342eae2fa9a1bcf63730429b38d.tar.gz |
* Makefile.in (recog.o): Don't depend on resource.h.
* recog.c: Don't include resource.h.
(recog_last_allowed_insn): Remove.
(recog_next_insn): Remove.
(struct peep2_insn_data): New.
(peep2_insn_data, peep2_current): New.
(peep2_next_insn): New.
(peep2_regno_dead_p, peep2_reg_dead_p): New.
(peep2_find_free_register): New.
(peephole2_optimize): Track life information by insn as we go.
* recog.h: Update declarations.
* resource.c (find_free_register, reg_dead_p): Remove.
* resource.h: Remove their declarations.
* toplev.c: Include hard-reg-set.h before recog.h.
* genconfig.c (max_insns_per_peep2): New.
(gen_peephole2): New.
(main): Call it.
* genemit.c (output_peephole2_scratches): Generate calls to
peep2_find_free_register; adjust surrounding code.
(main): Have insn-emit.c include hard-reg-set.h before recog.h.
* genrecog.c (change_state): Don't track last_insn.
(write_action): Write into *_pmatch_len before accepting.
(write_tree): Adjust peephole2_insns and subroutines to match.
* config/i386/i386.md (all peepholes): Use peep2_regno_dead_p.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/resource.c')
-rw-r--r-- | gcc/resource.c | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/gcc/resource.c b/gcc/resource.c index d84fabeee1d..af1b4edf6d0 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -1268,109 +1268,3 @@ mark_end_of_function_resources (trial, include_delayed_effects) mark_referenced_resources (trial, &end_of_function_needs, include_delayed_effects); } - -/* Try to find a hard register of mode MODE, matching the register class in - CLASS_STR, which is available at the beginning of insn CURRENT_INSN and - remains available until the end of LAST_INSN. LAST_INSN may be NULL_RTX, - in which case the only condition is that the register must be available - before CURRENT_INSN. - Registers that already have bits set in REG_SET will not be considered. - - If an appropriate register is available, it will be returned and the - corresponding bit(s) in REG_SET will be set; otherwise, NULL_RTX is - returned. */ - -rtx -find_free_register (current_insn, last_insn, class_str, mode, reg_set) - rtx current_insn, last_insn; - const char *class_str; - int mode; - HARD_REG_SET *reg_set; -{ - int i, j; - struct resources used; - unsigned char clet = class_str[0]; - enum reg_class class - = (clet == 'r' ? GENERAL_REGS : REG_CLASS_FROM_LETTER (clet)); - - mark_target_live_regs (get_insns (), current_insn, &used); - if (last_insn) - while (current_insn != last_insn) - { - /* Exclude anything set in this insn. */ - mark_set_resources (PATTERN (current_insn), &used, 0, - MARK_SRC_DEST_CALL); - current_insn = next_nonnote_insn (current_insn); - } - - - for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - { - int regno; - int success; - -#ifdef REG_ALLOC_ORDER - regno = reg_alloc_order [i]; -#else - regno = i; -#endif - - /* Don't allocate fixed registers. */ - if (fixed_regs[regno]) - continue; - /* Make sure the register is of the right class. */ - if (! TEST_HARD_REG_BIT (reg_class_contents[class], regno)) - continue; - /* And can support the mode we need. */ - if (! HARD_REGNO_MODE_OK (regno, mode)) - continue; - /* And that we don't create an extra save/restore. */ - if (! call_used_regs[regno] && ! regs_ever_live[regno]) - continue; - /* And we don't clobber traceback for noreturn functions. */ - if ((regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM) - && (! reload_completed || frame_pointer_needed)) - continue; - - success = 1; - for (j = HARD_REGNO_NREGS (regno, mode) - 1; j >= 0; j--) - { - if (TEST_HARD_REG_BIT (*reg_set, regno + j) - || TEST_HARD_REG_BIT (used.regs, regno + j)) - { - success = 0; - break; - } - } - if (success) - { - for (j = HARD_REGNO_NREGS (regno, mode) - 1; j >= 0; j--) - { - SET_HARD_REG_BIT (*reg_set, regno + j); - } - return gen_rtx_REG (mode, regno); - } - } - return NULL_RTX; -} - -/* Return true if REG is dead at CURRENT_INSN. */ - -int -reg_dead_p (current_insn, reg) - rtx current_insn, reg; -{ - struct resources used; - int regno, j; - - mark_target_live_regs (get_insns (), current_insn, &used); - - regno = REGNO (reg); - for (j = HARD_REGNO_NREGS (regno, GET_MODE (reg)) - 1; j >= 0; j--) - { - if (TEST_HARD_REG_BIT (used.regs, regno + j)) - return 0; - } - - return 1; -} |