summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-29 12:49:06 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-29 12:49:06 +0000
commit206fcb76bd4e329e240a8d532ee7d4dba6e0bc3b (patch)
treee3922f13fa1650a768e0fee5da12de4852a58708
parent91543a506f4bb2483fa6ee0983b228c530f7f1da (diff)
downloadppe42-gcc-206fcb76bd4e329e240a8d532ee7d4dba6e0bc3b.tar.gz
ppe42-gcc-206fcb76bd4e329e240a8d532ee7d4dba6e0bc3b.zip
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): If
STRICT_ALIGNMENT and the type is more aligned than the saved registers, copy via a temporary. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119307 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/rs6000.c21
2 files changed, 27 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c838be7693a..0c02f8bede5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-11-29 Joseph Myers <joseph@codesourcery.com>
+
+ * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): If
+ STRICT_ALIGNMENT and the type is more aligned than the saved
+ registers, copy via a temporary.
+
2006-11-28 Andrew Pinski <pinskia@gmail.com>
PR tree-opt/29984
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d52a75951c3..675af68fe9a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6222,6 +6222,27 @@ rs6000_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
append_to_statement_list (t, pre_p);
}
+ if (STRICT_ALIGNMENT
+ && (TYPE_ALIGN (type)
+ > (unsigned) BITS_PER_UNIT * (align < 4 ? 4 : align)))
+ {
+ /* The value (of type complex double, for example) may not be
+ aligned in memory in the saved registers, so copy via a
+ temporary. (This is the same code as used for SPARC.) */
+ tree tmp = create_tmp_var (type, "va_arg_tmp");
+ tree dest_addr = build_fold_addr_expr (tmp);
+
+ tree copy = build_function_call_expr
+ (implicit_built_in_decls[BUILT_IN_MEMCPY],
+ tree_cons (NULL_TREE, dest_addr,
+ tree_cons (NULL_TREE, addr,
+ tree_cons (NULL_TREE, size_int (rsize * 4),
+ NULL_TREE))));
+
+ gimplify_and_add (copy, pre_p);
+ addr = dest_addr;
+ }
+
addr = fold_convert (ptrtype, addr);
return build_va_arg_indirect_ref (addr);
}
OpenPOWER on IntegriCloud