X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Fdata_flow_scalar_replace.c;h=a84b9dd6b6ee30745710c11d8f3333884a2d8541;hb=7cfefaae5f011ad335c8c39f69569110705602ac;hp=7a7ee5e9cc6df581eda1fbec30525d7bab5d399d;hpb=31eaa75da62468af4c37778e42ef7cecbe654838;p=libfirm diff --git a/ir/opt/data_flow_scalar_replace.c b/ir/opt/data_flow_scalar_replace.c index 7a7ee5e9c..a84b9dd6b 100644 --- a/ir/opt/data_flow_scalar_replace.c +++ b/ir/opt/data_flow_scalar_replace.c @@ -1,31 +1,36 @@ /* - * Project: libFIRM - * File name: ir/opt/data_flow_scalar_replace.c - * Purpose: scalar replacement of arrays and compounds - * Author: Beyhan Veliev - * Modified by: Michael Beck - * Created: - * CVS-ID: $Id$ - * Copyright: (c) 1998-2005 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * 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 scalar replacement of arrays and compounds + * @author Beyhan Veliev, Michael Beck + * @version $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#ifdef HAVE_ALLOCA_H -#include -#endif - -#ifdef HAVE_MALLOC_H -#include -#endif +#include "iroptimize.h" -#ifdef HAVE_STRING_H #include -#endif -#include "data_flow_scalar_replace.h" #include "irflag_t.h" #include "irouts.h" #include "pset.h" @@ -38,8 +43,8 @@ #include "irloop.h" #include "analyze_irg_args.h" #include "irprintf.h" -#include "compute_loop_info.h" #include "irgopt.h" +#include "xmalloc.h" #define SET_ENT_VNUM(ent, vnum) set_entity_link(ent, INT_TO_PTR(vnum)) #define GET_ENT_VNUM(ent) (unsigned)PTR_TO_INT(get_entity_link(ent)) @@ -129,6 +134,7 @@ static int ent_leaves_t_cmp(const void *elt, const void *key, size_t size) { const ent_leaves_t *c1 = elt; const ent_leaves_t *c2 = key; + (void) size; return c1->ent != c2->ent; } @@ -155,6 +161,7 @@ static int sels_cmp(const void *elt, const void *key, size_t size) { const sels_t *c1 = elt; const sels_t *c2 = key; + (void) size; return c1->sel != c2->sel; } @@ -181,6 +188,7 @@ static int call_cmp(const void *elt, const void *key, size_t size) { const call_access_t *c1 = elt; const call_access_t *c2 = key; + (void) size; return c1->call != c2->call; } @@ -194,6 +202,7 @@ static int path_cmp(const void *elt, const void *key, size_t size) { const path_t *p1 = elt; const path_t *p2 = key; + (void) size; /* we can use memcmp here, because identical tarvals should have identical addresses */ return memcmp(p1->path, p2->path, p1->path_len * sizeof(p1->path[0])); @@ -234,7 +243,7 @@ static int is_const_sel(ir_node *sel) { * Returns non-zero, if the address of an entity * represented by a Sel node (or it's successor Sels) is taken. */ -static int is_address_taken(ir_node *sel) +static int is_address_taken_2(ir_node *sel) { int i; @@ -257,7 +266,7 @@ static int is_address_taken(ir_node *sel) case iro_Sel: { /* Check the Sel successor of Sel */ - int res = is_address_taken(succ); + int res = is_address_taken_2(succ); if (res) return 1; @@ -388,7 +397,7 @@ static int find_possible_replacements(ir_graph *irg) /* we can handle arrays, structs and atomic types yet */ if (is_Array_type(ent_type) || is_Struct_type(ent_type) || is_atomic_type(ent_type)) { - if (is_address_taken(succ)) { + if (is_address_taken_2(succ)) { if (get_entity_link(ent)) /* killing one */ --res; set_entity_link(ent, ADDRESS_TAKEN); @@ -797,9 +806,6 @@ static void split_call_mem_edge(env_t *env, ir_node *call, pset *accessed_entiti int *accessed_leaves_vnum = NULL; /**< An arraw, where are saved the value number, that are synced from call's sync node, if we need it.*/ - if(get_irn_node_nr(call) == 2763) - printf("\nHi\n"); - call_blk = get_nodes_block(call); val_arr = get_irn_link(call_blk); /* An array to save the memory edges, that must be @@ -1493,13 +1499,13 @@ void data_flow_scalar_replacement_opt(ir_graph *irg) { remove_critical_cf_edges(irg); /* Call algorithm that computes the out edges.*/ - if (get_irg_outs_state(irg) != outs_consistent) - compute_irg_outs(irg); + assure_irg_outs(irg); /* Call algorithm that computes the loop information.*/ - compute_loop_info(irg); + construct_cf_backedges(irg); + /* Call algorithm that computes the dominance information.*/ - compute_doms(irg); + assure_doms(irg); /* Find possible scalar replacements */ if (find_possible_replacements(irg)) { @@ -1525,9 +1531,6 @@ void data_flow_scalar_replacement_opt(ir_graph *irg) { } } - if(get_firm_verbosity()) - printf("vnumber in data flow= %i\n", vnum); - /* Allocate value number for the globule memory edge. * and a value number for the value numbers state.*/ vnum = vnum + 2;