public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra.
@ 2014-08-27 14:49 Kito Cheng
  2014-09-03  9:26 ` Kito Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2014-08-27 14:49 UTC (permalink / raw)
  To: gcc-patches, Vladimir Makarov

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

Hi all:

This patch is clean up useless initialize for IRA with LRA.

2014-08-27  Kito Cheng  <kito@0xlab.org>

        * ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and
        ira_spilled_reg_stack_slots_num if using lra.
        (do_reload): Remove release ira_spilled_reg_stack_slots part.
        * ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to
        make sure not using lra.
        (ira_reuse_stack_slot): Likewise.
        (ira_mark_new_stack_slot): Likewise.

[-- Attachment #2: 0001-Don-t-init-ira_spilled_reg_stack_slots-in-ira-if-usi.patch --]
[-- Type: text/x-patch, Size: 2983 bytes --]

From 8355e31fd26e7930d7e80303dab9901c9263bcbe Mon Sep 17 00:00:00 2001
From: Kito Cheng <kito@0xlab.org>
Date: Wed, 20 Aug 2014 15:55:54 +0800
Subject: [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra.

2014-08-27  Kito Cheng  <kito@0xlab.org>

	* ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and
	ira_spilled_reg_stack_slots_num if using lra.
	(do_reload): Remove release ira_spilled_reg_stack_slots part.
	* ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to
	make sure not using lra.
	(ira_reuse_stack_slot): Likewise.
	(ira_mark_new_stack_slot): Likewise.
---
 gcc/ira-color.c |  6 ++++++
 gcc/ira.c       | 21 ++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index e2ea359..6846567 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -4067,6 +4067,8 @@ ira_sort_regnos_for_alter_reg (int *pseudo_regnos, int n,
   ira_allocno_iterator ai;
   ira_allocno_t *spilled_coalesced_allocnos;
 
+  ira_assert (! ira_use_lra_p);
+
   /* Set up allocnos can be coalesced.  */
   coloring_allocno_bitmap = ira_allocate_bitmap ();
   for (i = 0; i < n; i++)
@@ -4416,6 +4418,8 @@ ira_reuse_stack_slot (int regno, unsigned int inherent_size,
   bitmap_iterator bi;
   struct ira_spilled_reg_stack_slot *slot = NULL;
 
+  ira_assert (! ira_use_lra_p);
+
   ira_assert (inherent_size == PSEUDO_REGNO_BYTES (regno)
 	      && inherent_size <= total_size
 	      && ALLOCNO_HARD_REGNO (allocno) < 0);
@@ -4528,6 +4532,8 @@ ira_mark_new_stack_slot (rtx x, int regno, unsigned int total_size)
   int slot_num;
   ira_allocno_t allocno;
 
+  ira_assert (! ira_use_lra_p);
+
   ira_assert (PSEUDO_REGNO_BYTES (regno) <= total_size);
   allocno = ira_regno_allocno_map[regno];
   slot_num = -ALLOCNO_HARD_REGNO (allocno) - 2;
diff --git a/gcc/ira.c b/gcc/ira.c
index 7c18496..e8d5b44 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5260,14 +5260,16 @@ ira (FILE *f)
 #ifdef ENABLE_IRA_CHECKING
       print_redundant_copies ();
 #endif
-
-      ira_spilled_reg_stack_slots_num = 0;
-      ira_spilled_reg_stack_slots
-	= ((struct ira_spilled_reg_stack_slot *)
-	   ira_allocate (max_regno
-			 * sizeof (struct ira_spilled_reg_stack_slot)));
-      memset (ira_spilled_reg_stack_slots, 0,
-	      max_regno * sizeof (struct ira_spilled_reg_stack_slot));
+      if (! ira_use_lra_p)
+	{
+	  ira_spilled_reg_stack_slots_num = 0;
+	  ira_spilled_reg_stack_slots
+	    = ((struct ira_spilled_reg_stack_slot *)
+	       ira_allocate (max_regno
+			     * sizeof (struct ira_spilled_reg_stack_slot)));
+	  memset (ira_spilled_reg_stack_slots, 0,
+		  max_regno * sizeof (struct ira_spilled_reg_stack_slot));
+	}
     }
   allocate_initial_values ();
 
@@ -5303,9 +5305,6 @@ do_reload (void)
       FOR_ALL_BB_FN (bb, cfun)
 	bb->loop_father = NULL;
       current_loops = NULL;
-      
-      if (ira_conflicts_p)
-	ira_free (ira_spilled_reg_stack_slots);
 
       ira_destroy ();
 
-- 
1.9.3


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

* Re: [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra.
  2014-08-27 14:49 [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra Kito Cheng
@ 2014-09-03  9:26 ` Kito Cheng
  2014-09-03 15:19   ` Vladimir Makarov
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2014-09-03  9:26 UTC (permalink / raw)
  To: gcc-patches, Vladimir Makarov

ping!

On Wed, Aug 27, 2014 at 10:49 PM, Kito Cheng <kito.cheng@gmail.com> wrote:
> Hi all:
>
> This patch is clean up useless initialize for IRA with LRA.
>
> 2014-08-27  Kito Cheng  <kito@0xlab.org>
>
>         * ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and
>         ira_spilled_reg_stack_slots_num if using lra.
>         (do_reload): Remove release ira_spilled_reg_stack_slots part.
>         * ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to
>         make sure not using lra.
>         (ira_reuse_stack_slot): Likewise.
>         (ira_mark_new_stack_slot): Likewise.

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

* Re: [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra.
  2014-09-03  9:26 ` Kito Cheng
@ 2014-09-03 15:19   ` Vladimir Makarov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2014-09-03 15:19 UTC (permalink / raw)
  To: Kito Cheng, gcc-patches

On 2014-09-03 5:26 AM, Kito Cheng wrote:
> ping!
>

The patch saves some compilation time for LRA based targets.  It is ok 
to commit.

Thanks, Kito.

> On Wed, Aug 27, 2014 at 10:49 PM, Kito Cheng <kito.cheng@gmail.com> wrote:
>> Hi all:
>>
>> This patch is clean up useless initialize for IRA with LRA.
>>
>> 2014-08-27  Kito Cheng  <kito@0xlab.org>
>>
>>          * ira.c (ira): Don't initialize ira_spilled_reg_stack_slots and
>>          ira_spilled_reg_stack_slots_num if using lra.
>>          (do_reload): Remove release ira_spilled_reg_stack_slots part.
>>          * ira-color.c (ira_sort_regnos_for_alter_reg): Add assertion to
>>          make sure not using lra.
>>          (ira_reuse_stack_slot): Likewise.
>>          (ira_mark_new_stack_slot): Likewise.

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

end of thread, other threads:[~2014-09-03 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-27 14:49 [PATCH] Don't init ira_spilled_reg_stack_slots in ira if using lra Kito Cheng
2014-09-03  9:26 ` Kito Cheng
2014-09-03 15:19   ` Vladimir Makarov

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).