Clean up turn_back_am(), panic on unknown arity.
[libfirm] / include / libfirm / irmode.h
index 3be8153..7f55e3c 100644 (file)
@@ -43,7 +43,7 @@
 /**
  * Predefined mode according to tech report 1999-14.
  */
-typedef enum { /* irm is short for `ir mode' */
+typedef enum ir_modecode { /* irm is short for `ir mode' */
        irm_BB,                       /**< basic block */
        irm_X,                        /**< execution */
        irm_F,                        /**< float(32) */
@@ -70,7 +70,7 @@ typedef enum { /* irm is short for `ir mode' */
 
 /** These values represent the different mode classes of value representations.
  */
-typedef enum {
+typedef enum ir_mode_sort {
        /* Predefined sorts of modes */
        irms_auxiliary,         /**< Only for Firm use. Not extensible. (irm_T) */
        irms_control_flow,      /**< Marks all control flow modes. Not extensible. (irm_BB, irm_X) */
@@ -89,7 +89,7 @@ typedef enum {
 /** These values represent the different arithmetic operations possible with a mode.
     Further arithmetics can be defined, e.g., for @@@ modes.
  */
-typedef enum {
+typedef enum ir_mode_arithmetic {
        irma_uninitialized = 0,
        irma_none = 1,              /**< For modes for which no representation is specified.
                                         These are modes of sort auxiliary, internal_boolean and character. */
@@ -363,6 +363,7 @@ void set_modeP_code(ir_mode *p);
  */
 void set_modeP_data(ir_mode *p);
 
+/*@{*/
 /**
    Functions to check, whether a ir_modecode is signed, float, int, character,
    reference, num, data, datab or dataM.
@@ -393,7 +394,6 @@ void set_modeP_data(ir_mode *p);
 
    Vector "int" and "float" are defined by the arithmetic and vector_elem > 1.
 */
-/*@}*/
 /* Test for a certain class of modes. */
 int mode_is_signed (const ir_mode *mode);
 int mode_is_float (const ir_mode *mode);
@@ -405,11 +405,28 @@ int mode_is_datab (const ir_mode *mode);
 int mode_is_dataM (const ir_mode *mode);
 int mode_is_float_vector (const ir_mode *mode);
 int mode_is_int_vector (const ir_mode *mode);
+/*@}*/
 
-/** Returns true if sm can be converted to lm without loss
-   according to firm definition */
+/**
+ * Returns true if sm can be converted to lm without loss
+ * according to firm definition.
+ *
+ * Note that mode_Iu is NOT smaller than mode_Is here.
+ *
+ * @see values_in_mode()
+ */
 int smaller_mode(const ir_mode *sm, const ir_mode *lm);
 
+/**
+ * Returns true if a value of mode sm can be converted into mode lm
+ * and backwards without loss.
+ *
+ * Note that mode_Iu values CAN be converted in mode_Is and back.
+ *
+ * @see smaller_mode()
+ */
+int values_in_mode(const ir_mode *sm, const ir_mode *lm);
+
 /**
  * Returns a matching unsigned mode for a given integer signed mode.
  * Returns NULL if no matching mode exists.
@@ -467,4 +484,11 @@ ir_mode *get_reference_mode_unsigned_eq(ir_mode *mode);
  */
 void set_reference_mode_unsigned_eq(ir_mode *ref_mode, ir_mode *int_mode);
 
+/**
+ * Returns non-zero if the cast from mode src to mode dst is a
+ * reinterpret cast (ie. only the bit pattern is reinterpreted,
+ * no conversion is done)
+ */
+int is_reinterpret_cast(const ir_mode *src, const ir_mode *dst);
+
 #endif