diff options
author | Richard Henderson <rth@cygnus.com> | 1998-05-18 06:21:14 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1998-05-18 06:21:14 -0700 |
commit | ead1705900f4e5c6e06407208b928d83b4646320 (patch) | |
tree | 52f254790542ea9c24b53b11b490678708eeaa15 /gcc/tree.c | |
parent | 6d73fddc3f93058d8f3534a3b888779a134c484e (diff) | |
download | gcc-ead1705900f4e5c6e06407208b928d83b4646320.zip gcc-ead1705900f4e5c6e06407208b928d83b4646320.tar.gz gcc-ead1705900f4e5c6e06407208b928d83b4646320.tar.bz2 |
tree.h (TYPE_SIZE_UNIT): New.
* tree.h (TYPE_SIZE_UNIT): New.
(struct tree_type): Add size_unit member.
* stor-layout.c (layout_type): Initialize it.
* expr.c (get_inner_reference) [ARRAY_REF]: Use it.
* tree.c (size_in_bytes, int_size_in_bytes): Likewise.
From-SVN: r19853
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -2162,16 +2162,17 @@ size_in_bytes (type) if (type == error_mark_node) return integer_zero_node; + type = TYPE_MAIN_VARIANT (type); - if (TYPE_SIZE (type) == 0) + t = TYPE_SIZE_UNIT (type); + if (t == 0) { incomplete_type_error (NULL_TREE, type); return integer_zero_node; } - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), - size_int (BITS_PER_UNIT)); if (TREE_CODE (t) == INTEGER_CST) force_fit_type (t, 0); + return t; } @@ -2188,16 +2189,10 @@ int_size_in_bytes (type) return 0; type = TYPE_MAIN_VARIANT (type); - if (TYPE_SIZE (type) == 0 - || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) - return -1; - - if (TREE_INT_CST_HIGH (TYPE_SIZE (type)) == 0) - return ((TREE_INT_CST_LOW (TYPE_SIZE (type)) + BITS_PER_UNIT - 1) - / BITS_PER_UNIT); - - t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type), size_int (BITS_PER_UNIT)); - if (TREE_CODE (t) != INTEGER_CST || TREE_INT_CST_HIGH (t) != 0) + t = TYPE_SIZE_UNIT (type); + if (t == 0 + || TREE_CODE (t) != INTEGER_CST + || TREE_INT_CST_HIGH (t) != 0) return -1; return TREE_INT_CST_LOW (t); |