fixed output
[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  * License:     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 /**a
18  * @file opt_confirms.h
19  *
20  * Optimizations regarding Confirm nodes.
21  * These optimizations are not means to be run from
22  * frontends, they are called from iropt.
23  */
24
25 /**
26  * Check, if the value of a node is != 0.
27  *
28  * This is a often needed case, so we handle here Confirm
29  * nodes too.
30  *
31  * @param n        a node representing the value
32  * @param confirm  if n is confirmed to be != 0, returns
33  *                 the the Confirm-node, else NULL
34  */
35 int value_not_zero(ir_node *n, ir_node **confirm);
36
37 /**
38  * Check, if the value of a node cannot represent a NULL pointer.
39  *
40  * - If sel_based_null_check_elim is enabled, all
41  *   Sel nodes can be skipped.
42  * - A SymConst(entity) is NEVER a NULL pointer
43  * - A Const != NULL is NEVER a NULL pointer
44  * - Confirms are evaluated
45  *
46  * @param n        a node representing the value
47  * @param confirm  if n is confirmed to be != NULL, returns
48  *                 the the Confirm-node, else NULL
49  */
50 int value_not_null(ir_node *n, ir_node **confirm);
51
52 /**
53  * Possible return values of value_classify().
54  */
55 typedef enum _value_classify_sign {
56   value_classified_unknown  = 0,   /**< could not classify */
57   value_classified_positive = 1,   /**< value is positive, i.e. >= 0 */
58   value_classified_negative = -1   /**< value is negative, i.e. <= 0 if
59                                         no signed zero exists or < 0 else */
60 } value_classify_sign;
61
62 /**
63  * Check, if the value of a node can be confirmed >= 0 or <= 0,
64  * If the mode of the value did not honor signed zeros, else
65  * check for >= 0 or < 0.
66  *
67  * @param n  a node representing the value
68  */
69 value_classify_sign classify_value_sign(ir_node *n);
70
71 /**
72  * Return the value of a Cmp if one or both predecessors
73  * are Confirm nodes.
74  *
75  * @param cmp    the compare node that will be evaluated
76  * @param left   the left operand of the Cmp
77  * @param right  the right operand of the Cmp
78  * @param pnc    the compare relation
79  */
80 tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc);
81
82 #endif /* _OPT_CONFIRMS_H_ */