aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorBen Elliston <bje@au.ibm.com>2004-10-27 21:02:16 +0000
committerBen Elliston <bje@gcc.gnu.org>2004-10-28 07:02:16 +1000
commit61b5800161f855eb1028cd76ad200bd0d63b2b77 (patch)
tree13fd3cfcb73f6650e4dab5d9115c569183d1183a /gcc/tree-sra.c
parent72111a1f4bb7d88865ee53bdc2fc26db58c534ca (diff)
downloadgcc-61b5800161f855eb1028cd76ad200bd0d63b2b77.zip
gcc-61b5800161f855eb1028cd76ad200bd0d63b2b77.tar.gz
gcc-61b5800161f855eb1028cd76ad200bd0d63b2b77.tar.bz2
params.def (PARAM_SRA_MAX_STRUCTURE_SIZE): New.
* params.def (PARAM_SRA_MAX_STRUCTURE_SIZE): New. (PARAM_SRA_FIELD_STRUCTURE_RATIO): Likewise. * params.h (SRA_MAX_STRUCTURE_SIZE): New. (SRA_FIELD_STRUCTURE_RATIO): Likewise. * tree-sra.c: Include "params.h". (decide_block_copy): Use new parameters. * doc/invoke.texi (Optimize Options): Document new SRA pass parameters sra-max-structure-size and sra-field-structure-ratio. [testsuite] * gcc.dg/tree-ssa/sra-1.c: Pass --param sra-max-structure-size. From-SVN: r89711
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 7519c3c..9fd40f9 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "target.h"
/* expr.h is needed for MOVE_RATIO. */
#include "expr.h"
+#include "params.h"
/* This object of this pass is to replace a non-addressable aggregate with a
@@ -1292,6 +1293,14 @@ decide_block_copy (struct sra_elt *elt)
{
unsigned HOST_WIDE_INT full_size, inst_size = 0;
unsigned int inst_count;
+ unsigned int max_size;
+
+ /* If the sra-max-structure-size parameter is 0, then the
+ user has not overridden the parameter and we can choose a
+ sensible default. */
+ max_size = SRA_MAX_STRUCTURE_SIZE
+ ? SRA_MAX_STRUCTURE_SIZE
+ : MOVE_RATIO * UNITS_PER_WORD;
full_size = tree_low_cst (size_tree, 1);
@@ -1302,14 +1311,14 @@ decide_block_copy (struct sra_elt *elt)
/* If the structure is small, and we've made copies, go ahead
and instantiate, hoping that the copies will go away. */
- if (full_size <= (unsigned) MOVE_RATIO * UNITS_PER_WORD
+ if (full_size <= max_size
&& elt->n_copies > elt->n_uses)
use_block_copy = false;
else
{
inst_count = sum_instantiated_sizes (elt, &inst_size);
- if (inst_size * 4 >= full_size * 3)
+ if (inst_size * 100 >= full_size * SRA_FIELD_STRUCTURE_RATIO)
use_block_copy = false;
}