public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 03/35] Change use to type-based pool allocator in lra-lives.c.
Date: Fri, 29 May 2015 13:34:00 -0000	[thread overview]
Message-ID: <55686A76.5080709@suse.cz> (raw)
In-Reply-To: <55660322.702@redhat.com>

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

On 05/27/2015 07:47 PM, Jeff Law wrote:
> On 05/27/2015 07:56 AM, mliska wrote:
>> gcc/ChangeLog:
>>
>> 2015-04-30  Martin Liska  <mliska@suse.cz>
>>
>>     * lra-lives.c (free_live_range): Use new type-based pool allocator.
>>     (free_live_range_list) Likewise.
>>     (create_live_range) Likewise.
>>     (copy_live_range) Likewise.
>>     (lra_merge_live_ranges) Likewise.
>>     (remove_some_program_points_and_update_live_ranges) Likewise.
>>     (lra_live_ranges_init) Likewise.
>>     (lra_live_ranges_finish) Likewise.
> OK.
> jeff
>

v2.

[-- Attachment #2: 0003-Change-use-to-type-based-pool-allocator-in-lra-lives.patch --]
[-- Type: text/x-patch, Size: 5747 bytes --]

From f44535e764581a661d42b6d8a03bdf0de78d9789 Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Wed, 27 May 2015 15:56:44 +0200
Subject: [PATCH 03/32] Change use to type-based pool allocator in lra-lives.c.

gcc/ChangeLog:

2015-04-30  Martin Liska  <mliska@suse.cz>

	* lra-lives.c (free_live_range): Use new type-based pool allocator.
	(free_live_range_list) Likewise.
	(create_live_range) Likewise.
	(copy_live_range) Likewise.
	(lra_merge_live_ranges) Likewise.
	(remove_some_program_points_and_update_live_ranges) Likewise.
	(lra_live_ranges_init) Likewise.
	(lra_live_ranges_finish) Likewise.
---
 gcc/lra-coalesce.c |  1 +
 gcc/lra-int.h      | 15 +++++++++++++++
 gcc/lra-lives.c    | 35 ++++++++++-------------------------
 gcc/lra-spills.c   |  1 +
 gcc/lra.c          |  1 +
 5 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/gcc/lra-coalesce.c b/gcc/lra-coalesce.c
index 045691d..b385603 100644
--- a/gcc/lra-coalesce.c
+++ b/gcc/lra-coalesce.c
@@ -84,6 +84,7 @@ along with GCC; see the file COPYING3.	If not see
 #include "except.h"
 #include "timevar.h"
 #include "ira.h"
+#include "alloc-pool.h"
 #include "lra-int.h"
 #include "df.h"
 
diff --git a/gcc/lra-int.h b/gcc/lra-int.h
index 12923ee..42e4a54 100644
--- a/gcc/lra-int.h
+++ b/gcc/lra-int.h
@@ -54,6 +54,21 @@ struct lra_live_range
   lra_live_range_t next;
   /* Pointer to structures with the same start.	 */
   lra_live_range_t start_next;
+
+  /* Pool allocation new operator.  */
+  inline void *operator new (size_t)
+  {
+    return pool.allocate ();
+  }
+
+  /* Delete operator utilizing pool allocation.  */
+  inline void operator delete (void *ptr)
+  {
+    pool.remove ((lra_live_range *) ptr);
+  }
+
+  /* Memory allocation pool.  */
+  static pool_allocator<lra_live_range> pool;
 };
 
 typedef struct lra_copy *lra_copy_t;
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 085411e..4dfe30f 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -121,14 +121,7 @@ static sparseset unused_set, dead_set;
 static bitmap_head temp_bitmap;
 
 /* Pool for pseudo live ranges.	 */
-static alloc_pool live_range_pool;
-
-/* Free live range LR.	*/
-static void
-free_live_range (lra_live_range_t lr)
-{
-  pool_free (live_range_pool, lr);
-}
+pool_allocator <lra_live_range> lra_live_range::pool ("live ranges", 100);
 
 /* Free live range list LR.  */
 static void
@@ -139,7 +132,7 @@ free_live_range_list (lra_live_range_t lr)
   while (lr != NULL)
     {
       next = lr->next;
-      free_live_range (lr);
+      delete lr;
       lr = next;
     }
 }
@@ -148,9 +141,7 @@ free_live_range_list (lra_live_range_t lr)
 static lra_live_range_t
 create_live_range (int regno, int start, int finish, lra_live_range_t next)
 {
-  lra_live_range_t p;
-
-  p = (lra_live_range_t) pool_alloc (live_range_pool);
+  lra_live_range_t p = new lra_live_range;
   p->regno = regno;
   p->start = start;
   p->finish = finish;
@@ -162,11 +153,7 @@ create_live_range (int regno, int start, int finish, lra_live_range_t next)
 static lra_live_range_t
 copy_live_range (lra_live_range_t r)
 {
-  lra_live_range_t p;
-
-  p = (lra_live_range_t) pool_alloc (live_range_pool);
-  *p = *r;
-  return p;
+  return new lra_live_range (*r);
 }
 
 /* Copy live range list given by its head R and return the result.  */
@@ -209,7 +196,7 @@ lra_merge_live_ranges (lra_live_range_t r1, lra_live_range_t r2)
 	  r1->start = r2->start;
 	  lra_live_range_t temp = r2;
 	  r2 = r2->next;
-	  pool_free (live_range_pool, temp);
+	  delete temp;
 	}
       else
 	{
@@ -480,7 +467,7 @@ live_con_fun_n (edge e)
   basic_block dest = e->dest;
   bitmap bb_liveout = df_get_live_out (bb);
   bitmap dest_livein = df_get_live_in (dest);
-  
+
   return bitmap_ior_and_compl_into (bb_liveout,
 				    dest_livein, &all_hard_regs_bitmap);
 }
@@ -1024,7 +1011,7 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
       if (sparseset_bit_p (pseudos_live_through_calls, j))
 	check_pseudos_live_through_calls (j);
     }
-  
+
   if (need_curr_point_incr)
     next_program_point (curr_point, freq);
 
@@ -1109,7 +1096,7 @@ remove_some_program_points_and_update_live_ranges (void)
 		}
 	      prev_r->start = r->start;
 	      prev_r->next = next_r;
-	      free_live_range (r);
+	      delete r;
 	    }
 	}
     }
@@ -1252,7 +1239,7 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
 	}
     }
   lra_free_copies ();
- 
+
   /* Under some circumstances, we can have functions without pseudo
      registers.  For such functions, lra_live_max_point will be 0,
      see e.g. PR55604, and there's nothing more to do for us here.  */
@@ -1380,8 +1367,6 @@ lra_clear_live_ranges (void)
 void
 lra_live_ranges_init (void)
 {
-  live_range_pool = create_alloc_pool ("live ranges",
-				       sizeof (struct lra_live_range), 100);
   bitmap_initialize (&temp_bitmap, &reg_obstack);
   initiate_live_solver ();
 }
@@ -1392,5 +1377,5 @@ lra_live_ranges_finish (void)
 {
   finish_live_solver ();
   bitmap_clear (&temp_bitmap);
-  free_alloc_pool (live_range_pool);
+  lra_live_range::pool.release ();
 }
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 19ece20..caece9a 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -98,6 +98,7 @@ along with GCC; see the file COPYING3.	If not see
 #include "except.h"
 #include "timevar.h"
 #include "target.h"
+#include "alloc-pool.h"
 #include "lra-int.h"
 #include "ira.h"
 #include "df.h"
diff --git a/gcc/lra.c b/gcc/lra.c
index 7c33636..7440668 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -149,6 +149,7 @@ along with GCC; see the file COPYING3.	If not see
 #include "timevar.h"
 #include "target.h"
 #include "ira.h"
+#include "alloc-pool.h"
 #include "lra-int.h"
 #include "df.h"
 
-- 
2.1.4


  reply	other threads:[~2015-05-29 13:32 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 14:09 [PATCH 01/35] Introduce new type-based pool allocator mliska
2015-05-27 14:00 ` [PATCH 04/35] Change use to type-based pool allocator in lra.c mliska
2015-05-27 17:55   ` Jeff Law
2015-05-29 13:34     ` Martin Liška
2015-05-27 14:00 ` [PATCH 03/35] Change use to type-based pool allocator in lra-lives.c mliska
2015-05-27 17:53   ` Jeff Law
2015-05-29 13:34     ` Martin Liška [this message]
2015-05-28  0:48   ` Trevor Saunders
2015-05-27 14:00 ` [PATCH 06/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 14:00 ` [PATCH 09/35] Change use to type-based pool allocator in c-format.c mliska
2015-05-27 14:16   ` Jakub Jelinek
2015-05-27 18:01   ` Jeff Law
2015-05-29 13:35     ` Martin Liška
2015-05-27 14:00 ` [PATCH 12/35] Change use to type-based pool allocator in cselib.c mliska
2015-05-29 13:38   ` Martin Liška
2015-05-27 14:00 ` [PATCH 10/35] Change use to type-based pool allocator in cfg.c mliska
2015-05-27 18:01   ` Jeff Law
2015-05-29 13:34     ` Martin Liška
2015-05-27 14:07 ` [PATCH 19/35] Change use to type-based pool allocator in sel-sched-ir.c mliska
2015-05-27 18:12   ` Jeff Law
2015-05-29 13:40     ` Martin Liška
2015-05-27 14:09 ` [PATCH 02/35] Change use to type-based pool allocator in et-forest.c mliska
2015-05-27 17:50   ` Jeff Law
2015-05-29 13:33     ` Martin Liška
2015-05-27 14:15 ` [PATCH 05/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 17:59   ` Jeff Law
2015-05-29 13:34     ` Martin Liška
2015-05-27 14:17 ` [PATCH 28/35] Change use to type-based pool allocator in ipa-profile.c mliska
2015-05-27 18:18   ` Jeff Law
2015-05-29 13:42     ` Martin Liška
2015-05-27 14:17 ` [PATCH 21/35] Change use to type-based pool allocator in regcprop.c mliska
2015-05-27 18:14   ` Jeff Law
2015-05-29 13:40     ` Martin Liška
2015-05-27 14:17 ` [PATCH 23/35] Change use to type-based pool allocator in tree-ssa-pre.c mliska
2015-05-27 18:59   ` Jeff Law
2015-05-29 13:41     ` Martin Liška
2015-05-27 14:17 ` [PATCH 34/35] Change use to type-based pool allocator in ira-build.c mliska
2015-05-27 14:17 ` [PATCH 32/35] " mliska
2015-05-27 19:34   ` Jeff Law
2015-05-29 13:44     ` Martin Liška
2015-05-27 14:17 ` [PATCH 35/35] Remove old pool allocator mliska
2015-05-27 19:40   ` Jeff Law
2015-05-29 14:11     ` Martin Liška
2015-05-27 14:18 ` [PATCH 27/35] Change use to type-based pool allocator in tree-ssa-structalias.c mliska
2015-05-27 18:20   ` Jeff Law
2015-05-29 13:42     ` Martin Liška
2015-05-27 14:19 ` [PATCH 14/35] Change use to type-based pool allocator in df-scan.c mliska
2015-05-29 13:38   ` Martin Liška
2015-05-27 14:19 ` [PATCH 11/35] Change use to type-based pool allocator in sh.c mliska
2015-05-27 18:03   ` Jeff Law
2015-05-29 13:37     ` Martin Liška
2015-05-27 14:19 ` [PATCH 25/35] Change use to type-based pool allocator in tree-ssa-sccvn.c mliska
2015-05-27 18:16   ` Jeff Law
2015-05-29 13:41     ` Martin Liška
2015-05-27 14:19 ` [PATCH 08/35] Change use to type-based pool allocator in asan.c mliska
2015-05-27 18:01   ` Jeff Law
2015-05-27 14:20 ` [PATCH 29/35] Change use to type-based pool allocator in ipa-prop.c mliska
2015-05-27 18:22   ` Jeff Law
2015-05-29 13:42     ` Martin Liška
2015-05-27 14:20 ` [PATCH 07/35] Change use to type-based pool allocator in var-tracking.c mliska
2015-05-29 13:34   ` Martin Liška
2015-05-27 14:20 ` [PATCH 31/35] Change use to type-based pool allocator in ipa-prop.c and ipa-cp.c mliska
2015-05-29 14:09   ` Martin Liška
2015-05-27 14:21 ` [PATCH 26/35] Change use to type-based pool allocator in tree-ssa-strlen.c mliska
2015-05-27 18:17   ` Jeff Law
2015-05-29 13:42   ` Martin Liška
2015-05-27 14:21 ` [PATCH 18/35] Change use to type-based pool allocator in stmt.c mliska
2015-05-27 18:13   ` Jeff Law
2015-05-29 13:39     ` Martin Liška
2015-05-27 14:21 ` [PATCH 15/35] Change use to type-based pool allocator in dse.c mliska
2015-05-29 13:38   ` Martin Liška
2015-05-27 14:21 ` [PATCH 16/35] Change use to type-based pool allocator in tree-sra.c mliska
2015-05-27 18:11   ` Jeff Law
2015-05-29 13:39     ` Martin Liška
2015-05-27 14:21 ` [PATCH 20/35] Change use to type-based pool allocator in ira-build.c mliska
2015-05-27 18:15   ` Jeff Law
2015-05-29 13:39     ` Martin Liška
2015-05-27 14:21 ` [PATCH 30/35] Change use to type-based pool allocator in ipa-inline-analysis.c mliska
2015-05-29 14:06   ` Martin Liška
2015-05-27 14:21 ` [PATCH 24/35] Change use to type-based pool allocator in tree-ssa-reassoc.c mliska
2015-05-27 18:15   ` Jeff Law
2015-05-29 13:41     ` Martin Liška
2015-05-27 14:42 ` [PATCH 22/35] Change use to type-based pool allocator in sched-deps.c mliska
2015-05-27 18:16   ` Jeff Law
2015-05-29 13:40     ` Martin Liška
2015-05-27 14:55 ` [PATCH 17/35] Change use to type-based pool allocator in tree-ssa-math-opts.c mliska
2015-05-27 18:12   ` Jeff Law
2015-05-29 13:39     ` Martin Liška
2015-05-27 14:58 ` [PATCH 33/35] Change use to type-based pool allocator in ira-color.c mliska
2015-05-27 18:24   ` Jeff Law
2015-05-28 11:23   ` Statically-allocated objects with non-trivial ctors (was Re: [PATCH 33/35] Change use to type-based pool allocator in ira-color.c.) David Malcolm
2015-05-28 17:38     ` Jeff Law
2015-05-28 18:30       ` Richard Biener
2015-05-28 18:34         ` Jakub Jelinek
2015-05-28 19:25           ` Martin Liška
2015-05-28 20:42             ` Trevor Saunders
2015-05-29  5:16     ` Trevor Saunders
2015-05-27 15:04 ` [PATCH 13/35] Change use to type-based pool allocator in df-problems.c mliska
2015-05-27 18:05   ` Jeff Law
2015-05-29 13:37     ` Martin Liška
2015-05-27 17:50 ` [PATCH 01/35] Introduce new type-based pool allocator Jeff Law
2015-05-28 13:27   ` Martin Liška
2015-05-28 18:04     ` Jeff Law
2015-05-29 13:33       ` Martin Liška
2015-05-30  5:14         ` Jeff Law
2015-06-02 10:10         ` Andreas Schwab
2015-06-02 13:57           ` Martin Liška
2015-06-02 14:00             ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55686A76.5080709@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).