aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-02-02 13:24:14 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-02-02 13:24:14 -0500
commit52786026fabb4b32e7232eafe1dfb78afba5443b (patch)
treede680a935cff8770c74f4c968a0c13a928e07f0e
parent09e3dd72329a140027254451c6af253b38689714 (diff)
downloadgcc-52786026fabb4b32e7232eafe1dfb78afba5443b.zip
gcc-52786026fabb4b32e7232eafe1dfb78afba5443b.tar.gz
gcc-52786026fabb4b32e7232eafe1dfb78afba5443b.tar.bz2
(synth_mult): Delay allocation of algorithm structures until they are needed.
(synth_mult): Delay allocation of algorithm structures until they are needed. Reorder early-exit tests to avoid comparing value that is not yet set. From-SVN: r6464
-rw-r--r--gcc/expmed.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 76c8a87..09e51ad 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1,6 +1,6 @@
/* Medium-level subroutines: convert bit-field store and extract
and shifts, multiplies and divides to rtl instructions.
- Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 92, 93, 1994 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -1851,10 +1851,7 @@ synth_mult (alg_out, t, cost_limit)
int cost_limit;
{
int m;
- struct algorithm *best_alg
- = (struct algorithm *)alloca (sizeof (struct algorithm));
- struct algorithm *alg_in
- = (struct algorithm *)alloca (sizeof (struct algorithm));
+ struct algorithm *alg_in, *best_alg;
unsigned int cost;
unsigned HOST_WIDE_INT q;
@@ -1889,6 +1886,11 @@ synth_mult (alg_out, t, cost_limit)
}
}
+ /* We'll be needing a couple extra algorithm structures now. */
+
+ alg_in = (struct algorithm *)alloca (sizeof (struct algorithm));
+ best_alg = (struct algorithm *)alloca (sizeof (struct algorithm));
+
/* If we have a group of zero bits at the low-order part of T, try
multiplying by the remaining bits and then doing a shift. */
@@ -2051,16 +2053,16 @@ synth_mult (alg_out, t, cost_limit)
}
}
- /* If we are getting a too long sequence for `struct algorithm'
- to record, make this search fail. */
- if (best_alg->ops == MAX_BITS_PER_WORD)
- return;
-
/* If cost_limit has not decreased since we stored it in alg_out->cost,
we have not found any algorithm. */
if (cost_limit == alg_out->cost)
return;
+ /* If we are getting a too long sequence for `struct algorithm'
+ to record, make this search fail. */
+ if (best_alg->ops == MAX_BITS_PER_WORD)
+ return;
+
/* Copy the algorithm from temporary space to the space at alg_out.
We avoid using structure assignment because the majority of
best_alg is normally undefined, and this is a critical function. */