#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;)
ir_graph *irg = get_irn_irg(phi);
ir_node *block = get_nodes_block(phi);
int arity = get_irn_arity(phi);
- ir_node **in = ALLOCAN(ir_node*, arity);
+ ir_node **phi_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;
/* create a new phi-M with bad preds */
for (i = 0; i < arity; ++i) {
- in[i] = dummy;
+ phi_in[i] = dummy;
}
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, phi_in, mode_M, NULL);
+ sched_add_after(block, spill_info->spill);
if (spill_to_kill != NULL) {
exchange(spill_to_kill, spill_info->spill);
* 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 pseudo-copies of
* their args to break interference and make it possible to spill them to the
* same spill slot.
*/
}
/* 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));
- create_reload(env, need_val, node, current_state);
+ create_reload(env, need_val, before, current_state);
current_state = need_val;
}
be_lv_t *lv = be_assure_liveness(irg);
be_liveness_assure_sets(lv);
- /* construct control flow loop tree */
- if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) {
- construct_cf_backedges(irg);
- }
+ assure_loopinfo(irg);
obstack_init(&env.obst);
env.reg = reg;
info = env.spills;
while (info != NULL) {
be_ssa_construction_env_t senv;
- int i, len;
+ size_t i, len;
ir_node **phis;
be_ssa_construction_init(&senv, irg);
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");