X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbecopyheur3.c;h=d8de8b2af31a424df10d1fff5678fe5c9876217c;hb=2520206c7812537b08088ffac1aa6c94d1446ded;hp=73b7835b2ac24a4359d25576632d959f90a317b1;hpb=6981dd3274e6753e50f66c8cbe17b37bd41708e5;p=libfirm diff --git a/ir/be/becopyheur3.c b/ir/be/becopyheur3.c index 73b7835b2..d8de8b2af 100644 --- a/ir/be/becopyheur3.c +++ b/ir/be/becopyheur3.c @@ -1,10 +1,29 @@ +/* + * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ /** - * More experiments on coalescing. - * @author Sebastian Hack - * @date 25.07.2006 + * @file + * @brief More experiments on coalescing with Java implementation. + * @author Sebastian Hack + * @date 25.07.2006 + * @version $Id$ */ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -22,8 +41,8 @@ #include "debug.h" #include "bitfiddle.h" #include "bitset.h" +#include "raw_bitset.h" -#include "irphase_t.h" #include "irgraph_t.h" #include "irnode_t.h" #include "irprintf.h" @@ -61,7 +80,7 @@ static lc_opt_enum_mask_var_t dump_var = { static const lc_opt_table_entry_t options[] = { LC_OPT_ENT_ENUM_MASK("dump", "dump ifg cloud", &dump_var), LC_OPT_ENT_INT ("dbg", "debug level for the Java coalescer", &dbg_level), - { NULL } + LC_OPT_LAST }; void be_init_copyheur3(void) @@ -78,20 +97,20 @@ BE_REGISTER_MODULE_CONSTRUCTOR(be_init_copyheur3); static void set_admissible_regs(be_java_coal_t *coal, copy_opt_t *co, ir_node *irn, int t_idx, int *col_map) { - unsigned i; - arch_register_req_t req; - unsigned n_regs = co->cls->n_regs; + const arch_register_req_t *req; + + req = arch_get_register_req(co->aenv, irn, BE_OUT_POS(0)); // ir_printf("%+F\n", irn); - arch_get_register_req(co->aenv, &req, irn, BE_OUT_POS(0)); - if(arch_register_req_is(&req, limited)) { - bitset_t *adm = bitset_alloca(n_regs); - req.limited(req.limited_env, adm); - for(i = 0; i < n_regs; ++i) - if(!bitset_is_set(adm, i) && col_map[i] >= 0) { - // printf("\tforbidding color: %d\n", i); + if(arch_register_req_is(req, limited)) { + unsigned i; + unsigned n_regs = co->cls->n_regs; + + for(i = 0; i < n_regs; ++i) { + if(!rbitset_is_set(req->limited, i) && col_map[i] >= 0) { be_java_coal_forbid_color(coal, t_idx, col_map[i]); } + } } } @@ -129,8 +148,8 @@ int co_solve_heuristic_java(copy_opt_t *co) } } - node_map = malloc((get_irg_last_idx(co->irg) + 1) * sizeof(node_map[0])); - inv_node_map = malloc((get_irg_last_idx(co->irg) + 1) * sizeof(inv_node_map[0])); + node_map = xmalloc((get_irg_last_idx(co->irg) + 1) * sizeof(node_map[0])); + inv_node_map = xmalloc((get_irg_last_idx(co->irg) + 1) * sizeof(inv_node_map[0])); curr_idx = 0; be_ifg_foreach_node(ifg, nodes_it, n) {