X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt_t.h;h=ca1ad64a5d741ca848e8ea84d38c7023d34fd00b;hb=eda9d668d0e8c8246015b4c5e743316a6a835a23;hp=29d3b3b38d96a5e74838ba578ea45a4b1eef04b1;hpb=5c8fea174ada95511143ff2838ae1c2ce04bae6f;p=libfirm diff --git a/ir/ir/iropt_t.h b/ir/ir/iropt_t.h index 29d3b3b38..ca1ad64a5 100644 --- a/ir/ir/iropt_t.h +++ b/ir/ir/iropt_t.h @@ -1,46 +1,65 @@ /* - * Project: libFIRM - * File name: ir/ir/iropt_t.h - * Purpose: iropt --- optimizations intertwined with IR construction -- private header. - * Author: Martin Trapp, Christian Schaefer - * Modified by: Goetz Lindenmaier - * Created: - * CVS-ID: $Id$ - * Copyright: (c) 1998-2003 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * Copyright (C) 1995-2007 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 iropt_t.h -* -* Declarations for optimizations intertwined with IR construction. -* -* @author Martin Trapp, Christian Schaefer -*/ - -# ifndef _IROPT_T_H_ -# define _IROPT_T_H_ - -# include "pset.h" -# include "iropt.h" -# include "tv.h" + * @file + * @brief iropt --- optimizations intertwined with IR construction -- private header. + * @author Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck + * @version $Id$ + */ +#ifndef FIRM_IR_IROPT_T_H +#define FIRM_IR_IROPT_T_H -ir_node *equivalent_node (ir_node *n); +#include "iropt.h" +#include "irnode_t.h" +#include "pset.h" +#include "tv.h" -/*@{*/ +ir_node *equivalent_node(ir_node *n); -/** For cse */ -pset *new_identities (void); -void del_identities (pset *value_table); -void add_identities (pset *value_table, ir_node *node); -/*@}*/ +/** + * Calculate a hash value of a node. + * The hash value is calculated from the nodes predecessors. + * Special handling for Const and SymConst nodes (these don't have predecessors). + * + * @param node The IR-node + */ +unsigned ir_node_hash(ir_node *node); -ir_node *optimize_node (ir_node *n); +/** + * Creates a new value table used for storing CSE identities. + * The value table is used to identify common expressions. + * + */ +pset *new_identities(void); -ir_node *optimize_in_place_2 (ir_node *n); +/** + * Deletes a identities value table. + * + * @param value_table the identity set + */ +void del_identities(pset *value_table); -/** Calculate a hash value of a node. */ -unsigned ir_node_hash (ir_node *node); +/** + * Add a node to the identities value table. + */ +void add_identities(pset *value_table, ir_node *node); /** * Compare function for two nodes in the hash table. Gets two @@ -55,6 +74,13 @@ int identities_cmp(const void *elt, const void *key); */ ir_node *identify_remember(pset *value_table, ir_node *n); +/** Visit each node in the value table of a graph. */ +void visit_all_identities(ir_graph *irg, irg_walk_func visit, void *env); + +ir_node *optimize_node(ir_node *n); + +ir_node *optimize_in_place_2(ir_node *n); + /** * Returns the tarval of a Const node or tarval_bad for all other nodes. */ @@ -67,7 +93,7 @@ value_of(ir_node *n) { } /** - * Sets the default operation for an ir_op_ops. + * Sets the default operations for an ir_op_ops. * * @param code the opcode for the default operation * @param ops the operations initialized @@ -75,6 +101,6 @@ value_of(ir_node *n) { * @return * The operations. */ -ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops); +ir_op_ops *firm_set_default_operations(ir_opcode code, ir_op_ops *ops); -# endif /* _IROPT_T_H_ */ +#endif