@@ -61,6 +61,8 @@ class scalar_float_mode;
template<typename> class opt_mode;
typedef opt_mode<scalar_int_mode> opt_scalar_int_mode;
typedef opt_mode<scalar_float_mode> opt_scalar_float_mode;
+template<typename> class pod_mode;
+typedef pod_mode<scalar_int_mode> scalar_int_mode_pod;
/* Subclasses of rtx_def, using indentation to show the class
hierarchy, along with the relevant invariant.
@@ -1799,7 +1799,7 @@ emit_mode_int_n (void)
m = mode_sort[i];
printf(" {\n");
tagged_printf ("%u", m->int_n, m->name);
- printf ("E_%smode,", m->name);
+ printf ("{ E_%smode },", m->name);
printf(" },\n");
}
@@ -247,6 +247,17 @@ opt_mode<T>::exists (U *mode) const
return false;
}
+/* A POD version of mode class T. */
+
+template<typename T>
+struct pod_mode
+{
+ machine_mode_enum m_mode;
+ ALWAYS_INLINE operator machine_mode_enum () const { return m_mode; }
+ ALWAYS_INLINE operator T () const { return T::from_int (m_mode); }
+ ALWAYS_INLINE pod_mode &operator = (const T &m) { m_mode = m; return *this; }
+};
+
/* Return true if mode M has type T. */
template<typename T>
@@ -649,7 +660,7 @@ extern void init_adjust_machine_modes (void);
struct int_n_data_t {
/* These parts are initailized by genmodes output */
unsigned int bitsize;
- machine_mode_enum m;
+ scalar_int_mode_pod m;
/* RID_* is RID_INTN_BASE + index into this array */
};