From 382615c64cad28fb4aa0566b25b3f1921b3d6a3d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:20:55 +0000 Subject: [76/77] Add a scalar_mode_pod class This patch adds a scalar_mode_pod class and uses it to replace the machine_mode in fixed_value. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * coretypes.h (scalar_mode_pod): New typedef. * gdbhooks.py (build_pretty_printer): Handle it. * machmode.h (gt_ggc_mx, gt_pch_nx): New functions. * fixed-value.h (fixed_value::mode): Change type to scalar_mode_pod. * fold-const.c (fold_convert_const_int_from_fixed): Use scalar_mode. * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields): Use as_a . Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251526 --- gcc/ChangeLog | 12 ++++++++++++ gcc/coretypes.h | 1 + gcc/fixed-value.h | 4 ++-- gcc/fold-const.c | 2 +- gcc/gdbhooks.py | 3 ++- gcc/machmode.h | 18 ++++++++++++++++++ gcc/tree-streamer-in.c | 2 +- 7 files changed, 37 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc70406..bb81313 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -2,6 +2,18 @@ Alan Hayward David Sherwood + * coretypes.h (scalar_mode_pod): New typedef. + * gdbhooks.py (build_pretty_printer): Handle it. + * machmode.h (gt_ggc_mx, gt_pch_nx): New functions. + * fixed-value.h (fixed_value::mode): Change type to scalar_mode_pod. + * fold-const.c (fold_convert_const_int_from_fixed): Use scalar_mode. + * tree-streamer-in.c (unpack_ts_fixed_cst_value_fields): Use + as_a . + +2017-08-30 Richard Sandiford + Alan Hayward + David Sherwood + * machmode.h (mode_for_vector): Take a scalar_mode instead of a machine_mode. * stor-layout.c (mode_for_vector): Likewise. diff --git a/gcc/coretypes.h b/gcc/coretypes.h index ffe793e..8ccf16e 100644 --- a/gcc/coretypes.h +++ b/gcc/coretypes.h @@ -63,6 +63,7 @@ typedef opt_mode opt_scalar_mode; typedef opt_mode opt_scalar_int_mode; typedef opt_mode opt_scalar_float_mode; template class pod_mode; +typedef pod_mode scalar_mode_pod; typedef pod_mode scalar_int_mode_pod; /* Subclasses of rtx_def, using indentation to show the class diff --git a/gcc/fixed-value.h b/gcc/fixed-value.h index cc2180b..1beb774 100644 --- a/gcc/fixed-value.h +++ b/gcc/fixed-value.h @@ -22,8 +22,8 @@ along with GCC; see the file COPYING3. If not see struct GTY(()) fixed_value { - double_int data; /* Store data up to 2 wide integers. */ - machine_mode mode; /* Use machine mode to know IBIT and FBIT. */ + double_int data; /* Store data up to 2 wide integers. */ + scalar_mode_pod mode; /* Use machine mode to know IBIT and FBIT. */ }; #define FIXED_VALUE_TYPE struct fixed_value diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c921f1c..f3c84a8 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1944,7 +1944,7 @@ fold_convert_const_int_from_fixed (tree type, const_tree arg1) { tree t; double_int temp, temp_trunc; - machine_mode mode; + scalar_mode mode; /* Right shift FIXED_CST to temp by fbit. */ temp = TREE_FIXED_CST (arg1).data; diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index e5f0cf6f3..acf5435 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -548,7 +548,8 @@ def build_pretty_printer(): 'opt_mode', OptMachineModePrinter) pp.add_printer_for_regex(r'pod_mode<(\S+)>', 'pod_mode', MachineModePrinter) - pp.add_printer_for_types(['scalar_int_mode_pod'], + pp.add_printer_for_types(['scalar_int_mode_pod', + 'scalar_mode_pod'], 'pod_mode', MachineModePrinter) for mode in 'scalar_mode', 'scalar_int_mode', 'scalar_float_mode': pp.add_printer_for_types([mode], mode, MachineModePrinter) diff --git a/gcc/machmode.h b/gcc/machmode.h index b3e79ca..73c45be 100644 --- a/gcc/machmode.h +++ b/gcc/machmode.h @@ -893,4 +893,22 @@ namespace mode_iterator mode_iterator::iterate_p (&(ITERATOR)); \ mode_iterator::get_2xwider (&(ITERATOR))) +template +void +gt_ggc_mx (pod_mode *) +{ +} + +template +void +gt_pch_nx (pod_mode *) +{ +} + +template +void +gt_pch_nx (pod_mode *, void (*) (void *, void *), void *) +{ +} + #endif /* not HAVE_MACHINE_MODES */ diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index 8d47547..baf0c5b 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -211,7 +211,7 @@ static void unpack_ts_fixed_cst_value_fields (struct bitpack_d *bp, tree expr) { FIXED_VALUE_TYPE *fp = ggc_alloc (); - fp->mode = bp_unpack_machine_mode (bp); + fp->mode = as_a (bp_unpack_machine_mode (bp)); fp->data.low = bp_unpack_var_len_int (bp); fp->data.high = bp_unpack_var_len_int (bp); TREE_FIXED_CST_PTR (expr) = fp; -- cgit v1.1