2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Optimizations regarding Confirm nodes.
23 * @author Michael Beck
26 #ifndef FIRM_OPT_CONFIRMS_H
27 #define FIRM_OPT_CONFIRMS_H
29 #include "firm_types.h"
32 * @file opt_confirms.h
34 * Optimizations regarding Confirm nodes.
35 * These optimizations are not means to be run from
36 * frontends, they are called from iropt.
40 * Check, if the value of a node is != 0.
42 * This is a often needed case, so we handle here Confirm
45 * @param n a node representing the value
46 * @param confirm if n is confirmed to be != 0, returns
47 * the the Confirm-node, else NULL
49 int value_not_zero(ir_node *n, ir_node **confirm);
52 * Check, if the value of a node cannot represent a NULL pointer.
54 * - If sel_based_null_check_elim is enabled, all
55 * Sel nodes can be skipped.
56 * - A SymConst(entity) is NEVER a NULL pointer
57 * - A Const != NULL is NEVER a NULL pointer
58 * - Confirms are evaluated
60 * @param n a node representing the value
61 * @param confirm if n is confirmed to be != NULL, returns
62 * the the Confirm-node, else NULL
64 int value_not_null(ir_node *n, ir_node **confirm);
67 * Possible return values of value_classify().
69 typedef enum _value_classify_sign {
70 value_classified_unknown = 0, /**< could not classify */
71 value_classified_positive = 1, /**< value is positive, i.e. >= 0 */
72 value_classified_negative = -1 /**< value is negative, i.e. <= 0 if
73 no signed zero exists or < 0 else */
74 } value_classify_sign;
77 * Check, if the value of a node can be confirmed >= 0 or <= 0,
78 * If the mode of the value did not honor signed zeros, else
79 * check for >= 0 or < 0.
81 * @param n a node representing the value
83 value_classify_sign classify_value_sign(ir_node *n);
86 * Return the value of a Cmp if one or both predecessors
89 * @param cmp the compare node that will be evaluated
90 * @param left the left operand of the Cmp
91 * @param right the right operand of the Cmp
92 * @param pnc the compare relation
94 tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc);
96 #endif /* FIRM_OPT_CONFIRMS_H */