aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-01-14 17:57:47 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-01-14 17:57:47 -0500
commitf395cd861ea86fd426bc1df24cdbe676afebf416 (patch)
tree037cc299a266ede119f93aaf51d95adeb7cb31fa
parent981e5cd9408eb6e1335def717fe5b270c1fa034f (diff)
downloadgcc-f395cd861ea86fd426bc1df24cdbe676afebf416.zip
gcc-f395cd861ea86fd426bc1df24cdbe676afebf416.tar.gz
gcc-f395cd861ea86fd426bc1df24cdbe676afebf416.tar.bz2
(stupid_find_reg): Don't try to allocate reg if live over more than
5,000 insns. From-SVN: r10974
-rw-r--r--gcc/stupid.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/stupid.c b/gcc/stupid.c
index 74ad7be..6034b81 100644
--- a/gcc/stupid.c
+++ b/gcc/stupid.c
@@ -1,5 +1,5 @@
/* Dummy data flow analysis for GNU compiler in nonoptimizing mode.
- Copyright (C) 1987, 1991, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -308,8 +308,8 @@ stupid_reg_compare (r1p, r2p)
/* Find a block of SIZE words of hard registers in reg_class CLASS
that can hold a value of machine-mode MODE
(but actually we test only the first of the block for holding MODE)
- currently free from after insn whose suid is BIRTH
- through the insn whose suid is DEATH,
+ currently free from after insn whose suid is BORN_INSN
+ through the insn whose suid is DEAD_INSN,
and return the number of the first of them.
Return -1 if such a block cannot be found.
@@ -337,6 +337,13 @@ stupid_find_reg (call_preserved, class, mode,
static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
#endif
+ /* If this register's life is more than 5,000 insns, we probably
+ can't allocate it, so don't waste the time trying. This avoid
+ quadratic behavior on programs that have regularly-occurring
+ SAVE_EXPRs. */
+ if (dead_insn > born_insn + 5000)
+ return -1;
+
COPY_HARD_REG_SET (used,
call_preserved ? call_used_reg_set : fixed_reg_set);