summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-13 23:14:04 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-13 23:14:04 +0000
commit16a1ea05f12c19bb563b5d5712cc84f0dfb2b6fd (patch)
tree81a0f72673be5558699c49acd88285a2fa5ce0f6 /gcc
parent6c74b72ea547ac65e0458469eb9e9e8c9087c5cb (diff)
downloadgcc-16a1ea05f12c19bb563b5d5712cc84f0dfb2b6fd.tar.gz
* lang.c (java_estimate_num_insns_1): Fix bug in MODIFY_EXPR cost
estimation. * c-common.c (c_estimate_num_insns_1): Fix bug in MODIFY_EXPR cost estimation. * expr.c (MOVE_RATIO, CLEAR_RATIO): Move to ... * expr.h (MOVE_RATIO, CLEAR_RATIO): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75821 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-common.c9
-rw-r--r--gcc/expr.c24
-rw-r--r--gcc/expr.h24
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/lang.c9
6 files changed, 46 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 75cafb55e16..2bcbf160355 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2004-01-14 Jan Hubicka <jh@suse.cz>
+
+ * c-common.c (c_estimate_num_insns_1): Fix bug in MODIFY_EXPR
+ cost estimation.
+ * expr.c (MOVE_RATIO, CLEAR_RATIO): Move to ...
+ * expr.h (MOVE_RATIO, CLEAR_RATIO): ... here.
+
2004-01-13 Bernardo Innocenti <bernie@develer.com>
* config/m68k/netbsd-elf.h (REGISTER_NAMES): Add missing "argptr"
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 644511318c7..dcd540b1d85 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5770,13 +5770,14 @@ c_estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case MODIFY_EXPR:
case CONSTRUCTOR:
{
- int size = int_size_in_bytes (TREE_TYPE (x));
+ HOST_WIDE_INT size;
- if (!size || size > MOVE_MAX_PIECES)
+ size = int_size_in_bytes (TREE_TYPE (x));
+
+ if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
*count += 10;
else
- *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
- return NULL;
+ *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
}
break;
/* Few special cases of expensive operations. This is usefull
diff --git a/gcc/expr.c b/gcc/expr.c
index 73fb9655c1c..b5af15893f1 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -185,18 +185,6 @@ static char direct_store[NUM_MACHINE_MODES];
static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
-/* If a memory-to-memory move would take MOVE_RATIO or more simple
- move-instruction sequences, we will do a movstr or libcall instead. */
-
-#ifndef MOVE_RATIO
-#if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi) || defined (HAVE_movstrdi) || defined (HAVE_movstrti)
-#define MOVE_RATIO 2
-#else
-/* If we are optimizing for space (-Os), cut down the default move ratio. */
-#define MOVE_RATIO (optimize_size ? 3 : 15)
-#endif
-#endif
-
/* This macro is used to determine whether move_by_pieces should be called
to perform a structure copy. */
#ifndef MOVE_BY_PIECES_P
@@ -204,18 +192,6 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
(move_by_pieces_ninsns (SIZE, ALIGN) < (unsigned int) MOVE_RATIO)
#endif
-/* If a clear memory operation would take CLEAR_RATIO or more simple
- move-instruction sequences, we will do a clrstr or libcall instead. */
-
-#ifndef CLEAR_RATIO
-#if defined (HAVE_clrstrqi) || defined (HAVE_clrstrhi) || defined (HAVE_clrstrsi) || defined (HAVE_clrstrdi) || defined (HAVE_clrstrti)
-#define CLEAR_RATIO 2
-#else
-/* If we are optimizing for space, cut down the default clear ratio. */
-#define CLEAR_RATIO (optimize_size ? 3 : 15)
-#endif
-#endif
-
/* This macro is used to determine whether clear_by_pieces should be
called to clear storage. */
#ifndef CLEAR_BY_PIECES_P
diff --git a/gcc/expr.h b/gcc/expr.h
index bdfd4902f92..000011340e5 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -66,6 +66,30 @@ enum expand_modifier {EXPAND_NORMAL = 0, EXPAND_STACK_PARM = 2, EXPAND_SUM,
more information. */
#define OK_DEFER_POP (inhibit_defer_pop -= 1)
+/* If a memory-to-memory move would take MOVE_RATIO or more simple
+ move-instruction sequences, we will do a movstr or libcall instead. */
+
+#ifndef MOVE_RATIO
+#if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi) || defined (HAVE_movstrdi) || defined (HAVE_movstrti)
+#define MOVE_RATIO 2
+#else
+/* If we are optimizing for space (-Os), cut down the default move ratio. */
+#define MOVE_RATIO (optimize_size ? 3 : 15)
+#endif
+#endif
+
+/* If a clear memory operation would take CLEAR_RATIO or more simple
+ move-instruction sequences, we will do a clrstr or libcall instead. */
+
+#ifndef CLEAR_RATIO
+#if defined (HAVE_clrstrqi) || defined (HAVE_clrstrhi) || defined (HAVE_clrstrsi) || defined (HAVE_clrstrdi) || defined (HAVE_clrstrti)
+#define CLEAR_RATIO 2
+#else
+/* If we are optimizing for space, cut down the default clear ratio. */
+#define CLEAR_RATIO (optimize_size ? 3 : 15)
+#endif
+#endif
+
enum direction {none, upward, downward};
/* Structure to record the size of a sequence of arguments
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 2a8bd6ef696..fd6e32181bd 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-14 Jan Hubicka <jh@suse.cz>
+
+ * lang.c (java_estimate_num_insns_1): Fix bug in MODIFY_EXPR cost
+ estimation.
+
2004-01-09 Mark Mitchell <mark@codesourcery.com>
* java-tree.h (java_expand_expr): Change prototype.
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 2f68f7c0453..0fe68def937 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -1134,13 +1134,14 @@ java_estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
case MODIFY_EXPR:
case CONSTRUCTOR:
{
- int size = int_size_in_bytes (TREE_TYPE (x));
+ HOST_WIDE_INT size;
- if (!size || size > MOVE_MAX_PIECES)
+ size = int_size_in_bytes (TREE_TYPE (x));
+
+ if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO)
*count += 10;
else
- *count += 2 * (size + MOVE_MAX - 1) / MOVE_MAX;
- return NULL;
+ *count += ((size + MOVE_MAX_PIECES - 1) / MOVE_MAX_PIECES);
}
break;
/* Few special cases of expensive operations. This is usefull