X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Fphiclass.c;h=ac68a80a94b455d000e988432b30e0779dde1597;hb=afbbc0b1ccd684c4c24bfd43d0f994123245f39f;hp=fe615f8bef16f20b9e17a7b9504a6a08fc73089f;hpb=863d31d7a5c8210432fef88b30fc3e8353131538;p=libfirm diff --git a/ir/ana/phiclass.c b/ir/ana/phiclass.c index fe615f8be..ac68a80a9 100644 --- a/ir/ana/phiclass.c +++ b/ir/ana/phiclass.c @@ -1,4 +1,25 @@ +/* + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + /** + * @file + * @brief Implementation of phiclass analysis * @author Daniel Grund, Christian Wuerdig * @cvsid $Id$ * @date 09.08.2005 @@ -18,9 +39,10 @@ #include "iredges_t.h" #include "phiclass.h" #include "irphase_t.h" +#include "irnodeset.h" struct _phi_classes_t { - phase_t ph; /* The phase object holding the irn data */ + ir_phase ph; /* The phase object holding the irn data */ pset *all_phi_classes; /* A set containing all Phi classes */ ir_graph *irg; /* The irg this is all about */ unsigned pure_phi_classes; /* Build pure Phi classes */ @@ -31,19 +53,20 @@ typedef struct _irn_phi_class_t { ir_node ***phi_cls; /* the array of node pointers representing the class */ } irn_phi_class_t; -static INLINE ir_node ***_get_phi_class(phase_t *ph, ir_node *irn) { +static INLINE ir_node ***_get_phi_class(ir_phase *ph, ir_node *irn) { irn_phi_class_t *ipc = phase_get_or_set_irn_data(ph, irn); return ipc->phi_cls; } -static INLINE void _set_phi_class(phase_t *ph, ir_node *irn, ir_node ***cls) { +static INLINE void _set_phi_class(ir_phase *ph, ir_node *irn, ir_node ***cls) { irn_phi_class_t *ipc = phase_get_or_set_irn_data(ph, irn); ipc->phi_cls = cls; } /* initialize data structure for given irn in given phase */ -static void *irn_phi_class_init(phase_t *ph, ir_node *irn, void *data) { +static void *irn_phi_class_init(ir_phase *ph, const ir_node *irn, void *data) { irn_phi_class_t *ipc = data ? data : phase_alloc(ph, sizeof(ipc[0])); + (void) irn; memset(ipc, 0, sizeof(ipc[0])); return ipc; } @@ -144,11 +167,12 @@ static void phi_class_compute(phi_classes_t *pc) { /** * Build the Phi classes for the set of given Phis. */ -static void phi_class_compute_by_phis(phi_classes_t *pc, pset *all_phi_nodes) { - if (pset_count(all_phi_nodes)) { - ir_node *phi; +static void phi_class_compute_by_phis(phi_classes_t *pc, ir_nodeset_t *all_phi_nodes) { + if (ir_nodeset_size(all_phi_nodes) > 0) { + ir_nodeset_iterator_t iter; + ir_node *phi; - foreach_pset(all_phi_nodes, phi) { + foreach_ir_nodeset(all_phi_nodes, phi, iter) { ir_node ***irn_pc = _get_phi_class(&pc->ph, phi); assert(is_Phi(phi) && mode_is_datab(get_irn_mode(phi))); @@ -193,10 +217,10 @@ pset *get_all_phi_classes(phi_classes_t *pc) { * @return The Phi class object for the @p irg. */ phi_classes_t *phi_class_new_from_irg(ir_graph *irg, int pure_phi_classes) { - phi_classes_t *res = xmalloc(sizeof(*res)); + phi_classes_t *res = XMALLOC(phi_classes_t); FIRM_DBG_REGISTER(res->dbg, "ir.ana.phiclass"); - phase_init(&res->ph, "phi_classes", irg, PHASE_DEFAULT_GROWTH, irn_phi_class_init); + phase_init(&res->ph, "phi_classes", irg, PHASE_DEFAULT_GROWTH, irn_phi_class_init, NULL); res->irg = irg; res->all_phi_classes = pset_new_ptr(5); @@ -211,11 +235,11 @@ phi_classes_t *phi_class_new_from_irg(ir_graph *irg, int pure_phi_classes) { * Builds all Phi classes for the given set of Phis. * @return The Phis class object for @p all_phis. */ -phi_classes_t *phi_class_new_from_set(ir_graph *irg, pset *all_phis, int pure_phi_classes) { - phi_classes_t *res = xmalloc(sizeof(*res)); +phi_classes_t *phi_class_new_from_set(ir_graph *irg, ir_nodeset_t *all_phis, int pure_phi_classes) { + phi_classes_t *res = XMALLOC(phi_classes_t); FIRM_DBG_REGISTER(res->dbg, "ir.ana.phiclass"); - phase_init(&res->ph, "phi_classes", irg, PHASE_DEFAULT_GROWTH, irn_phi_class_init); + phase_init(&res->ph, "phi_classes", irg, PHASE_DEFAULT_GROWTH, irn_phi_class_init, NULL); res->irg = irg; res->all_phi_classes = pset_new_ptr(5);