summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-03 20:20:35 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-03 20:20:35 +0000
commite7971c005e1ef3c054f3e10f96642bca896411bf (patch)
tree0f3eddb683599b1fa6da741865277a804942c1f7
parent791ea9afe37d7ee8abfb0a681efe0eb17ff6ecfb (diff)
downloadppe42-gcc-e7971c005e1ef3c054f3e10f96642bca896411bf.tar.gz
ppe42-gcc-e7971c005e1ef3c054f3e10f96642bca896411bf.zip
* explow.c (int_expr_size): New fn.
* expr.c (expand_expr) [CONSTRUCTOR]: Use it. * expr.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56009 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/explow.c20
-rw-r--r--gcc/expr.c2
-rw-r--r--gcc/expr.h4
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 54fac85304a..96046ec70c4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-08-03 Jason Merrill <jason@redhat.com>
+
+ * explow.c (int_expr_size): New fn.
+ * expr.c (expand_expr) [CONSTRUCTOR]: Use it.
+ * expr.h: Declare it.
+
2002-08-02 Krister Walfridsson <cato@df.lth.se>
* Makefile.in (gengtype-lex.o, gengtype-yacc.o): Add path to
diff --git a/gcc/explow.c b/gcc/explow.c
index 5bc34517e8e..1d2764064e1 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -294,6 +294,26 @@ expr_size (exp)
return expand_expr (size, NULL_RTX, TYPE_MODE (sizetype), 0);
}
+
+/* Return a wide integer for the size in bytes of the value of EXP, or -1
+ if the size can vary or is larger than an integer. */
+
+HOST_WIDE_INT
+int_expr_size (exp)
+ tree exp;
+{
+ tree t = (*lang_hooks.expr_size) (exp);
+
+ if (t == 0
+ || TREE_CODE (t) != INTEGER_CST
+ || TREE_OVERFLOW (t)
+ || TREE_INT_CST_HIGH (t) != 0
+ /* If the result would appear negative, it's too big to represent. */
+ || (HOST_WIDE_INT) TREE_INT_CST_LOW (t) < 0)
+ return -1;
+
+ return TREE_INT_CST_LOW (t);
+}
/* Return a copy of X in which all memory references
and all constants that involve symbol refs
diff --git a/gcc/expr.c b/gcc/expr.c
index dddd2687770..4591af434e6 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6812,7 +6812,7 @@ expand_expr (exp, target, tmode, modifier)
* TYPE_QUAL_CONST))),
0, TREE_ADDRESSABLE (exp), 1);
- store_constructor (exp, target, 0, INTVAL (expr_size (exp)));
+ store_constructor (exp, target, 0, int_expr_size (exp));
return target;
}
diff --git a/gcc/expr.h b/gcc/expr.h
index 64340a2f409..76b5c809e8e 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -544,6 +544,10 @@ extern unsigned int case_values_threshold PARAMS ((void));
/* Return an rtx for the size in bytes of the value of an expr. */
extern rtx expr_size PARAMS ((tree));
+/* Return a wide integer for the size in bytes of the value of EXP, or -1
+ if the size can vary or is larger than an integer. */
+extern HOST_WIDE_INT int_expr_size PARAMS ((tree));
+
extern rtx lookup_static_chain PARAMS ((tree));
/* Convert a stack slot address ADDR valid in function FNDECL
OpenPOWER on IntegriCloud