i386.c (examine_argument): Return bool.
authorUros Bizjak <uros@gcc.gnu.org>
Mon, 14 Apr 2014 17:49:36 +0000 (19:49 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 14 Apr 2014 17:49:36 +0000 (19:49 +0200)
* config/i386/i386.c (examine_argument): Return bool.  Return true if
parameter should be passed in memory.
<case X86_64_COMPLEX_X87_CLASS>: Adjust.
(construct_container): Update calls to examine_argument.
(function_arg_advance_64): Ditto.
(return_in_memory_32): Merge with ix86_return_in_memory.
(return_in_memory_64): Ditto.
(return_in_memory_ms_64): Ditto.

From-SVN: r209388

gcc/ChangeLog
gcc/config/i386/i386.c

index 26d8d33..91bb92f 100644 (file)
@@ -1,3 +1,14 @@
+2014-04-14  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.c (examine_argument): Return bool.  Return true if
+       parameter should be passed in memory.
+       <case X86_64_COMPLEX_X87_CLASS>: Adjust.
+       (construct_container): Update calls to examine_argument.
+       (function_arg_advance_64): Ditto.
+       (return_in_memory_32): Merge with ix86_return_in_memory.
+       (return_in_memory_64): Ditto.
+       (return_in_memory_ms_64): Ditto.
+
 2014-04-14  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-utils.c (ipa_merge_profiles): Merge profile_id.
@@ -12,8 +23,7 @@
 2014-04-14  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/60827
-       * config/i386/i386.md (*fixuns_trunc<mode>_1): Revert the last
-       change.
+       * config/i386/i386.md (*fixuns_trunc<mode>_1): Revert the last change.
 
 2014-04-14  H.J. Lu  <hongjiu.lu@intel.com>
 
 2014-04-11  Tobias Burnus  <burnus@net-b.de>
 
        PR other/59055
-       * doc/bugreport.texi (Bugs): Remove nodes pointing to the
-       nirvana.
+       * doc/bugreport.texi (Bugs): Remove nodes pointing to the nirvana.
        * doc/gcc.texi (Service): Update description in the @menu
        * doc/invoke.texi (Option Summary): Remove misplaced and
        duplicated @menu.
 2014-04-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/60663
-       * cse.c (cse_insn): Set src_volatile on ASM_OPERANDS in
-       PARALLEL.
+       * cse.c (cse_insn): Set src_volatile on ASM_OPERANDS in PARALLEL.
 
 2014-04-10  Jan Hubicka  <hubicka@ucw.cz>
            Jakub Jelinek  <jakub@redhat.com>
 
        PR lto/60567
-       * ipa.c (function_and_variable_visibility): Copy forced_by_abi flag from
-       decl_node to node.
+       * ipa.c (function_and_variable_visibility): Copy forced_by_abi
+       flag from decl_node to node.
 
 2014-04-10  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
 
 
 2014-04-05  Pitchumani Sivanupandi  <Pitchumani.S@atmel.com>
 
-       * config/avr/avr-arch.h (avr_mcu_t): Add dev_attribute field to have device
-       specific ISA/ feature information. Remove short_sp and errata_skip ds.
-       Add avr_device_specific_features enum to have device specific info.
+       * config/avr/avr-arch.h (avr_mcu_t): Add dev_attribute field to have
+       device specific ISA/ feature information. Remove short_sp and
+       errata_skip ds.  Add avr_device_specific_features enum to have device
+       specific info.
        * config/avr/avr-c.c (avr_cpu_cpp_builtins): use dev_attribute to check
        errata_skip. Add __AVR_ISA_RMW__ builtin macro if RMW ISA available.
        * config/avr/avr-devices.c (avr_mcu_types): Update AVR_MCU macro for
 
        PR tree-optimization/60505
        * tree-vectorizer.h (struct _stmt_vec_info): Add th field as the
-       threshold of number of iterations below which no vectorization will be
-       done.
+       threshold of number of iterations below which no vectorization
+       will be done.
        * tree-vect-loop.c (new_loop_vec_info):
        Initialize LOOP_VINFO_COST_MODEL_THRESHOLD.
        * tree-vect-loop.c (vect_analyze_loop_operations):
 
 2014-04-03  Richard Biener  <rguenther@suse.de>
 
-       * tree-streamer.h (struct streamer_tree_cache_d): Add next_idx
-       member.
+       * tree-streamer.h (struct streamer_tree_cache_d): Add next_idx member.
        (streamer_tree_cache_create): Adjust.
        * tree-streamer.c (streamer_tree_cache_add_to_node_array): Adjust
        to allow optional nodes array.
        * lto-streamer-out.c (create_output_block): Avoid maintaining
        the node array in the writer cache.
        (DFS_write_tree): Remove assertion.
-       (produce_asm_for_decls): Free the out decl state hash table
-       early.
+       (produce_asm_for_decls): Free the out decl state hash table early.
        * lto-streamer-in.c (lto_data_in_create): Adjust for
        streamer_tree_cache_create prototype change.
 
 2014-04-02  Jan Hubicka  <hubicka@ucw.cz>
 
        PR ipa/60659
-       * ipa-devirt.c (get_polymorphic_call_info): Do not ICE on type inconsistent
-       code and instead mark the context inconsistent.
+       * ipa-devirt.c (get_polymorphic_call_info): Do not ICE on type
+       inconsistent code and instead mark the context inconsistent.
        (possible_polymorphic_call_targets): For inconsistent contexts
        return empty complete list.
 
 
 2014-04-01  Richard Biener  <rguenther@suse.de>
 
-       * gimple.h (struct gimple_statement_base): Align subcode to
-       16 bits.
+       * gimple.h (struct gimple_statement_base): Align subcode to 16 bits.
 
 2014-04-01  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
index 3eefe4a..f2e6957 100644 (file)
@@ -6806,8 +6806,9 @@ classify_argument (enum machine_mode mode, const_tree type,
 }
 
 /* Examine the argument and return set number of register required in each
-   class.  Return 0 iff parameter should be passed in memory.  */
-static int
+   class.  Return true iff parameter should be passed in memory.  */
+
+static bool
 examine_argument (enum machine_mode mode, const_tree type, int in_return,
                  int *int_nregs, int *sse_nregs)
 {
@@ -6816,8 +6817,9 @@ examine_argument (enum machine_mode mode, const_tree type, int in_return,
 
   *int_nregs = 0;
   *sse_nregs = 0;
+
   if (!n)
-    return 0;
+    return true;
   for (n--; n >= 0; n--)
     switch (regclass[n])
       {
@@ -6835,15 +6837,15 @@ examine_argument (enum machine_mode mode, const_tree type, int in_return,
        break;
       case X86_64_X87_CLASS:
       case X86_64_X87UP_CLASS:
+      case X86_64_COMPLEX_X87_CLASS:
        if (!in_return)
-         return 0;
+         return true;
        break;
-      case X86_64_COMPLEX_X87_CLASS:
-       return in_return ? 2 : 0;
       case X86_64_MEMORY_CLASS:
        gcc_unreachable ();
       }
-  return 1;
+
+  return false;
 }
 
 /* Construct container for the argument used by GCC interface.  See
@@ -6873,8 +6875,8 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
   n = classify_argument (mode, type, regclass, 0);
   if (!n)
     return NULL;
-  if (!examine_argument (mode, type, in_return, &needed_intregs,
-                        &needed_sseregs))
+  if (examine_argument (mode, type, in_return, &needed_intregs,
+                       &needed_sseregs))
     return NULL;
   if (needed_intregs > nintregs || needed_sseregs > nsseregs)
     return NULL;
@@ -7193,7 +7195,7 @@ function_arg_advance_64 (CUMULATIVE_ARGS *cum, enum machine_mode mode,
                 || VALID_AVX256_REG_MODE (mode)))
     return;
 
-  if (examine_argument (mode, type, 0, &int_nregs, &sse_nregs)
+  if (!examine_argument (mode, type, 0, &int_nregs, &sse_nregs)
       && sse_nregs <= cum->sse_nregs && int_nregs <= cum->nregs)
     {
       cum->nregs -= int_nregs;
@@ -7988,95 +7990,87 @@ ix86_libcall_value (enum machine_mode mode)
 
 /* Return true iff type is returned in memory.  */
 
-static bool ATTRIBUTE_UNUSED
-return_in_memory_32 (const_tree type, enum machine_mode mode)
+static bool
+ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
+#ifdef SUBTARGET_RETURN_IN_MEMORY
+  return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
+#else
+  const enum machine_mode mode = type_natural_mode (type, NULL, true);
   HOST_WIDE_INT size;
 
-  if (mode == BLKmode)
-    return true;
-
-  size = int_size_in_bytes (type);
-
-  if (MS_AGGREGATE_RETURN && AGGREGATE_TYPE_P (type) && size <= 8)
-    return false;
-
-  if (VECTOR_MODE_P (mode) || mode == TImode)
+  if (TARGET_64BIT)
     {
-      /* User-created vectors small enough to fit in EAX.  */
-      if (size < 8)
-       return false;
-
-      /* MMX/3dNow values are returned in MM0,
-        except when it doesn't exits or the ABI prescribes otherwise.  */
-      if (size == 8)
-       return !TARGET_MMX || TARGET_VECT8_RETURNS;
+      if (ix86_function_type_abi (fntype) == MS_ABI)
+       {
+         size = int_size_in_bytes (type);
 
-      /* SSE values are returned in XMM0, except when it doesn't exist.  */
-      if (size == 16)
-       return !TARGET_SSE;
+         /* __m128 is returned in xmm0.  */
+         if ((!type || VECTOR_INTEGER_TYPE_P (type)
+              || INTEGRAL_TYPE_P (type)
+              || VECTOR_FLOAT_TYPE_P (type))
+             && (SCALAR_INT_MODE_P (mode) || VECTOR_MODE_P (mode))
+             && !COMPLEX_MODE_P (mode)
+             && (GET_MODE_SIZE (mode) == 16 || size == 16))
+           return false;
 
-      /* AVX values are returned in YMM0, except when it doesn't exist.  */
-      if (size == 32)
-       return !TARGET_AVX;
+         /* Otherwise, the size must be exactly in [1248]. */
+         return size != 1 && size != 2 && size != 4 && size != 8;
+       }
+      else
+       {
+         int needed_intregs, needed_sseregs;
 
-      /* AVX512F values are returned in ZMM0, except when it doesn't exist.  */
-      if (size == 64)
-       return !TARGET_AVX512F;
+         return examine_argument (mode, type, 1,
+                                  &needed_intregs, &needed_sseregs);
+       }
     }
+  else
+    {
+      if (mode == BLKmode)
+       return true;
 
-  if (mode == XFmode)
-    return false;
+      size = int_size_in_bytes (type);
 
-  if (size > 12)
-    return true;
+      if (MS_AGGREGATE_RETURN && AGGREGATE_TYPE_P (type) && size <= 8)
+       return false;
 
-  /* OImode shouldn't be used directly.  */
-  gcc_assert (mode != OImode);
+      if (VECTOR_MODE_P (mode) || mode == TImode)
+       {
+         /* User-created vectors small enough to fit in EAX.  */
+         if (size < 8)
+           return false;
 
-  return false;
-}
+         /* Unless ABI prescibes otherwise,
+            MMX/3dNow values are returned in MM0 if available.  */
+            
+         if (size == 8)
+           return TARGET_VECT8_RETURNS || !TARGET_MMX;
 
-static bool ATTRIBUTE_UNUSED
-return_in_memory_64 (const_tree type, enum machine_mode mode)
-{
-  int needed_intregs, needed_sseregs;
-  return !examine_argument (mode, type, 1, &needed_intregs, &needed_sseregs);
-}
+         /* SSE values are returned in XMM0 if available.  */
+         if (size == 16)
+           return !TARGET_SSE;
 
-static bool ATTRIBUTE_UNUSED
-return_in_memory_ms_64 (const_tree type, enum machine_mode mode)
-{
-  HOST_WIDE_INT size = int_size_in_bytes (type);
+         /* AVX values are returned in YMM0 if available.  */
+         if (size == 32)
+           return !TARGET_AVX;
 
-  /* __m128 is returned in xmm0.  */
-  if ((!type || VECTOR_INTEGER_TYPE_P (type) || INTEGRAL_TYPE_P (type)
-       || VECTOR_FLOAT_TYPE_P (type))
-      && (SCALAR_INT_MODE_P (mode) || VECTOR_MODE_P (mode))
-      && !COMPLEX_MODE_P (mode) && (GET_MODE_SIZE (mode) == 16 || size == 16))
-    return false;
+         /* AVX512F values are returned in ZMM0 if available.  */
+         if (size == 64)
+           return !TARGET_AVX512F;
+       }
 
-  /* Otherwise, the size must be exactly in [1248]. */
-  return size != 1 && size != 2 && size != 4 && size != 8;
-}
+      if (mode == XFmode)
+       return false;
 
-static bool
-ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
-{
-#ifdef SUBTARGET_RETURN_IN_MEMORY
-  return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
-#else
-  const enum machine_mode mode = type_natural_mode (type, NULL, true);
+      if (size > 12)
+       return true;
 
-  if (TARGET_64BIT)
-    {
-      if (ix86_function_type_abi (fntype) == MS_ABI)
-       return return_in_memory_ms_64 (type, mode);
-      else
-       return return_in_memory_64 (type, mode);
+      /* OImode shouldn't be used directly.  */
+      gcc_assert (mode != OImode);
+
+      return false;
     }
-  else
-    return return_in_memory_32 (type, mode);
 #endif
 }