added missing parameter and initializer
[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 # include "tv.h"
27
28 ir_node *equivalent_node (ir_node *n);
29
30 /*@{*/
31
32 /** For cse */
33 pset *new_identities (void);
34 void  del_identities (pset *value_table);
35 void  add_identities (pset *value_table, ir_node *node);
36 /*@}*/
37
38 ir_node *optimize_node (ir_node *n);
39
40 ir_node *optimize_in_place_2 (ir_node *n);
41
42 /** Calculate a hash value of a node. */
43 unsigned ir_node_hash (ir_node *node);
44
45 /**
46  * Compare function for two nodes in the hash table. Gets two
47  * nodes as parameters.  Returns 0 if the nodes are a cse.
48  */
49 int identities_cmp(const void *elt, const void *key);
50
51 /**
52  * Return the canonical node computing the same value as n.
53  * Looks up the node in a hash table, enters it in the table
54  * if it isn't there yet.
55  */
56 ir_node *identify_remember(pset *value_table, ir_node *n);
57
58 /**
59  * Returns the tarval of a Const node or tarval_bad for all other nodes.
60  */
61 static INLINE tarval *
62 value_of(ir_node *n) {
63   if ((n != NULL) && (get_irn_op(n) == op_Const))
64     return get_Const_tarval(n); /* might return tarval_bad */
65   else
66     return tarval_bad;
67 }
68
69 /**
70  * Sets the default operation for an ir_op_ops.
71  *
72  * @param code   the opcode for the default operation
73  * @param ops    the operations initialized
74  *
75  * @return
76  *    The operations.
77  */
78 ir_op_ops *firm_set_default_operations(opcode code, ir_op_ops *ops);
79
80 # endif /* _IROPT_T_H_ */