projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
beabi requires out edges
[libfirm]
/
ir
/
be
/
bestate.c
diff --git
a/ir/be/bestate.c
b/ir/be/bestate.c
index
e2ea5d0
..
69e3e09
100644
(file)
--- a/
ir/be/bestate.c
+++ b/
ir/be/bestate.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1995-20
08
University of Karlsruhe. All right reserved.
+ * Copyright (C) 1995-20
11
University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
*
* This file is part of libFirm.
*
@@
-47,6
+47,7
@@
#include "belive_t.h"
#include "bemodule.h"
#include "benode.h"
#include "belive_t.h"
#include "bemodule.h"
#include "benode.h"
+#include "beirgmod.h"
#include "bessaconstr.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
#include "bessaconstr.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
@@
-161,6
+162,7
@@
static void spill_phi(minibelady_env_t *env, ir_node *phi)
ir_node *block = get_nodes_block(phi);
int arity = get_irn_arity(phi);
ir_node **in = ALLOCAN(ir_node*, arity);
ir_node *block = get_nodes_block(phi);
int arity = get_irn_arity(phi);
ir_node **in = ALLOCAN(ir_node*, arity);
+ ir_node *dummy = new_r_Dummy(irg, mode_M);
ir_node *spill_to_kill = NULL;
spill_info_t *spill_info;
int i;
ir_node *spill_to_kill = NULL;
spill_info_t *spill_info;
int i;
@@
-175,13
+177,14
@@
static void spill_phi(minibelady_env_t *env, ir_node *phi)
/* create a new phi-M with bad preds */
for (i = 0; i < arity; ++i) {
/* create a new phi-M with bad preds */
for (i = 0; i < arity; ++i) {
- in[i] =
new_r_Unknown(irg, mode_M)
;
+ in[i] =
dummy
;
}
DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
/* create a Phi-M */
}
DBG((dbg, LEVEL_2, "\tcreate Phi-M for %+F\n", phi));
/* create a Phi-M */
- spill_info->spill = new_r_Phi(block, arity, in, mode_M);
+ spill_info->spill = be_new_Phi(block, arity, in, mode_M, NULL);
+ sched_add_after(block, spill_info->spill);
if (spill_to_kill != NULL) {
exchange(spill_to_kill, spill_info->spill);
if (spill_to_kill != NULL) {
exchange(spill_to_kill, spill_info->spill);
@@
-202,7
+205,7
@@
static void belady(minibelady_env_t *env, ir_node *block);
* Collects all values live-in at block @p block and all phi results in this
* block.
* Then it adds the best values (at most n_regs) to the blocks start_workset.
* Collects all values live-in at block @p block and all phi results in this
* block.
* Then it adds the best values (at most n_regs) to the blocks start_workset.
- * The phis among the remaining values get spilled: Introduce psudo-copies of
+ * The phis among the remaining values get spilled: Introduce ps
e
udo-copies of
* their args to break interference and make it possible to spill them to the
* same spill slot.
*/
* their args to break interference and make it possible to spill them to the
* same spill slot.
*/
@@
-259,7
+262,7
@@
static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
continue;
DBG((dbg, LEVEL_2, "\t...checking %+F\n", node));
continue;
DBG((dbg, LEVEL_2, "\t...checking %+F\n", node));
- next_use = be_get_next_use(env->uses, first,
0,
node, 0);
+ next_use = be_get_next_use(env->uses, first, node, 0);
if (USES_IS_INFINITE(next_use.time)) {
DBG((dbg, LEVEL_2, "\tnot taken (dead)\n"));
if (USES_IS_INFINITE(next_use.time)) {
DBG((dbg, LEVEL_2, "\tnot taken (dead)\n"));
@@
-309,7
+312,7
@@
static block_info_t *compute_block_start_state(minibelady_env_t *env, ir_node *b
continue;
DBG((dbg, LEVEL_2, "\t...checking %+F\n", node));
continue;
DBG((dbg, LEVEL_2, "\t...checking %+F\n", node));
- next_use = be_get_next_use(env->uses, first,
0,
node, 0);
+ next_use = be_get_next_use(env->uses, first, node, 0);
if (USES_IS_INFINITE(next_use.time)) {
DBG((dbg, LEVEL_2, "\tnot taken (dead)\n"));
if (USES_IS_INFINITE(next_use.time)) {
DBG((dbg, LEVEL_2, "\tnot taken (dead)\n"));
@@
-404,8
+407,9
@@
static void belady(minibelady_env_t *env, ir_node *block)
}
/* create a reload to match state if necessary */
if (need_val != NULL && need_val != current_state) {
}
/* create a reload to match state if necessary */
if (need_val != NULL && need_val != current_state) {
+ ir_node *before = node;
DBG((dbg, LEVEL_3, "\t... reloading %+F\n", need_val));
DBG((dbg, LEVEL_3, "\t... reloading %+F\n", need_val));
- create_reload(env, need_val,
nod
e, current_state);
+ create_reload(env, need_val,
befor
e, current_state);
current_state = need_val;
}
current_state = need_val;
}
@@
-472,7
+476,7
@@
static ir_node *get_end_of_block_insertion_point(ir_node *block)
*/
static void fix_block_borders(ir_node *block, void *data)
{
*/
static void fix_block_borders(ir_node *block, void *data)
{
- minibelady_env_t *env = data;
+ minibelady_env_t *env =
(minibelady_env_t*)
data;
ir_graph *irg = get_irn_irg(block);
ir_node *startblock = get_irg_start_block(irg);
int i;
ir_graph *irg = get_irn_irg(block);
ir_node *startblock = get_irg_start_block(irg);
int i;
@@
-556,7
+560,7
@@
void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
info = env.spills;
while (info != NULL) {
be_ssa_construction_env_t senv;
info = env.spills;
while (info != NULL) {
be_ssa_construction_env_t senv;
-
in
t i, len;
+
size_
t i, len;
ir_node **phis;
be_ssa_construction_init(&senv, irg);
ir_node **phis;
be_ssa_construction_init(&senv, irg);
@@
-598,7
+602,7
@@
void be_assure_state(ir_graph *irg, const arch_register_t *reg, void *func_env,
obstack_free(&env.obst, NULL);
}
obstack_free(&env.obst, NULL);
}
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state)
;
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_state)
void be_init_state(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.state");
void be_init_state(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.state");