aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-08-30 11:10:18 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-08-30 11:10:18 +0000
commitbf862c537bfd76233e3938cb3811f0fa2d27de25 (patch)
tree5fd8f2ebbbbf5d9f4a23b09cb8fb7bf2880aed0a /gcc
parent501623d42404843e3b737db24bbd575db937ce1d (diff)
downloadgcc-bf862c537bfd76233e3938cb3811f0fa2d27de25.zip
gcc-bf862c537bfd76233e3938cb3811f0fa2d27de25.tar.gz
gcc-bf862c537bfd76233e3938cb3811f0fa2d27de25.tar.bz2
[16/77] Add scalar_int_mode_pod
This patch adds a POD class for scalar integers, as an instance of a new pod_mode template. Later patches will use pod_mode in situations that really do need to be POD; this patch is simply using PODs to remove load-time initialisation. 2017-08-30 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * coretypes.h (pod_mode): New type. (scalar_int_mode_pod): New typedef. * machmode.h (pod_mode): New class. (int_n_data_t::m): Change type to scalar_int_mode_pod. * genmodes.c (emit_mode_int_n): Update accordingly. * lower-subreg.h (target_lower_subreg): Change type to scalar_int_mode_pod. * gdbhooks.py (build_pretty_printer): Handle pod_mode and scalar_int_mode_pod. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r251468
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/coretypes.h2
-rw-r--r--gcc/gdbhooks.py4
-rw-r--r--gcc/genmodes.c2
-rw-r--r--gcc/lower-subreg.h2
-rw-r--r--gcc/machmode.h15
6 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f8f970..d7e70be 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -2,6 +2,20 @@
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
+ * coretypes.h (pod_mode): New type.
+ (scalar_int_mode_pod): New typedef.
+ * machmode.h (pod_mode): New class.
+ (int_n_data_t::m): Change type to scalar_int_mode_pod.
+ * genmodes.c (emit_mode_int_n): Update accordingly.
+ * lower-subreg.h (target_lower_subreg): Change type to
+ scalar_int_mode_pod.
+ * gdbhooks.py (build_pretty_printer): Handle pod_mode and
+ scalar_int_mode_pod.
+
+2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
+ Alan Hayward <alan.hayward@arm.com>
+ David Sherwood <david.sherwood@arm.com>
+
* config/powerpcspe/powerpcspe.h (rs6000_pmode): Change type from
machine_mode to scalar_int_mode.
* config/powerpcspe/powerpcspe.c (rs6000_pmode): Likewise.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6e01a50..37c836d 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -60,6 +60,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.
diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 782e93f..678698d 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -545,6 +545,10 @@ def build_pretty_printer():
pp.add_printer_for_types(['opt_scalar_int_mode',
'opt_scalar_float_mode'],
'opt_mode', OptMachineModePrinter)
+ pp.add_printer_for_regex(r'pod_mode<(\S+)>',
+ 'pod_mode', MachineModePrinter)
+ pp.add_printer_for_types(['scalar_int_mode_pod'],
+ 'pod_mode', MachineModePrinter)
for mode in 'scalar_int_mode', 'scalar_float_mode':
pp.add_printer_for_types([mode], mode, MachineModePrinter)
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index c7d8c75..3eb9b44 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -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");
}
diff --git a/gcc/lower-subreg.h b/gcc/lower-subreg.h
index 4aed62f..69e8c29 100644
--- a/gcc/lower-subreg.h
+++ b/gcc/lower-subreg.h
@@ -43,7 +43,7 @@ struct lower_subreg_choices {
/* Target-specific information for the subreg lowering pass. */
struct target_lower_subreg {
/* An integer mode that is twice as wide as word_mode. */
- machine_mode x_twice_word_mode;
+ scalar_int_mode_pod x_twice_word_mode;
/* What we have decided to do when optimizing for size (index 0)
and speed (index 1). */
diff --git a/gcc/machmode.h b/gcc/machmode.h
index dda7c0a..25e72a8 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -293,6 +293,19 @@ opt_mode<T>::exists (U *mode) const
return false;
}
+/* A POD version of mode class T. */
+
+template<typename T>
+struct pod_mode
+{
+ typedef typename mode_traits<T>::from_int from_int;
+
+ machine_mode m_mode;
+ ALWAYS_INLINE operator machine_mode () const { return m_mode; }
+ ALWAYS_INLINE operator T () const { return 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>
@@ -647,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 m;
+ scalar_int_mode_pod m;
/* RID_* is RID_INTN_BASE + index into this array */
};