summaryrefslogtreecommitdiff
path: root/gcc/resource.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-31 20:37:09 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-08-31 20:37:09 +0000
commit82575fa702c5782ac79aad4b5d7c86b597bc71b0 (patch)
treeafdcdc35501714ae0479a8139d1ee32d313b0176 /gcc/resource.c
parentbe342bf0a6c4d5aae61aa50960e164e7a49e206a (diff)
downloadgcc-82575fa702c5782ac79aad4b5d7c86b597bc71b0.tar.gz
Merge peephole2 from new_ia32_branch:
* Makefile.in (STAGESTUFF): Add *.peephole2. (mostlyclean): Likewise. (recog.o): Depend on resource.h. * final.c (peephole): Conditionalize decl on HAVE_peephole. (final_scan_insn): Likewise for the invocation of peephole. * genconfig.c (main): Look for peephole and peephole2 patterns. Emit HAVE_peephole* accordingly. * genpeep.c (main): Conditionalize entire output on HAVE_peephole. * flags.h (flag_peephole2): Declare. * toplev.c: New pass peephole2. New flag -fpeephole2. * genattrtab.c (main): Count DEFINE_PEEPHOLE2. * gencodes.c (main): Likewise. * genextract.c (main): Likewise. * genoutput.c (main): Likewise. * genemit.c (max_operand_1): Look for the max scratch operand. (gen_rtx_scratch): New. (gen_exp): Use it, and pass on new arg subroutine_type. (gen_expand): Take max scratch into account. (gen_split): Emit peephole2 functions. (output_peephole2_scratch): New. (main): Include hard-reg-set.h and resource.h. Handle peephole2. * genrecog.c (routine_type): Add PEEPHOLE2. (IS_SPLIT): New. (make_insn_sequence): Match outer parallel for peep2. Discard top level scratches and dups. (add_to_sequence): New args insn_type and top. Update all callers. Handle toplevel peep2 matching insns. (write_subroutine): Handle peep2. (write_tree_1): Likewise. (write_tree): Likewise. (main): Likewise. (change_state): New arg afterward. Update all callers. Handle matching separate insns. * recog.c (recog_next_insn): New. (peephole2_optimize): New. * rtl.def (DEFINE_PEEPHOLE2): New. * resource.c (find_free_register): New argument last_insn. Use it to find a register available through the entire span. * resource.h (find_free_register): Update prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29015 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/resource.c')
-rw-r--r--gcc/resource.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/resource.c b/gcc/resource.c
index daa839c54a7..880264594f7 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1239,17 +1239,20 @@ mark_end_of_function_resources (trial, include_delayed_effects)
include_delayed_effects);
}
-/* Try to find an available hard register of mode MODE at
- CURRENT_INSN, matching the register class in CLASS_STR. Registers
- that already have bits set in REG_SET will not be considered.
+/* 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, class_str, mode, reg_set)
- rtx current_insn;
+find_free_register (current_insn, last_insn, class_str, mode, reg_set)
+ rtx current_insn, last_insn;
char *class_str;
int mode;
HARD_REG_SET *reg_set;
@@ -1261,6 +1264,14 @@ find_free_register (current_insn, class_str, mode, reg_set)
= (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, 1);
+ current_insn = next_nonnote_insn (current_insn);
+ }
+
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{