used new verify_node operation
[libfirm] / ir / ir / irmode.c
index de7ed63..8894fda 100644 (file)
@@ -9,16 +9,18 @@
  * Copyright:   (c) 1998-2003 Universität Karlsruhe
  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
  */
-
-
 #ifdef HAVE_CONFIG_H
-# include <config.h>
+# include "config.h"
 #endif
 
+#ifdef HAVE_STDLIB_H
 # include <stdlib.h>
-# include <stddef.h>
+#endif
+#ifdef HAVE_STRING_H
 # include <string.h>
-# include <stdbool.h>
+#endif
+
+# include <stddef.h>
 
 # include "irmode_t.h"
 # include "ident.h"
@@ -490,7 +492,7 @@ get_mode_infinite(ir_mode *mode)
   assert(get_mode_modecode(mode) < num_modes);
   assert(mode_is_float(mode));
 
-  return get_tarval_inf(mode);
+  return get_tarval_plus_inf(mode);
 }
 
 tarval *
@@ -911,33 +913,59 @@ ir_mode *find_double_bits_int_mode(const ir_mode *mode) {
   return find_mode(&n);
 }
 
+/*
+ * Returns non-zero if the given mode honors signed zero's, i.e.,
+ * a +0 and a -0 exists and handled differently.
+ */
+int mode_honor_signed_zeros(const ir_mode *mode)
+{
+  /* for floating point, we know that IEEE 754 has +0 and -0,
+   * but always handles it identical.
+   */
+  if (mode->sort == irms_float_number)
+    return mode->arithmetic == irma_ieee754 ? 0 : 1;
+  return 0;
+}
+
+/*
+ * Returns non-zero if the given mode might overflow on unary Minus.
+ *
+ * This does NOT happen on IEEE 754.
+ */
+int mode_overflow_on_unary_Minus(const ir_mode *mode)
+{
+  if (mode->sort == irms_float_number)
+    return mode->arithmetic == irma_ieee754 ? 0 : 1;
+  return 1;
+}
+
 void finish_mode(void) {
   obstack_free(&modes, 0);
 
-  mode_T = NULL;
-  mode_X = NULL;
-  mode_M = NULL;
-  mode_BB = NULL;
+  mode_T   = NULL;
+  mode_X   = NULL;
+  mode_M   = NULL;
+  mode_BB  = NULL;
   mode_ANY = NULL;
   mode_BAD = NULL;
 
-  mode_F = NULL;
-  mode_D = NULL;
-  mode_E = NULL;
-
-  mode_Bs = NULL;
-  mode_Bu = NULL;
-  mode_Hs = NULL;
-  mode_Hu = NULL;
-  mode_Is = NULL;
-  mode_Iu = NULL;
-  mode_Ls = NULL;
-  mode_Lu = NULL;
-
-  mode_C = NULL;
-  mode_U = NULL;
-  mode_b = NULL;
-  mode_P = NULL;
+  mode_F   = NULL;
+  mode_D   = NULL;
+  mode_E   = NULL;
+
+  mode_Bs  = NULL;
+  mode_Bu  = NULL;
+  mode_Hs  = NULL;
+  mode_Hu  = NULL;
+  mode_Is  = NULL;
+  mode_Iu  = NULL;
+  mode_Ls  = NULL;
+  mode_Lu  = NULL;
+
+  mode_C   = NULL;
+  mode_U   = NULL;
+  mode_b   = NULL;
+  mode_P   = NULL;
 
   mode_P_mach = NULL;
 }