Moved functions from opt_confirms.h into official header, do edgjfe can use them.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 8 Oct 2010 19:20:35 +0000 (19:20 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Fri, 8 Oct 2010 19:20:35 +0000 (19:20 +0000)
[r28075]

include/libfirm/firm.h
include/libfirm/iroptimize.h
ir/ir/iropt.c
ir/opt/jumpthreading.c
ir/opt/opt_confirms.c
ir/opt/opt_confirms.h [deleted file]

index 771203e..cc44fb7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
  *
index cb149fe..9aa0e1d 100644 (file)
@@ -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
index fc0bda7..783dcca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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"
index d354e39..bc417f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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"
index 5cda6f1..d717ccd 100644 (file)
@@ -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;
diff --git a/ir/opt/opt_confirms.h b/ir/opt/opt_confirms.h
deleted file mode 100644 (file)
index 40c8914..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 */