builtins.c (build_va_arg_indirect_ref): New function.
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 9 Sep 2004 16:33:25 +0000 (16:33 +0000)
committerFrank Ch. Eigler <fche@gcc.gnu.org>
Thu, 9 Sep 2004 16:33:25 +0000 (16:33 +0000)
2004-09-09  Frank Ch. Eigler  <fche@redhat.com>

* builtins.c (build_va_arg_indirect_ref): New function.
(std_gimplify_va_arg_expr): Call it instead of mudflap check and
build_fold_indirect_ref.
* config/i386/i386.c (ix86_gimplify_va_arg): Ditto.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Ditto.
* tree.h: Declare new function.

From-SVN: r87242

gcc/ChangeLog
gcc/builtins.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/tree.h

index b1ec626275881e7aae8e3f018f980a56d78f5066..76581c8f8bef15590e2cc23d88a2ed30a9f2ed45 100644 (file)
@@ -1,3 +1,12 @@
+2004-09-09  Frank Ch. Eigler  <fche@redhat.com>
+
+       * builtins.c (build_va_arg_indirect_ref): New function.
+       (std_gimplify_va_arg_expr): Call it instead of mudflap check and
+       build_fold_indirect_ref.
+       * config/i386/i386.c (ix86_gimplify_va_arg): Ditto.
+       * config/ia64/ia64.c (ia64_gimplify_va_arg): Ditto.
+       * tree.h: Declare new function.
+
 2004-09-08  Nathan Sidwell  <nathan@codesourcery.com>
 
        * cgraphunit.c (cgraph_mark_functions_to_output): Renable node
index 537a5d4cd2bab25fd1bad8b51f44305368bf3216..34dceb9ef65cd0812c3628056cadcfa9f9d39488 100644 (file)
@@ -4358,13 +4358,18 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
   addr = fold_convert (build_pointer_type (type), addr);
 
   if (indirect)
-    {
-      addr = build_fold_indirect_ref (addr);
-      if (flag_mudflap) /* Don't instrument va_arg INDIRECT_REF.  */
-        mf_mark (addr);
-    }
+    addr = build_va_arg_indirect_ref (addr);
+
+  return build_va_arg_indirect_ref (addr);
+}
 
+/* Build an indirect-ref expression over the given TREE, which represents a
+   piece of a va_arg() expansion.  */
+tree
+build_va_arg_indirect_ref (tree addr)
+{
   addr = build_fold_indirect_ref (addr);
+
   if (flag_mudflap) /* Don't instrument va_arg INDIRECT_REF.  */
     mf_mark (addr);
 
index 3199b5756919542ac544dd7f6ce14ddd1fb8b349..25fa8d821ae85b43793185dd63e8cc82e79bd60e 100644 (file)
@@ -3291,7 +3291,7 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
   f_ovf = TREE_CHAIN (f_fpr);
   f_sav = TREE_CHAIN (f_ovf);
 
-  valist = build_fold_indirect_ref (valist);
+  valist = build_va_arg_indirect_ref (valist);
   gpr = build (COMPONENT_REF, TREE_TYPE (f_gpr), valist, f_gpr, NULL_TREE);
   fpr = build (COMPONENT_REF, TREE_TYPE (f_fpr), valist, f_fpr, NULL_TREE);
   ovf = build (COMPONENT_REF, TREE_TYPE (f_ovf), valist, f_ovf, NULL_TREE);
@@ -3440,12 +3440,12 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
              src_addr = fold_convert (addr_type, src_addr);
              src_addr = fold (build2 (PLUS_EXPR, addr_type, src_addr,
                                       size_int (src_offset)));
-             src = build_fold_indirect_ref (src_addr);
+             src = build_va_arg_indirect_ref (src_addr);
 
              dest_addr = fold_convert (addr_type, addr);
              dest_addr = fold (build2 (PLUS_EXPR, addr_type, dest_addr,
                                        size_int (INTVAL (XEXP (slot, 1)))));
-             dest = build_fold_indirect_ref (dest_addr);
+             dest = build_va_arg_indirect_ref (dest_addr);
 
              t = build2 (MODIFY_EXPR, void_type_node, dest, src);
              gimplify_and_add (t, pre_p);
@@ -3507,8 +3507,8 @@ ix86_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
   addr = fold_convert (ptrtype, addr);
 
   if (indirect_p)
-    addr = build_fold_indirect_ref (addr);
-  return build_fold_indirect_ref (addr);
+    addr = build_va_arg_indirect_ref (addr);
+  return build_va_arg_indirect_ref (addr);
 }
 \f
 /* Return nonzero if OPNUM's MEM should be matched
index 8921a8a7e92642d47abb012a69578fddf66370ee..df4487ab513368f85e6ea9c16cb3664be0e62492 100644 (file)
@@ -3379,7 +3379,7 @@ ia64_gimplify_va_arg (tree valist, tree type, tree *pre_p, tree *post_p)
     {
       tree ptrtype = build_pointer_type (type);
       tree addr = std_gimplify_va_arg_expr (valist, ptrtype, pre_p, post_p);
-      return build_fold_indirect_ref (addr);
+      return build_va_arg_indirect_ref (addr);
     }
 
   /* Aggregate arguments with alignment larger than 8 bytes start at
index c23ec7c769ccd9ebf2291aba9ef5071b658df34d..432a170b6deee2fefa70e840828357c5e20d2f12 100644 (file)
@@ -3462,6 +3462,7 @@ extern tree strip_float_extensions (tree);
 extern tree simplify_builtin (tree, int);
 extern tree c_strlen (tree, int);
 extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
+extern tree build_va_arg_indirect_ref (tree);
 
 /* In convert.c */
 extern tree strip_float_extensions (tree);