get_tarval_minus_one() function added
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Jun 2005 08:29:52 +0000 (08:29 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 6 Jun 2005 08:29:52 +0000 (08:29 +0000)
typos fixed

[r5950]

ir/tv/tv.c
ir/tv/tv.h

index dbbbe13..eb4fc0e 100644 (file)
@@ -613,6 +613,36 @@ tarval *get_tarval_one(ir_mode *mode)
   return tarval_bad;
 }
 
+tarval *get_tarval_minus_one(ir_mode *mode)
+{
+  ANNOUNCE();
+  assert(mode);
+
+  if (get_mode_n_vector_elems(mode) > 1) {
+    /* vector arithmetic not implemented yet */
+    return tarval_bad;
+  }
+
+  switch(get_mode_sort(mode))
+  {
+    case irms_control_flow:
+    case irms_memory:
+    case irms_auxiliary:
+    case irms_internal_boolean:
+    case irms_reference:
+      assert(0);
+      break;
+
+    case irms_float_number:
+      return mode_is_signed(mode) ? new_tarval_from_double(-1.0, mode) : tarval_bad;
+
+    case irms_int_number:
+    case irms_character:
+      return mode_is_signed(mode) ? new_tarval_from_long(-1l, mode) : tarval_bad;
+  }
+  return tarval_bad;
+}
+
 tarval *get_tarval_nan(ir_mode *mode)
 {
   ANNOUNCE();
@@ -1581,7 +1611,7 @@ int  set_tarval_mode_output_option(ir_mode *mode, const tarval_mode_info *modein
 /*
  * Returns the output options of one mode.
  *
- * This functions returns the modinfo of a given mode.
+ * This functions returns the modinfo of a given mode.
  */
 const tarval_mode_info *get_tarval_mode_output_option(ir_mode *mode)
 {
index aeff274..aabc2c8 100644 (file)
@@ -311,6 +311,10 @@ tarval *get_tarval_null(ir_mode *mode);
 /** Returns the 1 value (multiplicative neutral) of a given mode. */
 tarval *get_tarval_one(ir_mode *mode);
 
+/** Returns the -1 value (multiplicative neutral) of a given mode.
+ *  Returns tarval bad for unsigned modes */
+tarval *get_tarval_minus_one(ir_mode *mode);
+
 /** Return quite nan for float_number modes. */
 tarval *get_tarval_nan(ir_mode *mode);
 
@@ -342,8 +346,8 @@ tarval_int_overflow_mode_t tarval_get_integer_overflow_mode(void);
  * Compares two tarvals
  *
  * Compare a with b and return a pn_Cmp describing the relation
- * between a and b.  This is either Uo, Lt, Eq, Gt, or False if a or b
- * are symbolic pointers which can not be compared at all.
+ * between a and b.  This is either pn_Cmp_Uo, pn_Cmp_ Lt, pn_Cmp_ Eq, pn_Cmp_Gt,
+ * or pn_Cmp_False if a or b are symbolic pointers which can not be compared at all.
  *
  * @param a   A tarval to be compared
  * @param b   A tarval to be compared