From a97390bf6e92f6f9b0f4e20aff4390ca5c609e37 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:21:04 +0000 Subject: [77/77] Add a complex_mode class This patch adds another machine_mode wrapper for modes that are known to be COMPLEX_MODE_P. There aren't yet many places that make use of it, but that might change in future. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * coretypes.h (complex_mode): New type. * gdbhooks.py (build_pretty_printer): Handle it. * machmode.h (complex_mode): New class. (complex_mode::includes_p): New function. (is_complex_int_mode): Likewise. (is_complex_float_mode): Likewise. * genmodes.c (get_mode_class): Handle complex mode classes. * function.c (expand_function_end): Use is_complex_int_mode. gcc/go/ * go-lang.c (go_langhook_type_for_mode): Use is_complex_float_mode. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251527 --- gcc/go/ChangeLog | 6 ++++++ gcc/go/go-lang.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'gcc/go') diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index ea47870..83138d3 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -2,6 +2,12 @@ Alan Hayward David Sherwood + * go-lang.c (go_langhook_type_for_mode): Use is_complex_float_mode. + +2017-08-30 Richard Sandiford + Alan Hayward + David Sherwood + * go-lang.c (go_langhook_type_for_mode): Use is_int_mode. 2017-08-30 Richard Sandiford diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index d470d5a..81eeb5c 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -384,7 +384,7 @@ go_langhook_type_for_mode (machine_mode mode, int unsignedp) scalar_int_mode imode; scalar_float_mode fmode; - enum mode_class mc = GET_MODE_CLASS (mode); + complex_mode cmode; if (is_int_mode (mode, &imode)) return go_langhook_type_for_size (GET_MODE_BITSIZE (imode), unsignedp); else if (is_float_mode (mode, &fmode)) @@ -402,9 +402,9 @@ go_langhook_type_for_mode (machine_mode mode, int unsignedp) return long_double_type_node; } } - else if (mc == MODE_COMPLEX_FLOAT) + else if (is_complex_float_mode (mode, &cmode)) { - switch (GET_MODE_BITSIZE (mode)) + switch (GET_MODE_BITSIZE (cmode)) { case 64: return complex_float_type_node; @@ -413,7 +413,7 @@ go_langhook_type_for_mode (machine_mode mode, int unsignedp) default: // We have to check for long double in order to support // i386 excess precision. - if (mode == TYPE_MODE(complex_long_double_type_node)) + if (cmode == TYPE_MODE(complex_long_double_type_node)) return complex_long_double_type_node; } } -- cgit v1.1