public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Change maybe_eh_return to bool
@ 2011-05-12 22:03 H.J. Lu
  2011-05-13  6:59 ` Uros Bizjak
  0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2011-05-12 22:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Uros Bizjak

Hi,

This patch changes maybe_eh_return to bool.  OK for trunk?

Thanks.

H.J.
---
2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_save_reg): Change maybe_eh_return
	to bool.
	(ix86_emit_restore_regs_using_mov): Likewise.
	(ix86_emit_restore_sse_regs_using_mov): Likewise.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 1cf8933..357e57c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9066,7 +9066,7 @@ ix86_select_alt_pic_regnum (void)
 
 /* Return 1 if we need to save REGNO.  */
 static int
-ix86_save_reg (unsigned int regno, int maybe_eh_return)
+ix86_save_reg (unsigned int regno, bool maybe_eh_return)
 {
   if (pic_offset_table_rtx
       && regno == REAL_PIC_OFFSET_TABLE_REGNUM
@@ -10898,7 +10898,7 @@ ix86_emit_leave (void)
    First register is restored from CFA - CFA_OFFSET.  */
 static void
 ix86_emit_restore_regs_using_mov (HOST_WIDE_INT cfa_offset,
-				  int maybe_eh_return)
+				  bool maybe_eh_return)
 {
   struct machine_function *m = cfun->machine;
   unsigned int regno;
@@ -10937,7 +10937,7 @@ ix86_emit_restore_regs_using_mov (HOST_WIDE_INT cfa_offset,
    First register is restored from CFA - CFA_OFFSET.  */
 static void
 ix86_emit_restore_sse_regs_using_mov (HOST_WIDE_INT cfa_offset,
-				      int maybe_eh_return)
+				      bool maybe_eh_return)
 {
   unsigned int regno;
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Change maybe_eh_return to bool
  2011-05-12 22:03 PATCH: Change maybe_eh_return to bool H.J. Lu
@ 2011-05-13  6:59 ` Uros Bizjak
  2011-05-13  7:59   ` H.J. Lu
  2011-05-13  8:29   ` H.J. Lu
  0 siblings, 2 replies; 5+ messages in thread
From: Uros Bizjak @ 2011-05-13  6:59 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

On Thu, May 12, 2011 at 9:55 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> This patch changes maybe_eh_return to bool.  OK for trunk?
>
> Thanks.
>
> H.J.
> ---
> 2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config/i386/i386.c (ix86_save_reg): Change maybe_eh_return
>        to bool.
>        (ix86_emit_restore_regs_using_mov): Likewise.
>        (ix86_emit_restore_sse_regs_using_mov): Likewise.

OK.

FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok
and perhaps many others...) can also be changed to bool.

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Change maybe_eh_return to bool
  2011-05-13  6:59 ` Uros Bizjak
@ 2011-05-13  7:59   ` H.J. Lu
  2011-05-13  8:29   ` H.J. Lu
  1 sibling, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2011-05-13  7:59 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

On Thu, May 12, 2011 at 2:09 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, May 12, 2011 at 9:55 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Hi,
>>
>> This patch changes maybe_eh_return to bool.  OK for trunk?
>>
>> Thanks.
>>
>> H.J.
>> ---
>> 2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>        * config/i386/i386.c (ix86_save_reg): Change maybe_eh_return
>>        to bool.
>>        (ix86_emit_restore_regs_using_mov): Likewise.
>>        (ix86_emit_restore_sse_regs_using_mov): Likewise.
>
> OK.
>
> FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok
> and perhaps many others...) can also be changed to bool.
>

I will prepare a separate patch.

Thanks.


-- 
H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Change maybe_eh_return to bool
  2011-05-13  6:59 ` Uros Bizjak
  2011-05-13  7:59   ` H.J. Lu
@ 2011-05-13  8:29   ` H.J. Lu
  2011-05-13  9:26     ` Uros Bizjak
  1 sibling, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2011-05-13  8:29 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

On Thu, May 12, 2011 at 2:09 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>
> FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok
> and perhaps many others...) can also be changed to bool.

This patch changes the return type of ix86_save_reg to bool and return
value of ix86_hard_regno_mode_ok to bool.

OK for trunk?

Thanks.

-- 
H.J.
---
2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_save_reg): Change return type to
	bool.
	(ix86_hard_regno_mode_ok): Change return value to bool.

[-- Attachment #2: gcc-bool-2.patch --]
[-- Type: text/x-diff, Size: 2859 bytes --]

2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>

	* config/i386/i386.c (ix86_save_reg): Change return type to
	bool.
	(ix86_hard_regno_mode_ok): Change return value to bool.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 357e57c..c06b45d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -9065,7 +9065,7 @@ ix86_select_alt_pic_regnum (void)
 }
 
 /* Return 1 if we need to save REGNO.  */
-static int
+static bool
 ix86_save_reg (unsigned int regno, bool maybe_eh_return)
 {
   if (pic_offset_table_rtx
@@ -9074,11 +9074,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return)
 	  || crtl->profile
 	  || crtl->calls_eh_return
 	  || crtl->uses_const_pool))
-    {
-      if (ix86_select_alt_pic_regnum () != INVALID_REGNUM)
-	return 0;
-      return 1;
-    }
+    return ix86_select_alt_pic_regnum () == INVALID_REGNUM;
 
   if (crtl->calls_eh_return && maybe_eh_return)
     {
@@ -9089,12 +9085,12 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return)
 	  if (test == INVALID_REGNUM)
 	    break;
 	  if (test == regno)
-	    return 1;
+	    return true;
 	}
     }
 
   if (crtl->drap_reg && regno == REGNO (crtl->drap_reg))
-    return 1;
+    return true;
 
   return (df_regs_ever_live_p (regno)
 	  && !call_used_regs[regno]
@@ -29010,7 +29006,7 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode)
   if (GET_MODE_CLASS (mode) == MODE_CC
       || GET_MODE_CLASS (mode) == MODE_RANDOM
       || GET_MODE_CLASS (mode) == MODE_PARTIAL_INT)
-    return 0;
+    return false;
   if (FP_REGNO_P (regno))
     return VALID_FP_MODE_P (mode);
   if (SSE_REGNO_P (regno))
@@ -29040,26 +29036,26 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode)
       /* Take care for QImode values - they can be in non-QI regs,
 	 but then they do cause partial register stalls.  */
       if (regno <= BX_REG || TARGET_64BIT)
-	return 1;
+	return true;
       if (!TARGET_PARTIAL_REG_STALL)
-	return 1;
-      return reload_in_progress || reload_completed;
+	return true;
+      return reload_in_progress != 0 || reload_completed != 0;
     }
   /* We handle both integer and floats in the general purpose registers.  */
   else if (VALID_INT_MODE_P (mode))
-    return 1;
+    return true;
   else if (VALID_FP_MODE_P (mode))
-    return 1;
+    return true;
   else if (VALID_DFP_MODE_P (mode))
-    return 1;
+    return true;
   /* Lots of MMX code casts 8 byte vector modes to DImode.  If we then go
      on to use that value in smaller contexts, this can easily force a
      pseudo to be allocated to GENERAL_REGS.  Since this is no worse than
      supporting DImode, allow it.  */
   else if (VALID_MMX_REG_MODE_3DNOW (mode) || VALID_MMX_REG_MODE (mode))
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 /* A subroutine of ix86_modes_tieable_p.  Return true if MODE is a

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Change maybe_eh_return to bool
  2011-05-13  8:29   ` H.J. Lu
@ 2011-05-13  9:26     ` Uros Bizjak
  0 siblings, 0 replies; 5+ messages in thread
From: Uros Bizjak @ 2011-05-13  9:26 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gcc-patches

On Thu, May 12, 2011 at 11:58 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>> FWIW, the return type of ix86_save_reg (and ix86_hard_regno_mode_ok
>> and perhaps many others...) can also be changed to bool.
>
> This patch changes the return type of ix86_save_reg to bool and return
> value of ix86_hard_regno_mode_ok to bool.
>
> OK for trunk?

> 2011-05-12  H.J. Lu  <hongjiu.lu@intel.com>
>
>        * config/i386/i386.c (ix86_save_reg): Change return type to
>        bool.
>        (ix86_hard_regno_mode_ok): Change return value to bool.
>

OK, but please update the function comments to say "Return TRUE ..."
instead of "Return 1 ..."

Also:

> -      return reload_in_progress || reload_completed;
> +	return true;
> +      return reload_in_progress != 0 || reload_completed != 0;

return !can_create_pseudo_p ();

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-13  7:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12 22:03 PATCH: Change maybe_eh_return to bool H.J. Lu
2011-05-13  6:59 ` Uros Bizjak
2011-05-13  7:59   ` H.J. Lu
2011-05-13  8:29   ` H.J. Lu
2011-05-13  9:26     ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).