summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-25 01:30:25 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-25 01:30:25 +0000
commitb708a05cc3fa0c89b45c6a1d3c7de115e00e1070 (patch)
tree9642e7e20204571cf15e101b98b0af82637ce77f /gcc/stor-layout.c
parentd9c8e13d9010d19b3b21985c530740b6b0922b43 (diff)
downloadgcc-b708a05cc3fa0c89b45c6a1d3c7de115e00e1070.tar.gz
Fixes for C++ structure layout breakage.
* expmed.c (store_bit_field): Move integer pun code down after code that calls emit_move_insn for entire register move. * stor-layout.c (compute_record_mode): Revert Mar 25, Aug 18, and Oct 20 changes. Only store mode in TYPE_MODE if RECORD_TYPE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37041 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index ea9ee013dd7..797b4cea17d 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1065,12 +1065,8 @@ compute_record_mode (type)
/* 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. However,
- we don't support using such a mode if there is no integer mode
- of the same size, so don't set it here. */
- if (field == TYPE_FIELDS (type) && TREE_CHAIN (field) == 0
- && int_mode_for_mode (DECL_MODE (field)) != BLKmode
- && operand_equal_p (DECL_SIZE (field), TYPE_SIZE (type), 1))
+ register instead of forcing it to live in the stack. */
+ if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field)))
mode = DECL_MODE (field);
#ifdef STRUCT_FORCE_BLK
@@ -1081,8 +1077,9 @@ compute_record_mode (type)
#endif /* STRUCT_FORCE_BLK */
}
- if (mode != VOIDmode)
- /* We only have one real field; use its mode. */
+ /* If we only have one real field; use its mode. This only applies to
+ RECORD_TYPE. This does not apply to unions. */
+ if (TREE_CODE (type) == RECORD_TYPE && mode != VOIDmode)
TYPE_MODE (type) = mode;
else
TYPE_MODE (type) = mode_for_size_tree (TYPE_SIZE (type), MODE_INT, 1);