From: Christian Würdig Date: Wed, 20 Sep 2006 15:02:21 +0000 (+0000) Subject: added phase reinit data per irn X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=93ec9eb45d1630e73ed4932d66683adcc9c28d71;hp=e9800d6ceb38f4256eddb49fa735fabd4ab71909;p=libfirm added phase reinit data per irn [r8282] --- diff --git a/ir/ir/irphase.c b/ir/ir/irphase.c index 44e1841ff..75d8ecbcb 100644 --- a/ir/ir/irphase.c +++ b/ir/ir/irphase.c @@ -62,11 +62,23 @@ void phase_reinit_irn_data(phase_t *phase) { int i, n; - if(!phase->data_init) + if (! phase->data_init) return; - for(i = 0, n = phase->n_data_ptr; i < n; ++i) { - if(phase->data_ptr[i]) - phase->data_init(phase, NULL, phase->data_ptr[i]); + for (i = 0, n = phase->n_data_ptr; i < n; ++i) { + if (phase->data_ptr[i]) + phase->data_init(phase, get_idx_irn(phase->irg, i), phase->data_ptr[i]); } } + +void phase_reinit_single_irn_data(phase_t *phase, ir_node *irn) +{ + int idx; + + if (! phase->data_init) + return; + + idx = get_irn_idx(irn); + if (phase->data_ptr[idx]) + phase->data_init(phase, irn, phase->data_ptr[idx]); +} diff --git a/ir/ir/irphase_t.h b/ir/ir/irphase_t.h index a9ccd6af5..9329ab595 100644 --- a/ir/ir/irphase_t.h +++ b/ir/ir/irphase_t.h @@ -75,10 +75,16 @@ void phase_free(phase_t *phase); /** * Re-initialize the irn data for all nodes in the node => data map using the given callback. * @param phase The phase. - * @note This function will pass NULL to the init function passed to phase_new(). */ void phase_reinit_irn_data(phase_t *phase); +/** + * Re-initialize the irn data for the given node. + * @param phase The phase. + * @param irn The irn. + */ +void phase_reinit_single_irn_data(phase_t *phase, ir_node *irn); + /** * Get the name of the phase. */