refactored ir_op_ops
[libfirm] / ir / ir / iropt_t.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ir/iropt_t.h
4  * Purpose:     iropt --- optimizations intertwined with IR construction -- private header.
5  * Author:      Martin Trapp, Christian Schaefer
6  * Modified by: Goetz Lindenmaier
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2003 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 /**
14 * @file iropt_t.h
15 *
16 * Declarations for optimizations intertwined with IR construction.
17 *
18 * @author Martin Trapp, Christian Schaefer
19 */
20
21 # ifndef _IROPT_T_H_
22 # define _IROPT_T_H_
23
24 # include "pset.h"
25 # include "iropt.h"
26
27 ir_node *equivalent_node (ir_node *n);
28
29 /*@{*/
30
31 /** For cse */
32 pset *new_identities (void);
33 void  del_identities (pset *value_table);
34 void  add_identities (pset *value_table, ir_node *node);
35 /*@}*/
36
37 ir_node *optimize_node (ir_node *n);
38
39 ir_node *optimize_in_place_2 (ir_node *n);
40
41 /* Calculate a hash value of a node. */
42 unsigned ir_node_hash (ir_node *node);
43
44 /**
45  * Returns the tarval of a Const node or tarval_bad for all other nodes.
46  */
47 static INLINE tarval *
48 value_of(ir_node *n) {
49   if ((n != NULL) && (get_irn_op(n) == op_Const))
50     return get_Const_tarval(n); /* might return tarval_bad */
51   else
52     return tarval_bad;
53 }
54
55 /**
56  * Sets the default operation for an ir_op_ops.
57  *
58  * @param code   the opcode for the default operation
59  * @param ops    the operations initialized
60  *
61  * @return
62  *    The operations.
63  */
64 ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops);
65
66 # endif /* _IROPT_T_H_ */