Use alloc-pool for lra_insn_recog_data
diff mbox series

Message ID nycvar.YFH.7.76.1911210919030.5566@zhemvz.fhfr.qr
State New
Headers show
Series
  • Use alloc-pool for lra_insn_recog_data
Related show

Commit Message

Richard Biener Nov. 21, 2019, 8:21 a.m. UTC
This eliminates one of the top callers for malloc when building
tramp3d.  We're using alloc-pools for other structures already
so it looks somewhat obvious to also do for lra_insn_recog_data.

Bootstrapped / tested on x86_64-unknown-linux-gnu.

OK?

Thanks,
Richard.

2019-11-21  Richard Biener  <rguenther@suse.de>

	* lra.c (lra_insn_recog_data_pool): New.
	(free_insn_recog_data): Adjust.
	(finish_insn_recog_data): Release lra_insn_recog_data_pool.
	(lra_set_insn_recog_data): Allocate from lra_insn_recog_data_pool.

Comments

Vladimir Makarov Nov. 21, 2019, 2:21 p.m. UTC | #1
On 11/21/19 3:21 AM, Richard Biener wrote:
> This eliminates one of the top callers for malloc when building
> tramp3d.  We're using alloc-pools for other structures already
> so it looks somewhat obvious to also do for lra_insn_recog_data.
>
> Bootstrapped / tested on x86_64-unknown-linux-gnu.
>
> OK?
>
Sure. Thank you, Richard.

Patch
diff mbox series

Index: gcc/lra.c
===================================================================
--- gcc/lra.c	(revision 278496)
+++ gcc/lra.c	(working copy)
@@ -714,6 +714,10 @@  int lra_insn_recog_data_len;
 /* Map INSN_UID -> the insn recog data (NULL if unknown).  */
 lra_insn_recog_data_t *lra_insn_recog_data;
 
+/* Alloc pool we allocate entries for lra_insn_recog_data from.  */
+static object_allocator<class lra_insn_recog_data>
+  lra_insn_recog_data_pool ("insn recog data pool");
+
 /* Initialize LRA data about insns.  */
 static void
 init_insn_recog_data (void)
@@ -759,7 +763,7 @@  free_insn_recog_data (lra_insn_recog_dat
     }
   free_insn_regs (data->regs);
   data->regs = NULL;
-  free (data);
+  lra_insn_recog_data_pool.remove (data);
 }
 
 /* Pools for copies.  */
@@ -778,6 +782,7 @@  finish_insn_recog_data (void)
   finish_insn_regs ();
   lra_copy_pool.release ();
   lra_insn_reg_pool.release ();
+  lra_insn_recog_data_pool.release ();
   free (lra_insn_recog_data);
 }
 
@@ -952,7 +957,7 @@  lra_set_insn_recog_data (rtx_insn *insn)
 	/* It might be a new simple insn which is not recognized yet.  */
 	INSN_CODE (insn) = icode = recog_memoized (insn);
     }
-  data = XNEW (class lra_insn_recog_data);
+  data = lra_insn_recog_data_pool.allocate ();
   lra_insn_recog_data[uid] = data;
   data->insn = insn;
   data->used_insn_alternative = LRA_UNKNOWN_ALT;