X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fopt%2Fopt_confirms.h;h=2afbe7c894b8912994276f4d8f54020e525d6651;hb=abbf9492df1993d211412ba520feb81de0688c2a;hp=e9abd7bbd1dee3280a5c22dfeacf66f6116fcc19;hpb=78ffd186d60f8e98179fb470f58e5223226bc0e3;p=libfirm diff --git a/ir/opt/opt_confirms.h b/ir/opt/opt_confirms.h index e9abd7bbd..2afbe7c89 100644 --- a/ir/opt/opt_confirms.h +++ b/ir/opt/opt_confirms.h @@ -1,37 +1,39 @@ /* - * Project: libFIRM - * File name: ir/opt/opt_confirms.h - * Purpose: Optimizations regarding Confirm nodes - * Author: Michael Beck - * Modified by: - * Created: - * CVS-ID: $Id$ - * Copyright: (c) 1998-2005 Universität Karlsruhe - * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * + * This file is part of libFirm. + * + * This file may be distributed and/or modified under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation and appearing in the file LICENSE.GPL included in the + * packaging of this file. + * + * Licensees holding valid libFirm Professional Edition licenses may use + * this file in accordance with the libFirm Commercial License. + * Agreement provided with the Software. + * + * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE + * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. */ -#ifndef _OPT_CONFIRMS_H_ -#define _OPT_CONFIRMS_H_ - -#include "irnode.h" /** - * @file opt_confirms.h + * @file + * @brief Optimizations regarding Confirm nodes. + * @author Michael Beck + * @version $Id$ * * Optimizations regarding Confirm nodes. - * These optimiztions are not means to be run from + * These optimizations are not means to be run from * frontends, they are called from iropt. */ +#ifndef FIRM_OPT_CONFIRMS_H +#define FIRM_OPT_CONFIRMS_H -/** - * Possible return values of value_classify(). - */ -typedef enum _value_classify { - VALUE_UNKNOWN = 0, /**< could not classify */ - VALUE_POSITIVE = 1, /**< value is positive, i.e. >= 0 */ - VALUE_NEGATIVE = -1 /**< value is negative, i.e. <= 0 if - no signed zero exists or < 0 else */ -} value_classify; +#include "firm_types.h" +/** Needed for MSVC to suporess warnings because it doest NOT handle const right. */ +typedef const ir_node *ir_node_cnst_ptr; /** * Check, if the value of a node is != 0. @@ -39,9 +41,36 @@ typedef enum _value_classify { * This is a often needed case, so we handle here Confirm * nodes too. * - * @param n a node representing the value + * @param n a node representing the value + * @param confirm if n is confirmed to be != 0, returns + * the the Confirm-node, else NULL + */ +int value_not_zero(const ir_node *n, ir_node_cnst_ptr *confirm); + +/** + * Check, if the value of a node cannot represent a NULL pointer. + * + * - If option sel_based_null_check_elim is enabled, all + * Sel nodes can be skipped. + * - A SymConst(entity) is NEVER a NULL pointer + * - A Const != NULL is NEVER a NULL pointer + * - Confirms are evaluated + * + * @param n a node representing the value + * @param confirm if n is confirmed to be != NULL, returns + * the the Confirm-node, else NULL + */ +int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm); + +/** + * Possible return values of value_classify(). */ -int value_not_zero(ir_node *n); +typedef enum _value_classify_sign { + value_classified_unknown = 0, /**< could not classify */ + value_classified_positive = 1, /**< value is positive, i.e. >= 0 */ + value_classified_negative = -1 /**< value is negative, i.e. <= 0 if + no signed zero exists or < 0 else */ +} value_classify_sign; /** * Check, if the value of a node can be confirmed >= 0 or <= 0, @@ -50,15 +79,17 @@ int value_not_zero(ir_node *n); * * @param n a node representing the value */ -value_classify classify_value_sign(ir_node *n); +value_classify_sign classify_value_sign(ir_node *n); /** * Return the value of a Cmp if one or both predecessors * are Confirm nodes. * + * @param cmp the compare node that will be evaluated * @param left the left operand of the Cmp * @param right the right operand of the Cmp + * @param pnc the compare relation */ -tarval *computed_value_Cmp_Confirm(ir_node *left, ir_node *right, pn_Cmp pnc); +tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc); -#endif /* _OPT_CONFIRMS_H_ */ +#endif /* FIRM_OPT_CONFIRMS_H */