optimizations using Confirm nodes, used by iropt
[libfirm] / ir / opt / opt_confirms.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/opt/opt_confirms.h
4  * Purpose:     Optimizations regarding Confirm nodes
5  * Author:      Michael Beck
6  * Modified by:
7  * Created:
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1998-2005 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12 #ifndef _OPT_CONFIRMS_H_
13 #define _OPT_CONFIRMS_H_
14
15 #include "irnode.h"
16
17 /**
18  * @file opt_confirms.h
19  *
20  * Optimizations regarding Confirm nodes.
21  * These optimiztions are not means to be run from
22  * frontends, they are called from iropt.
23  */
24
25 /**
26  * Possible return values of value_classify().
27  */
28 typedef enum _value_classify {
29   VALUE_UNKNOWN  = 0,   /**< could not classify */
30   VALUE_POSITIVE = 1,   /**< value is positive, i.e. >= 0 */
31   VALUE_NEGATIVE = -1   /**< value is negative, i.e. <= 0 if
32                              no signed zero exists or < 0 else */
33 } value_classify;
34
35
36 /**
37  * Check, if the value of a node is != 0.
38  *
39  * This is a often needed case, so we handle here Confirm
40  * nodes too.
41  *
42  * @param n  a node representing the value
43  */
44 int value_not_zero(ir_node *n);
45
46 /**
47  * Check, if the value of a node can be confirmed >= 0 or <= 0,
48  * If the mode of the value did not honor signed zeros, else
49  * check for >= 0 or < 0.
50  *
51  * @param n  a node representing the value
52  */
53 value_classify classify_value_sign(ir_node *n);
54
55 /**
56  * Return the value of a Cmp if one or both predecessors
57  * are Confirm nodes.
58  *
59  * @param left   the left operand of the Cmp
60  * @param right  the right operand of the Cmp
61  */
62 tarval *computed_value_Cmp_Confirm(ir_node *left, ir_node *right, pn_Cmp pnc);
63
64 #endif /* _OPT_CONFIRMS_H_ */