projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add and fix some comments.
[libfirm]
/
ir
/
be
/
bespill.c
diff --git
a/ir/be/bespill.c
b/ir/be/bespill.c
index
0bbb445
..
4eecd8e
100644
(file)
--- a/
ir/be/bespill.c
+++ b/
ir/be/bespill.c
@@
-50,7
+50,7
@@
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
typedef struct be_pre_spill_env_t {
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
typedef struct be_pre_spill_env_t {
-
be_irg_t *b
irg;
+
ir_graph *
irg;
const arch_register_class_t *cls;
} be_pre_spill_env_t;
const arch_register_class_t *cls;
} be_pre_spill_env_t;
@@
-58,8
+58,9
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
{
const arch_register_class_t *cls = env->cls;
ir_node *block = get_nodes_block(node);
{
const arch_register_class_t *cls = env->cls;
ir_node *block = get_nodes_block(node);
- const be_irg_t *birg = env->birg;
- be_lv_t *lv = birg->lv;
+ const ir_graph *irg = env->irg;
+ be_irg_t *birg = be_birg_from_irg(irg);
+ be_lv_t *lv = be_get_irg_liveness(irg);
unsigned *tmp = NULL;
unsigned *def_constr = NULL;
int arity = get_irn_arity(node);
unsigned *tmp = NULL;
unsigned *def_constr = NULL;
int arity = get_irn_arity(node);
@@
-70,15
+71,14
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
* fullfil the constraint
* (typical example: stack pointer as input to copyb)
* TODO: This really just checks precolored registers at the moment and
* fullfil the constraint
* (typical example: stack pointer as input to copyb)
* TODO: This really just checks precolored registers at the moment and
- * ignore the general case of not matching in/out constraints
+ * ignore
s
the general case of not matching in/out constraints
*/
for (i = 0; i < arity; ++i) {
*/
for (i = 0; i < arity; ++i) {
- ir_node
*op
= get_irn_n(node, i);
-
ir_node *copy
;
- const arch_register_t *reg;
-
const arch_register_req_t *req
;
+ ir_node
*op
= get_irn_n(node, i);
+
const arch_register_req_t *req = arch_get_register_req(node, i)
;
+ const arch_register_t
*reg;
+
ir_node *copy
;
- req = arch_get_register_req(node, i);
if (req->cls != cls)
continue;
reg = arch_get_irn_register(op);
if (req->cls != cls)
continue;
reg = arch_get_irn_register(op);
@@
-87,8
+87,8
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
/* precolored with an ignore register (which is not a joker like
unknown/noreg) */
/* precolored with an ignore register (which is not a joker like
unknown/noreg) */
- if (
arch_register_type_is(reg, joker)
-
|| !arch_register_type_is(reg, ignore
))
+ if (
(reg->type & arch_register_type_joker) ||
+
rbitset_is_set(birg->allocatable_regs, reg->global_index
))
continue;
if (! (req->type & arch_register_req_type_limited))
continue;
if (! (req->type & arch_register_req_type_limited))
@@
-100,7
+100,8
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
stat_ev_int("constr_copy", 1);
sched_add_before(node, copy);
set_irn_n(node, i, copy);
- DBG((dbg, LEVEL_3, "inserting ignore arg copy %+F for %+F pos %d\n", copy, node, i));
+ DBG((dbg, LEVEL_3, "inserting ignore arg copy %+F for %+F pos %d\n",
+ copy, node, i));
}
/* insert copies for nodes that occur constrained more than once. */
}
/* insert copies for nodes that occur constrained more than once. */
@@
-232,21
+233,20
@@
static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node)
static void pre_spill_prepare_constr_walker(ir_node *block, void *data)
{
static void pre_spill_prepare_constr_walker(ir_node *block, void *data)
{
- be_pre_spill_env_t *env = data;
+ be_pre_spill_env_t *env =
(be_pre_spill_env_t*)
data;
ir_node *node;
sched_foreach(block, node) {
prepare_constr_insn(env, node);
}
}
ir_node *node;
sched_foreach(block, node) {
prepare_constr_insn(env, node);
}
}
-void be_pre_spill_prepare_constr(
be_irg_t *b
irg,
+void be_pre_spill_prepare_constr(
ir_graph *
irg,
const arch_register_class_t *cls)
{
const arch_register_class_t *cls)
{
- ir_graph *irg = birg->irg;
be_pre_spill_env_t env;
memset(&env, 0, sizeof(env));
be_pre_spill_env_t env;
memset(&env, 0, sizeof(env));
- env.
birg = b
irg;
- env.cls
= cls;
+ env.
irg =
irg;
+ env.cls = cls;
be_assure_liveness(irg);
be_assure_liveness(irg);
@@
-274,11
+274,11
@@
void be_register_spiller(const char *name, be_spiller_t *spiller)
be_add_module_to_list(&spillers, name, spiller);
}
be_add_module_to_list(&spillers, name, spiller);
}
-void be_do_spill(
be_irg_t *b
irg, const arch_register_class_t *cls)
+void be_do_spill(
ir_graph *
irg, const arch_register_class_t *cls)
{
assert(selected_spiller != NULL);
{
assert(selected_spiller != NULL);
- selected_spiller->spill(
b
irg, cls);
+ selected_spiller->spill(irg, cls);
}
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);
}
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions);