summaryrefslogtreecommitdiffstats
path: root/gcc/targhooks.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-26 00:24:37 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-26 00:24:37 +0000
commitb2aef146490d4d5268f3611232ab495169864c13 (patch)
tree16040afedbe7456a6d5be99edc239c4efcbd88c1 /gcc/targhooks.c
parent87e804868c98a5e30c86483d3b766928f2742c44 (diff)
downloadppe42-gcc-b2aef146490d4d5268f3611232ab495169864c13.tar.gz
ppe42-gcc-b2aef146490d4d5268f3611232ab495169864c13.zip
* target-def.h (TARGET_SCALAR_MODE_SUPPORTED_P): New.
* target.h (struct gcc_target): Add scalar_mode_supported_p. * targhooks.c (default_scalar_mode_supported_p): New. * targhooks.h (default_scalar_mode_supported_p): Declare. * doc/tm.texi (TARGET_SCALAR_MODE_SUPPORTED_P): Document. * c-common.c (handle_mode_attribute): Query scalar_mode_supported_p before attempting to create types. Tidy. * expr.c (vector_mode_valid_p): Use scalar_mode_supported_p. * config/alpha/alpha.c (alpha_scalar_mode_supported_p): New. (TARGET_SCALAR_MODE_SUPPORTED_P): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86593 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/targhooks.c')
-rw-r--r--gcc/targhooks.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 00d7e8444d7..6aa2e07117b 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -62,6 +62,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tm_p.h"
#include "target-def.h"
+
void
default_external_libcall (rtx fun ATTRIBUTE_UNUSED)
{
@@ -207,3 +208,49 @@ default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED,
/* Should never happen. */
abort ();
}
+
+/* True if MODE is valid for the target. By "valid", we mean able to
+ be manipulated in non-trivial ways. In particular, this means all
+ the arithmetic is supported.
+
+ By default we guess this means that any C type is supported. If
+ we can't map the mode back to a type that would be available in C,
+ then reject it. Special case, here, is the double-word arithmetic
+ supported by optabs.c. */
+
+bool
+default_scalar_mode_supported_p (enum machine_mode mode)
+{
+ int precision = GET_MODE_PRECISION (mode);
+
+ switch (GET_MODE_CLASS (mode))
+ {
+ case MODE_PARTIAL_INT:
+ case MODE_INT:
+ if (precision == CHAR_TYPE_SIZE)
+ return true;
+ if (precision == SHORT_TYPE_SIZE)
+ return true;
+ if (precision == INT_TYPE_SIZE)
+ return true;
+ if (precision == LONG_TYPE_SIZE)
+ return true;
+ if (precision == LONG_LONG_TYPE_SIZE)
+ return true;
+ if (precision == 2 * BITS_PER_WORD)
+ return true;
+ return false;
+
+ case MODE_FLOAT:
+ if (precision == FLOAT_TYPE_SIZE)
+ return true;
+ if (precision == DOUBLE_TYPE_SIZE)
+ return true;
+ if (precision == LONG_DOUBLE_TYPE_SIZE)
+ return true;
+ return false;
+
+ default:
+ abort ();
+ }
+}
OpenPOWER on IntegriCloud