Commit 7547cf52 authored by Michael Beck's avatar Michael Beck
Browse files

Moved functions from opt_confirms.h into official header, do edgjfe can use them.

[r28075]
parent 3fc1c705
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2010 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......
......@@ -26,6 +26,7 @@
#define FIRM_IROPTIMIZE_H
#include "firm_types.h"
#include "nodeops.h"
#include "begin.h"
/**
......@@ -1078,6 +1079,67 @@ FIRM_API void fixpoint_vrp(ir_graph*);
*/
FIRM_API ir_graph_pass_t *fixpoint_vrp_irg_pass(const char *name);
/** Needed for MSVC to suppress 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.
*
* This is a often needed case, so we handle here Confirm
* nodes too.
*
* @param n a node representing the value
* @param confirm if n is confirmed to be != 0, returns
* the the Confirm-node, else NULL
*/
FIRM_API 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
*/
FIRM_API int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm);
/**
* Possible return values of value_classify().
*/
typedef enum ir_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 */
} ir_value_classify_sign;
/**
* Check, if the value of a node can be confirmed >= 0 or <= 0,
* If the mode of the value did not honor signed zeros, else
* check for >= 0 or < 0.
*
* @param n a node representing the value
*/
FIRM_API ir_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
*/
FIRM_API ir_tarval *computed_value_Cmp_Confirm(
ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc);
#include "end.h"
#endif
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2010 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -36,6 +36,7 @@
#include "ircons_t.h"
#include "irgmod.h"
#include "irverify.h"
#include "iroptimize.h"
#include "tv_t.h"
#include "dbginfo_t.h"
#include "iropt_dbg.h"
......@@ -43,7 +44,6 @@
#include "irhooks.h"
#include "irarch.h"
#include "hashptr.h"
#include "opt_confirms.h"
#include "opt_polymorphy.h"
#include "irtools.h"
#include "irhooks.h"
......
/*
* Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
* Copyright (C) 1995-2010 University of Karlsruhe. All right reserved.
*
* This file is part of libFirm.
*
......@@ -42,7 +42,7 @@
#include "irtools.h"
#include "irgraph.h"
#include "tv.h"
#include "opt_confirms.h"
#include "iroptimize.h"
#include "iropt_dbg.h"
#include "irpass.h"
#include "vrp.h"
......
......@@ -31,7 +31,7 @@
#include "irnode_t.h"
#include "iropt_t.h"
#include "iropt_dbg.h"
#include "opt_confirms.h"
#include "iroptimize.h"
#include "irflag_t.h"
#include "irprintf.h"
......@@ -95,7 +95,7 @@ static tarval *compare_iv_dbg(const interval_t *l_iv, const interval_t *r_iv, pn
* This is a often needed case, so we handle here Confirm
* nodes too.
*/
int value_not_zero(const ir_node *n, ir_node_cnst_ptr *confirm)
FIRM_API int value_not_zero(const ir_node *n, ir_node_cnst_ptr *confirm)
{
#define RET_ON(x) if (x) { *confirm = n; return 1; }; break
......@@ -174,7 +174,7 @@ int value_not_zero(const ir_node *n, ir_node_cnst_ptr *confirm)
* - A SymConst(entity) is NEVER a NULL pointer
* - Confirms are evaluated
*/
int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm)
FIRM_API int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm)
{
ir_tarval *tv;
......@@ -229,7 +229,7 @@ int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm)
* If the mode of the value did not honor signed zeros, else
* check for >= 0 or < 0.
*/
value_classify_sign classify_value_sign(ir_node *n)
FIRM_API ir_value_classify_sign classify_value_sign(ir_node *n)
{
ir_tarval *tv, *c;
ir_mode *mode;
......@@ -627,7 +627,7 @@ static int is_transitive(pn_Cmp pnc)
* @param right the right operand of the Cmp
* @param pnc the compare relation
*/
ir_tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc)
FIRM_API ir_tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc)
{
ir_node *l_bound;
pn_Cmp l_pnc, res_pnc, neg_pnc;
......
/*
* 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.
*/
/**
* @file
* @brief Optimizations regarding Confirm nodes.
* @author Michael Beck
* @version $Id$
*
* Optimizations regarding Confirm nodes.
* 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
#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.
*
* This is a often needed case, so we handle here Confirm
* nodes too.
*
* @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().
*/
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,
* If the mode of the value did not honor signed zeros, else
* check for >= 0 or < 0.
*
* @param n a node representing the value
*/
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
*/
ir_tarval *computed_value_Cmp_Confirm(ir_node *cmp, ir_node *left, ir_node *right, pn_Cmp pnc);
#endif /* FIRM_OPT_CONFIRMS_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment