https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65791

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #3 from vries at gcc dot gnu.org ---
Is this the sort of thing we want? We use the hook to tell us what the offset
is (rather than to have to retrieve it ourselves) and use that in the
pass_stdarg optimization?

...
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 7bd9ff3..6ca594db 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9033,7 +9033,7 @@ ix86_va_start (tree valist, rtx nextarg)

 static tree
 ix86_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
-                     gimple_seq *post_p)
+                     gimple_seq *post_p, tree *gpr_offset_p, tree
*fpr_offset_p)
 {
   static const int intreg[6] = { 0, 1, 2, 3, 4, 5 };
   tree f_gpr, f_fpr, f_ovf, f_sav;
@@ -9269,15 +9269,19 @@ ix86_gimplify_va_arg (tree valist, tree type,
gimple_seq *pre_p,

       if (needed_intregs)
        {
-         t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr,
-                     build_int_cst (TREE_TYPE (gpr), needed_intregs * 8));
+         tree gpr_offset = build_int_cst (TREE_TYPE (gpr), needed_intregs *
8);
+         if (gpr_offset_p)
+           *gpr_offset_p = gpr_offset;
+         t = build2 (PLUS_EXPR, TREE_TYPE (gpr), gpr, gpr_offset);
          gimplify_assign (gpr, t, pre_p);
        }

       if (needed_sseregs)
        {
-         t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr,
-                     build_int_cst (TREE_TYPE (fpr), needed_sseregs * 16));
+         tree fpr_offset = build_int_cst (TREE_TYPE (fpr), needed_sseregs *
16);
+         if (fpr_offset_p)
+           *fpr_offset_p = fpr_offset;
+         t = build2 (PLUS_EXPR, TREE_TYPE (fpr), fpr, fpr_offset);
          gimplify_assign (fpr, t, pre_p);
        }

...

Reply via email to