aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1997-07-28 17:42:09 +0000
committerJason Merrill <merrill@gnu.org>1997-07-28 17:42:09 +0000
commit429baef53a9d160e88ce202a09c8d735524893b4 (patch)
tree4ad98076fbd37dc982a542309fc2b8a53b0240ba /gcc
parentf0eebf28c40eb05fade71ddf798b25ef8754099a (diff)
downloadgcc-429baef53a9d160e88ce202a09c8d735524893b4.zip
gcc-429baef53a9d160e88ce202a09c8d735524893b4.tar.gz
gcc-429baef53a9d160e88ce202a09c8d735524893b4.tar.bz2
x
From-SVN: r14542
Diffstat (limited to 'gcc')
-rw-r--r--gcc/stor-layout.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 83bfb99..7c4b4f6 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -835,6 +835,8 @@ layout_type (type)
if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
{
tree field;
+ enum machine_mode mode = VOIDmode;
+
/* A record which has any BLKmode members must itself be BLKmode;
it can't go in a register.
Unless the member is BLKmode only because it isn't aligned. */
@@ -860,13 +862,23 @@ layout_type (type)
!= ((TREE_INT_CST_LOW (DECL_SIZE (field)) + bitpos - 1)
/ BITS_PER_WORD)
/* But there is no problem if the field is entire words. */
- && TREE_INT_CST_LOW (DECL_SIZE (field)) % BITS_PER_WORD == 0)
+ && TREE_INT_CST_LOW (DECL_SIZE (field)) % BITS_PER_WORD != 0)
goto record_lose;
+
+ /* If this field is the whole struct, remember its mode so
+ that, say, we can put a double in a class into a DF
+ register instead of forcing it to live in the stack. */
+ if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field)))
+ mode = DECL_MODE (field);
}
- TYPE_MODE (type)
- = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
- MODE_INT, 1);
+ if (mode != VOIDmode)
+ /* We only have one real field; use its mode. */
+ TYPE_MODE (type) = mode;
+ else
+ TYPE_MODE (type)
+ = mode_for_size (TREE_INT_CST_LOW (TYPE_SIZE (type)),
+ MODE_INT, 1);
/* If structure's known alignment is less than
what the scalar mode would need, and it matters,