This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch i386] Fix detection of va_list type for w64.


Hello!

2008-07-07 Kai Tietz <kai.tietz@onevision.com>

        * config/i386.c (is_va_list_pointer_char): New.
        (ix86_va_start): Replace compare with ms_va_list_type_node
        by call of is_va_list_pointer_char.
        (ix86_gimplify_va_arg): Likewise.

Bootstraped on x86_64-pc-linux64 and x86_64-pc-mingw32 without regressions.
Ok for apply?

Please add something like following to both call sites:


if (!TARGET_64BIT
   || ix86_canonical_va_list_type (TREE_TYPE (valist)) ==
   (DEFAULT_ABI == MS_ABI) ? ms_va_list_type_node : va_list_type_node)
{
   ...
}

The patch is OK with this change.

+/* Compare if TYPE is of kind va_list char * I returns true, if it
+ is of kind va_list char *, otherwise false. */
+
+static bool
+is_va_list_pointer_char (tree type)
+{
+ tree canonic;
+
+ /* For 32-bit it is always true. */
+ if (!TARGET_64BIT)
+ return true;
+ canonic = ix86_canonical_va_list_type (type);
+ return (canonic == ms_va_list_type_node
+ || (DEFAULT_ABI == MS_ABI && canonic == va_list_type_node));
+}
+
/* Implement va_start. */
static void
@@ -5419,8 +5435,7 @@ ix86_va_start (tree valist, rtx nextarg)
tree type;
/* Only 64bit target needs something special. */
- if (!TARGET_64BIT ||
- ix86_canonical_va_list_type (TREE_TYPE (valist)) == ms_va_list_type_node)
+ if (!TARGET_64BIT || is_va_list_pointer_char (TREE_TYPE (valist)))
{
std_expand_builtin_va_start (valist, nextarg);
return;
@@ -5499,8 +5514,7 @@ ix86_gimplify_va_arg (tree valist, tree enum machine_mode nat_mode;
/* Only 64bit target needs something special. */
- if (!TARGET_64BIT ||
- ix86_canonical_va_list_type (TREE_TYPE (valist)) == ms_va_list_type_node)
+ if (!TARGET_64BIT || is_va_list_pointer_char (TREE_TYPE (valist)))
return std_gimplify_va_arg_expr (valist, type, pre_p, post_p);

Thanks, Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]