diff options
author | Richard Henderson <rth@redhat.com> | 2004-08-25 17:24:37 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-08-25 17:24:37 -0700 |
commit | 6dd53648e913ea6ad55131ed0c8cc2709e9a3316 (patch) | |
tree | 16040afedbe7456a6d5be99edc239c4efcbd88c1 /gcc/targhooks.c | |
parent | 9950712b1dd1615314417b98f8a26cfe5c6b2f32 (diff) | |
download | gcc-6dd53648e913ea6ad55131ed0c8cc2709e9a3316.zip gcc-6dd53648e913ea6ad55131ed0c8cc2709e9a3316.tar.gz gcc-6dd53648e913ea6ad55131ed0c8cc2709e9a3316.tar.bz2 |
target-def.h (TARGET_SCALAR_MODE_SUPPORTED_P): New.
* 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.
From-SVN: r86593
Diffstat (limited to 'gcc/targhooks.c')
-rw-r--r-- | gcc/targhooks.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 00d7e84..6aa2e071 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 (); + } +} |