X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbespillbelady3.c;h=2bac5bba474eb78216ef908c45d63721b529b2da;hb=0378ccc621a98322785250f96d85d3b32dc0cad1;hp=8f7c9c3ff4b8a232d2c6455e55d07f5a321b779f;hpb=d2c1b0191844c3c23731158a153838d570dcd65a;p=libfirm diff --git a/ir/be/bespillbelady3.c b/ir/be/bespillbelady3.c index 8f7c9c3ff..2bac5bba4 100644 --- a/ir/be/bespillbelady3.c +++ b/ir/be/bespillbelady3.c @@ -47,7 +47,7 @@ #include "bemodule.h" #include "bespill.h" #include "beutil.h" -#include "bespilloptions.h" +#include "bespillutil.h" #include "besched.h" #include "be_t.h" @@ -112,8 +112,7 @@ static bool should_have_reached_fixpoint; static worklist_t *new_worklist(void) { - worklist_t *worklist = obstack_alloc(&obst, sizeof(worklist[0])); - memset(worklist, 0, sizeof(worklist[0])); + worklist_t *worklist = OALLOCZ(&obst, worklist_t); INIT_LIST_HEAD(&worklist->live_values); worklist->n_live_values = 0; @@ -137,8 +136,7 @@ static block_info_t *get_block_info(ir_node *block) if (info != NULL) return info; - info = obstack_alloc(&obst, sizeof(info[0])); - memset(info, 0, sizeof(info[0])); + info = OALLOCZ(&obst, block_info_t); set_irn_link(block, info); return info; } @@ -200,8 +198,7 @@ static void fill_and_activate_worklist(worklist_t *new_worklist, if (irn_visited_else_mark(value)) continue; - new_entry = obstack_alloc(&obst, sizeof(new_entry[0])); - memset(new_entry, 0, sizeof(new_entry[0])); + new_entry = OALLOCZ(&obst, worklist_entry_t); new_entry->value = value; if (reload_point != NULL) { @@ -223,15 +220,13 @@ static worklist_t *duplicate_worklist(const worklist_t *worklist) worklist_t *new_worklist; struct list_head *entry; - new_worklist = obstack_alloc(&obst, sizeof(new_worklist[0])); - memset(new_worklist, 0, sizeof(new_worklist[0])); + new_worklist = OALLOCZ(&obst, worklist_t); INIT_LIST_HEAD(&new_worklist->live_values); new_worklist->n_live_values = worklist->n_live_values; list_for_each(entry, &worklist->live_values) { worklist_entry_t *wl_entry = list_entry(entry, worklist_entry_t, head); - worklist_entry_t *new_entry - = obstack_alloc(&obst, sizeof(new_entry[0])); + worklist_entry_t *new_entry = OALLOC(&obst, worklist_entry_t); memcpy(new_entry, wl_entry, sizeof(new_entry[0])); list_add_tail(&new_entry->head, &new_worklist->live_values); @@ -283,8 +278,7 @@ static loop_info_t *get_loop_info(ir_loop *loop) if (info != NULL) return info; - info = obstack_alloc(&obst, sizeof(info[0])); - memset(info, 0, sizeof(info[0])); + info = OALLOCZ(&obst, loop_info_t); info->loop = loop; loop->link = info; return info; @@ -330,8 +324,7 @@ static void construct_loop_edges(ir_node *block, void *data) do { loop_info_t *l_info = get_loop_info(l); - edge = obstack_alloc(&obst, sizeof(edge[0])); - memset(edge, 0, sizeof(edge[0])); + edge = OALLOCZ(&obst, loop_edge_t); edge->block = block; edge->pos = i; @@ -378,7 +371,7 @@ static void make_room(worklist_t *worklist, size_t room_needed) return; entry = worklist->live_values.next; - for(i = spills_needed; i > 0; --i) { + for (i = spills_needed; i > 0; --i) { struct list_head *next = entry->next; worklist_entry_t *wl_entry = list_entry(entry, worklist_entry_t, head); @@ -410,9 +403,7 @@ static void val_used(worklist_t *worklist, ir_node *value, ir_node *sched_point) list_del(&entry->head); } else { if (entry == NULL) { - entry = obstack_alloc(&obst, sizeof(entry[0])); - memset(entry, 0, sizeof(entry[0])); - + entry = OALLOCZ(&obst, worklist_entry_t); entry->value = value; set_irn_link(value, entry); } @@ -505,7 +496,7 @@ static void do_spilling(ir_node *block, worklist_t *worklist) /* put all values used by the instruction into the workset */ arity = get_irn_arity(node); - for(i = 0; i < arity; ++i) { + for (i = 0; i < arity; ++i) { ir_node *use = get_irn_n(node, i); if (!arch_irn_consider_in_reg_alloc(cls, use)) @@ -598,7 +589,7 @@ static worklist_t *construct_start_worklist(ir_node *block) ++worklist_visited; - while(fill_start_worklist(worklist, block)) { + while (fill_start_worklist(worklist, block)) { if (worklist->n_live_values >= n_regs) break; } @@ -747,9 +738,7 @@ static void worklist_append(worklist_t *worklist, ir_node *value, } #endif - entry = obstack_alloc(&obst, sizeof(*entry)); - memset(entry, 0, sizeof(entry[0])); - + entry = OALLOCZ(&obst, worklist_entry_t); entry->value = value; entry->reload_point = reload_point; entry->unused_livethrough_loop = unused_livethrough_loop;