X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt_t.h;h=29d3b3b38d96a5e74838ba578ea45a4b1eef04b1;hb=fed1bdc07c9ec7b4d07a9243ad093c9fdd239fbd;hp=2a2ea1e248b369bb016257b911c7d1f36618f57c;hpb=2d0d6ece26bd218b17901a97a0adecbae7ef4f73;p=libfirm diff --git a/ir/ir/iropt_t.h b/ir/ir/iropt_t.h index 2a2ea1e24..29d3b3b38 100644 --- a/ir/ir/iropt_t.h +++ b/ir/ir/iropt_t.h @@ -1,29 +1,80 @@ -/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe -* All rights reserved. -* -* Authors: Martin Trapp, Christian Schaefer +/* + * 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. + */ + +/** +* @file iropt_t.h * * Declarations for optimizations intertwined with IR construction. +* +* @author Martin Trapp, Christian Schaefer */ -/* $Id$ */ - # ifndef _IROPT_T_H_ # define _IROPT_T_H_ # include "pset.h" # include "iropt.h" +# include "tv.h" ir_node *equivalent_node (ir_node *n); -/* For cse */ +/*@{*/ + +/** For cse */ pset *new_identities (void); void del_identities (pset *value_table); void add_identities (pset *value_table, ir_node *node); +/*@}*/ ir_node *optimize_node (ir_node *n); ir_node *optimize_in_place_2 (ir_node *n); +/** Calculate a hash value of a node. */ +unsigned ir_node_hash (ir_node *node); + +/** + * Compare function for two nodes in the hash table. Gets two + * nodes as parameters. Returns 0 if the nodes are a cse. + */ +int identities_cmp(const void *elt, const void *key); + +/** + * Return the canonical node computing the same value as n. + * Looks up the node in a hash table, enters it in the table + * if it isn't there yet. + */ +ir_node *identify_remember(pset *value_table, ir_node *n); + +/** + * Returns the tarval of a Const node or tarval_bad for all other nodes. + */ +static INLINE tarval * +value_of(ir_node *n) { + if ((n != NULL) && (get_irn_op(n) == op_Const)) + return get_Const_tarval(n); /* might return tarval_bad */ + else + return tarval_bad; +} + +/** + * Sets the default operation for an ir_op_ops. + * + * @param code the opcode for the default operation + * @param ops the operations initialized + * + * @return + * The operations. + */ +ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops); # endif /* _IROPT_T_H_ */