add docu and prototype for find_value()
[libfirm] / ir / opt / opt_confirms.h
index 1c4b7d1..1584cfb 100644 (file)
@@ -7,50 +7,57 @@
  * Created:
  * CVS-ID:      $Id$
  * Copyright:   (c) 1998-2005 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * License:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
 #ifndef _OPT_CONFIRMS_H_
 #define _OPT_CONFIRMS_H_
 
 #include "irnode.h"
 
-/**
+/**a
  * @file opt_confirms.h
  *
  * 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.
  */
 
-/**
- * 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;
-
 /**
  * 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 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(ir_node *n);
+int value_not_zero(ir_node *n, ir_node **confirm);
 
-/*
- * Check, if the value of a node is != NULL.
+/**
+ * Check, if the value of a node cannot represent a NULL pointer.
  *
- * This is a often needed case, so we handle here Confirm
- * nodes too.
+ * - If 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 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(ir_node *n, ir_node **confirm);
+
+/**
+ * Possible return values of value_classify().
  */
-int value_not_null(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,
@@ -59,7 +66,7 @@ int value_not_null(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