gcc/ChangeLog: 2015-04-30 Martin Liska <mli...@suse.cz>
* ira-color.c (init_update_cost_records):Use new type-based pool allocator. (get_update_cost_record) Likewise. (free_update_cost_record_list) Likewise. (finish_update_cost_records) Likewise. (initiate_cost_update) Likewise. --- gcc/ira-color.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/gcc/ira-color.c b/gcc/ira-color.c index b719e7a..4750714 100644 --- a/gcc/ira-color.c +++ b/gcc/ira-color.c @@ -123,21 +123,6 @@ struct update_cost_record int divisor; /* Next record for given allocno. */ struct update_cost_record *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((update_cost_record *) ptr); - } - - /* Memory allocation pool. */ - static pool_allocator<update_cost_record> pool; }; /* To decrease footprint of ira_allocno structure we store all data @@ -1181,16 +1166,25 @@ setup_profitable_hard_regs (void) allocnos. */ /* Pool for update cost records. */ -pool_allocator<update_cost_record> update_cost_record::pool - ("update cost records", 100); +static alloc_pool update_cost_record_pool; + +/* Initiate update cost records. */ +static void +init_update_cost_records (void) +{ + update_cost_record_pool + = create_alloc_pool ("update cost records", + sizeof (struct update_cost_record), 100); +} /* Return new update cost record with given params. */ static struct update_cost_record * get_update_cost_record (int hard_regno, int divisor, struct update_cost_record *next) { - update_cost_record *record = new update_cost_record; + struct update_cost_record *record; + record = (struct update_cost_record *) pool_alloc (update_cost_record_pool); record->hard_regno = hard_regno; record->divisor = divisor; record->next = next; @@ -1206,7 +1200,7 @@ free_update_cost_record_list (struct update_cost_record *list) while (list != NULL) { next = list->next; - delete list; + pool_free (update_cost_record_pool, list); list = next; } } @@ -1215,7 +1209,7 @@ free_update_cost_record_list (struct update_cost_record *list) static void finish_update_cost_records (void) { - update_cost_record::pool.release (); + free_alloc_pool (update_cost_record_pool); } /* Array whose element value is TRUE if the corresponding hard @@ -1270,6 +1264,7 @@ initiate_cost_update (void) = (struct update_cost_queue_elem *) ira_allocate (size); memset (update_cost_queue_elems, 0, size); update_cost_check = 0; + init_update_cost_records (); } /* Deallocate data used by function update_costs_from_copies. */ -- 2.1.4