aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-common.c')
-rw-r--r--gcc/c-family/c-common.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index aaaa2727c4f..3614d0e8e9e 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -19,10 +19,6 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-/* FIXME: Still need to include rtl.h here (via expr.h) in a front-end file.
- Pretend this is a back-end file. */
-#undef IN_GCC_FRONTEND
-
#include "config.h"
#include "system.h"
#include "coretypes.h"
@@ -50,8 +46,6 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "libfuncs.h"
-#include "expr.h" /* For vector_mode_valid_p */
-
cpp_reader *parse_in; /* Declared in c-pragma.h. */
/* The following symbols are subsumed in the c_global_trees array, and
@@ -4031,7 +4025,7 @@ c_type_hash (const void *p)
default:
gcc_unreachable ();
}
- for (; t2; t2 = TREE_CHAIN (t2))
+ for (; t2; t2 = DECL_CHAIN (t2))
i++;
/* We might have a VLA here. */
if (TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
@@ -6252,6 +6246,40 @@ handle_destructor_attribute (tree *node, tree name, tree args,
return NULL_TREE;
}
+/* Nonzero if the mode is a valid vector mode for this architecture.
+ This returns nonzero even if there is no hardware support for the
+ vector mode, but we can emulate with narrower modes. */
+
+static int
+vector_mode_valid_p (enum machine_mode mode)
+{
+ enum mode_class mclass = GET_MODE_CLASS (mode);
+ enum machine_mode innermode;
+
+ /* Doh! What's going on? */
+ if (mclass != MODE_VECTOR_INT
+ && mclass != MODE_VECTOR_FLOAT
+ && mclass != MODE_VECTOR_FRACT
+ && mclass != MODE_VECTOR_UFRACT
+ && mclass != MODE_VECTOR_ACCUM
+ && mclass != MODE_VECTOR_UACCUM)
+ return 0;
+
+ /* Hardware support. Woo hoo! */
+ if (targetm.vector_mode_supported_p (mode))
+ return 1;
+
+ innermode = GET_MODE_INNER (mode);
+
+ /* We should probably return 1 if requesting V4DI and we have no DI,
+ but we have V2DI, but this is probably very unlikely. */
+
+ /* If we have support for the inner mode, we can safely emulate it.
+ We may not have V2DI, but me can emulate with a pair of DIs. */
+ return targetm.scalar_mode_supported_p (innermode);
+}
+
+
/* Handle a "mode" attribute; arguments as in
struct attribute_spec.handler. */
@@ -8391,8 +8419,8 @@ fold_offsetof_1 (tree expr, tree stop_ref)
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (v, 0)))
== RECORD_TYPE)
{
- tree fld_chain = TREE_CHAIN (TREE_OPERAND (v, 1));
- for (; fld_chain; fld_chain = TREE_CHAIN (fld_chain))
+ tree fld_chain = DECL_CHAIN (TREE_OPERAND (v, 1));
+ for (; fld_chain; fld_chain = DECL_CHAIN (fld_chain))
if (TREE_CODE (fld_chain) == FIELD_DECL)
break;