aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-03-15 15:13:04 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-03-15 15:13:04 -0800
commit1fcd592b88f96a998ce87afa839b844835410acf (patch)
treed1195c7dccb4261aff788805fee4a0d2298fc342 /gcc
parente67e72c7cbc583f00582843e30ae449372afa91c (diff)
downloadgcc-1fcd592b88f96a998ce87afa839b844835410acf.zip
gcc-1fcd592b88f96a998ce87afa839b844835410acf.tar.gz
gcc-1fcd592b88f96a998ce87afa839b844835410acf.tar.bz2
alpha.c (alpha_va_arg): Manipulate the type size as a tree.
* config/alpha/alpha.c (alpha_va_arg): Manipulate the type size as a tree. From-SVN: r50857
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/alpha/alpha.c20
2 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f10b0c..c866f74 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-15 Richard Henderson <rth@redhat.com>
+
+ * config/alpha/alpha.c (alpha_va_arg): Manipulate the type
+ size as a tree.
+
2002-03-15 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.md ("tstqi_1"): Try to use ldab instead of tst.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index ee82f96..ed25a7d 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -5767,9 +5767,8 @@ rtx
alpha_va_arg (valist, type)
tree valist, type;
{
- HOST_WIDE_INT tsize;
rtx addr;
- tree t;
+ tree t, type_size, rounded_size;
tree offset_field, base_field, addr_tree, addend;
tree wide_type, wide_ofs;
int indirect = 0;
@@ -5777,7 +5776,18 @@ alpha_va_arg (valist, type)
if (TARGET_ABI_OPEN_VMS || TARGET_ABI_UNICOSMK)
return std_expand_builtin_va_arg (valist, type);
- tsize = ((TREE_INT_CST_LOW (TYPE_SIZE (type)) / BITS_PER_UNIT + 7) / 8) * 8;
+ if (type == error_mark_node
+ || (type_size = TYPE_SIZE_UNIT (TYPE_MAIN_VARIANT (type))) == NULL
+ || TREE_OVERFLOW (type_size))
+ rounded_size = size_zero_node;
+ else
+ rounded_size = fold (build (MULT_EXPR, sizetype,
+ fold (build (TRUNC_DIV_EXPR, sizetype,
+ fold (build (PLUS_EXPR, sizetype,
+ type_size,
+ size_int (7))),
+ size_int (8))),
+ size_int (8)));
base_field = TYPE_FIELDS (TREE_TYPE (valist));
offset_field = TREE_CHAIN (base_field);
@@ -5795,7 +5805,7 @@ alpha_va_arg (valist, type)
if (TYPE_MODE (type) == TFmode || TYPE_MODE (type) == TCmode)
{
indirect = 1;
- tsize = UNITS_PER_WORD;
+ rounded_size = size_int (UNITS_PER_WORD);
}
else if (FLOAT_TYPE_P (type))
{
@@ -5819,7 +5829,7 @@ alpha_va_arg (valist, type)
t = build (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field,
build (PLUS_EXPR, TREE_TYPE (offset_field),
- offset_field, build_int_2 (tsize, 0)));
+ offset_field, rounded_size));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);