X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fana%2Fphiclass.c;h=421cef92f1ae0620a0df5f0a20cb2d4de4f59ab0;hb=5da05531f4190e4bf3dccb416aaf1b3f5417073f;hp=8945e3bf052c8ebed76954f54921d3187881c69a;hpb=d7c2b50b22f67866b9b4eed4412cbb91750f1b29;p=libfirm diff --git a/ir/ana/phiclass.c b/ir/ana/phiclass.c index 8945e3bf0..421cef92f 100644 --- a/ir/ana/phiclass.c +++ b/ir/ana/phiclass.c @@ -1,15 +1,32 @@ +/* + * 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 */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" -#ifdef HAVE_STDLIB_H -# include -#endif +#include #include "irnode.h" #include "debug.h" @@ -32,19 +49,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(ir_phase *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(ir_phase *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(ir_phase *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; } @@ -195,10 +213,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); @@ -214,10 +232,10 @@ phi_classes_t *phi_class_new_from_irg(ir_graph *irg, int pure_phi_classes) { * @return The Phis class object for @p all_phis. */ 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(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);