#include "irnode.h"
#include "beirg.h"
-#if 0
-/**
- * Introduce several copies for one node.
- *
- * A copy in this context means, that you want to introduce several new
- * abstract values (in Firm: nodes) for which you know, that they
- * represent the same concrete value. This is the case if you
- * - copy
- * - spill and reload
- * - re-materialize
- * a value.
- *
- * This function reroutes all uses of the original value to the copies in the
- * corresponding dominance subtrees and creates Phi functions where necessary.
- *
- * @note The visited flag and link fields are used.
- *
- * @param info Dominance frontier information.
- * @param lv Liveness information to be updated. If NULL, no liveness
- * updating is performed.
- * @param value The value that has been duplicated.
- * @param copies_len the length of the copies array
- * @param copie an array holding all copies of the value
- * @param phis An ARR_F where all newly created phis will be inserted,
- * may be NULL
- * @param ignore_uses A set of nodes probably using one of the nodes in
- * @p nodes. Their usage will not adjusted. They remain
- * untouched by this function. May be NULL.
- */
-ir_node **be_ssa_construction(const be_dom_front_info_t *info, be_lv_t *lv,
- ir_node *value, int copies_len, ir_node **copies,
- const ir_nodeset_t *ignore_uses, int need_new_phis);
-
-/** @deprecated */
-void be_ssa_constr_set_ignore(const be_dom_front_info_t *info, be_lv_t *lv,
- pset *nodes, pset *ignores);
-#endif
-
/**
* Insert a Perm which permutes all (non-ignore) live values of a given register class
* after a certain instruction.
}
}
-#if 0
-ir_node **be_ssa_construction(const be_dom_front_info_t *domfronts, be_lv_t *lv,
- ir_node *value, int copies_len, ir_node **copies,
- const ir_nodeset_t *ignore_uses, int need_new_phis)
-{
- ir_graph *irg = get_irn_irg(value);
- const ir_edge_t *edge, *next;
- int i;
- ir_node *block;
- waitq *worklist;
- be_ssa_construction_env_t env;
-
- /* We need to collect the phi functions to compute their liveness. */
- if(lv != NULL || need_new_phis) {
- env.new_phis = NEW_ARR_F(ir_node*, 0);
- } else {
- env.new_phis = NULL;
- }
- env.mode = get_irn_mode(value);
-
- set_using_visited(irg);
- set_using_block_visited(irg);
- set_using_irn_link(irg);
-
- /* we use the visited flag to indicate blocks in the dominance frontier
- * and blocks that already have the relevant value at the end calculated */
- inc_irg_visited(irg);
- /* We use the block visited flag to indicate blocks in the dominance
- * froniter of some values (and this potentially needing phis) */
- inc_irg_block_visited(irg);
-
- DBG((dbg, LEVEL_1, "Introducing following copies for: %+F\n", value));
- /* compute iterated dominance frontiers and create lists in the block link
- * fields that sort usages by dominance. Blocks in the dominance frontier
- * are marked by links back to the block. */
- worklist = new_waitq();
-
- block = get_nodes_block(value);
- /* we sometimes replace virtual values by real ones, in this case we do
- not want to insert them into the def list (they're not scheduled
- and can't be used anyway) */
- if(sched_is_scheduled(value)) {
- introduce_def_at_block(block, value);
- }
- waitq_put(worklist, block);
-
- for(i = 0; i < copies_len; ++i) {
- ir_node *copy = copies[i];
- block = get_nodes_block(copy);
-
- if(!irn_visited(block)) {
- waitq_put(worklist, block);
- }
- introduce_def_at_block(block, copy);
- DBG((dbg, LEVEL_1, "\t%+F in %+F\n", copy, block));
- }
-
- mark_iterated_dominance_frontiers(domfronts, worklist);
- del_waitq(worklist);
-
- DBG((dbg, LEVEL_2, "New Definitions:\n"));
- /*
- * Search the valid def for each use and set it.
- */
- foreach_out_edge_safe(value, edge, next) {
- ir_node *use = get_edge_src_irn(edge);
- ir_node *at = use;
- int pos = get_edge_src_pos(edge);
-
- if(ignore_uses != NULL && ir_nodeset_contains(ignore_uses, use))
- continue;
-
- if(is_Phi(use)) {
- ir_node *block = get_nodes_block(use);
- ir_node *predblock = get_Block_cfgpred_block(block, pos);
- at = sched_last(predblock);
- }
-
- ir_node *def = search_def(&env, at);
-
- if(def == NULL) {
- panic("no definition found for %+F at position %d\n", use, pos);
- }
-
- DBG((dbg, LEVEL_2, "\t%+F(%d) -> %+F\n", use, pos, def));
- set_irn_n(use, pos, def);
- }
-
- /* Recompute the liveness of the original nodes, the copies and the
- * inserted phis. */
- if(lv != NULL) {
- int n;
-
- be_liveness_update(lv, value);
- for(i = 0; i < copies_len; ++i) {
- ir_node *copy = copies[i];
- be_liveness_update(lv, copy);
- }
-
- n = ARR_LEN(env.new_phis);
- for(i = 0; i < n; ++i) {
- ir_node *phi = env.new_phis[i];
- be_liveness_introduce(lv, phi);
- }
- }
-
- clear_using_visited(irg);
- clear_using_block_visited(irg);
- clear_using_irn_link(irg);
-
- if(!need_new_phis && env.new_phis != NULL) {
- DEL_ARR_F(env.new_phis);
- return NULL;
- }
- return env.new_phis;
-}
-#endif
-
void be_init_ssaconstr(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.ssaconstr");