Commit 86163b56 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Remove the thin wrapper macro arch_register_class_n_regs().

parent 4cd9a0a9
......@@ -236,9 +236,6 @@ struct arch_register_class_t {
arch_register_class_flags_t flags; /**< register class flags. */
};
/** return the number of registers in this register class */
#define arch_register_class_n_regs(cls) ((cls)->n_regs)
static inline const arch_register_t *arch_register_for_index(
const arch_register_class_t *cls, unsigned idx)
{
......@@ -288,8 +285,7 @@ static inline bool reg_reqs_equal(const arch_register_req_t *req1,
return false;
if (req1->limited != NULL) {
size_t const n_regs = arch_register_class_n_regs(req1->cls);
if (!rbitsets_equal(req1->limited, req2->limited, n_regs))
if (!rbitsets_equal(req1->limited, req2->limited, req1->cls->n_regs))
return false;
}
......
......@@ -137,7 +137,7 @@ static void sr_remove(ilp_env_t *const ienv)
static void sr_reinsert(ilp_env_t *const ienv)
{
/* color the removed nodes in right order */
unsigned const n_regs = arch_register_class_n_regs(ienv->co->cls);
unsigned const n_regs = ienv->co->cls->n_regs;
unsigned *const possible_cols = rbitset_alloca(n_regs);
unsigned const *const allocatable_cols = ienv->co->cenv->allocatable_regs->data;
be_ifg_t const *const ifg = ienv->co->cenv->ifg;
......
......@@ -70,7 +70,7 @@ static void build_coloring_cstr(ilp_env_t *ienv)
{
local_env_t *lenv = (local_env_t*)ienv->env;
be_ifg_t *ifg = ienv->co->cenv->ifg;
unsigned n_regs = arch_register_class_n_regs(ienv->co->cls);
unsigned n_regs = ienv->co->cls->n_regs;
const unsigned *allocatable_colors = lenv->allocatable_colors;
char buf[32];
......@@ -144,7 +144,7 @@ static void build_interference_cstr(ilp_env_t *ienv)
lpp_t *lpp = ienv->lp;
local_env_t *lenv = (local_env_t*)ienv->env;
be_ifg_t *ifg = ienv->co->cenv->ifg;
unsigned n_colors = arch_register_class_n_regs(ienv->co->cls);
unsigned n_colors = ienv->co->cls->n_regs;
ir_node **clique = ALLOCAN(ir_node*, n_colors);
const unsigned *allocatable_colors = lenv->allocatable_colors;
cliques_iter_t iter;
......@@ -219,7 +219,7 @@ static void make_affinity_var_name(char *buf, size_t buf_size,
*/
static void build_affinity_cstr(ilp_env_t *ienv)
{
unsigned n_colors = arch_register_class_n_regs(ienv->co->cls);
unsigned const n_colors = ienv->co->cls->n_regs;
/* for all optimization units */
list_for_each_entry(unit_t, curr, &ienv->co->units, units) {
......
......@@ -228,7 +228,7 @@ int be_ifg_cliques_begin(const be_ifg_t *ifg, cliques_iter_t *it,
it->blocks = (ir_node**)obstack_finish(&it->ob);
it->blk = 0;
it->bor = NULL;
it->living = pset_new_ptr(2 * arch_register_class_n_regs(it->cenv->cls));
it->living = pset_new_ptr(2 * it->cenv->cls->n_regs);
return get_next_clique(it);
}
......
......@@ -389,8 +389,7 @@ const arch_register_req_t *be_create_reg_req(struct obstack *obst,
const arch_register_t *reg, arch_register_req_type_t additional_types)
{
arch_register_class_t const *cls = reg->cls;
unsigned n_regs = arch_register_class_n_regs(cls);
unsigned *limited = rbitset_obstack_alloc(obst, n_regs);
unsigned *limited = rbitset_obstack_alloc(obst, cls->n_regs);
rbitset_set(limited, reg->index);
arch_register_req_t *req = OALLOC(obst, arch_register_req_t);
req->type = arch_register_req_type_limited | additional_types;
......
......@@ -80,7 +80,7 @@ typedef struct be_pbqp_alloc_env_t {
#define insert_edge(pbqp, src_node, trg_node, template_matrix) (add_edge_costs(pbqp, get_irn_idx(src_node), get_irn_idx(trg_node), pbqp_matrix_copy(pbqp, template_matrix)))
#define get_free_regs(restr_nodes, cls, irn) (arch_register_class_n_regs(cls) - restr_nodes[get_irn_idx(irn)])
#define get_free_regs(restr_nodes, cls, irn) ((cls)->n_regs - restr_nodes[get_irn_idx(irn)])
static const lc_opt_table_entry_t options[] = {
LC_OPT_ENT_BOOL("exec_freq", "use exec_freq", &use_exec_freq),
......@@ -122,7 +122,7 @@ static void create_pbqp_node(be_pbqp_alloc_env_t *pbqp_alloc_env, ir_node *irn)
arch_register_class_t const *const cls = pbqp_alloc_env->cls;
pbqp_t *const pbqp_inst = pbqp_alloc_env->pbqp_inst;
bitset_t const *const allocatable_regs = pbqp_alloc_env->allocatable_regs;
unsigned const colors_n = arch_register_class_n_regs(cls);
unsigned const colors_n = cls->n_regs;
unsigned cntConstrains = 0;
/* create costs vector depending on register constrains */
......@@ -188,8 +188,8 @@ static void insert_afe_edge(be_pbqp_alloc_env_t *pbqp_alloc_env, ir_node *src_no
pbqp_t *pbqp = pbqp_alloc_env->pbqp_inst;
const arch_register_class_t *cls = pbqp_alloc_env->cls;
unsigned *restr_nodes = pbqp_alloc_env->restr_nodes;
pbqp_matrix_t *afe_matrix = pbqp_matrix_alloc(pbqp, arch_register_class_n_regs(cls), arch_register_class_n_regs(cls));
unsigned colors_n = arch_register_class_n_regs(cls);
unsigned colors_n = cls->n_regs;
pbqp_matrix_t *afe_matrix = pbqp_matrix_alloc(pbqp, colors_n, colors_n);
if (get_edge(pbqp, get_irn_idx(src_node), get_irn_idx(trg_node)) == NULL) {
if (use_exec_freq) {
......@@ -532,7 +532,7 @@ static void be_pbqp_coloring(be_chordal_env_t *env)
ir_graph *irg = env->irg;
const arch_register_class_t *cls = env->cls;
be_lv_t *lv = NULL;
unsigned colors_n = arch_register_class_n_regs(cls);
unsigned colors_n = cls->n_regs;
be_pbqp_alloc_env_t pbqp_alloc_env;
unsigned col;
unsigned row;
......
......@@ -1828,7 +1828,7 @@ static void be_pref_alloc(ir_graph *new_irg)
stat_ev_ctx_push_str("regcls", cls->name);
n_regs = arch_register_class_n_regs(cls);
n_regs = cls->n_regs;
normal_regs = rbitset_malloc(n_regs);
be_get_allocatable_regs(irg, cls, normal_regs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment