aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/c-family/c-common.h2
-rw-r--r--gcc/c-family/c-cppbuiltin.c7
-rw-r--r--gcc/config/arm/arm-c.c123
-rw-r--r--gcc/config/arm/arm-protos.h6
-rw-r--r--gcc/config/arm/arm.h127
6 files changed, 144 insertions, 133 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 771aee1..70a8f0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2015-05-26 Christian Bruel <christian.bruel@st.com>
+
+ * c-common.h (builtin_define_with_int_value)
+ (builtin_define_type_sizeof): Declare.
+ * c-cppbuiltin.c (builtin_define_with_int_value)
+ (builtin_define_type_sizeof): Externalize.
+ (builtin_define_std): Cleanup declaration.
+ * config/arm/arm-protos.h (arm_cpu_cpp_builtins): Declare.
+ * config/arm/arm.h (TARGET_CPU_CPP_BUILTINS): Move macro defines into...
+ * config/arm/arm-c.c (arm_cpu_cpp_builtins): New function.
+ (builtin_define, builtin_assert): New macros.
+
2015-05-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/66142
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 0eaff05..61900db 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1092,6 +1092,8 @@ extern const unsigned char executable_checksum[16];
/* In c-cppbuiltin.c */
extern void builtin_define_std (const char *macro);
extern void builtin_define_with_value (const char *, const char *, int);
+extern void builtin_define_with_int_value (const char *, HOST_WIDE_INT);
+extern void builtin_define_type_sizeof (const char *, tree);
extern void c_stddef_cpp_builtins (void);
extern void fe_file_change (const line_map_ordinary *);
extern void c_parse_error (const char *, enum cpp_ttype, tree, unsigned char);
diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c
index 4170154..a8e6310 100644
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -58,8 +58,6 @@ along with GCC; see the file COPYING3. If not see
#endif
/* Non-static as some targets don't use it. */
-void builtin_define_std (const char *) ATTRIBUTE_UNUSED;
-static void builtin_define_with_int_value (const char *, HOST_WIDE_INT);
static void builtin_define_with_hex_fp_value (const char *, tree,
int, const char *,
const char *,
@@ -68,7 +66,6 @@ static void builtin_define_stdint_macros (void);
static void builtin_define_constants (const char *, tree);
static void builtin_define_type_max (const char *, tree);
static void builtin_define_type_minmax (const char *, const char *, tree);
-static void builtin_define_type_sizeof (const char *, tree);
static void builtin_define_float_constants (const char *,
const char *,
const char *,
@@ -113,7 +110,7 @@ mode_has_fma (machine_mode mode)
}
/* Define NAME with value TYPE size_unit. */
-static void
+void
builtin_define_type_sizeof (const char *name, tree type)
{
builtin_define_with_int_value (name,
@@ -1371,7 +1368,7 @@ builtin_define_with_value (const char *macro, const char *expansion, int is_str)
/* Pass an object-like macro and an integer value to define it to. */
-static void
+void
builtin_define_with_int_value (const char *macro, HOST_WIDE_INT value)
{
char *buf;
diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c
index 3e4d168..8dfbd78 100644
--- a/gcc/config/arm/arm-c.c
+++ b/gcc/config/arm/arm-c.c
@@ -51,3 +51,126 @@ arm_lang_object_attributes_init (void)
{
arm_lang_output_object_attributes_hook = arm_output_c_attributes;
}
+
+#define builtin_define(TXT) cpp_define (pfile, TXT)
+#define builtin_assert(TXT) cpp_assert (pfile, TXT)
+
+void
+arm_cpu_cpp_builtins (struct cpp_reader * pfile)
+{
+ if (TARGET_DSP_MULTIPLY)
+ builtin_define ("__ARM_FEATURE_DSP");
+ if (TARGET_ARM_QBIT)
+ builtin_define ("__ARM_FEATURE_QBIT");
+ if (TARGET_ARM_SAT)
+ builtin_define ("__ARM_FEATURE_SAT");
+ if (TARGET_CRYPTO)
+ builtin_define ("__ARM_FEATURE_CRYPTO");
+ if (unaligned_access)
+ builtin_define ("__ARM_FEATURE_UNALIGNED");
+ if (TARGET_CRC32)
+ builtin_define ("__ARM_FEATURE_CRC32");
+ if (TARGET_32BIT)
+ builtin_define ("__ARM_32BIT_STATE");
+ if (TARGET_ARM_FEATURE_LDREX)
+ builtin_define_with_int_value ("__ARM_FEATURE_LDREX",
+ TARGET_ARM_FEATURE_LDREX);
+ if ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB)
+ || TARGET_ARM_ARCH_ISA_THUMB >=2)
+ builtin_define ("__ARM_FEATURE_CLZ");
+ if (TARGET_INT_SIMD)
+ builtin_define ("__ARM_FEATURE_SIMD32");
+
+ builtin_define_with_int_value ("__ARM_SIZEOF_MINIMAL_ENUM",
+ flag_short_enums ? 1 : 4);
+ builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", wchar_type_node);
+ if (TARGET_ARM_ARCH_PROFILE)
+ builtin_define_with_int_value ("__ARM_ARCH_PROFILE",
+ TARGET_ARM_ARCH_PROFILE);
+
+ /* Define __arm__ even when in thumb mode, for
+ consistency with armcc. */
+ builtin_define ("__arm__");
+ if (TARGET_ARM_ARCH)
+ builtin_define_with_int_value ("__ARM_ARCH", TARGET_ARM_ARCH);
+ if (arm_arch_notm)
+ builtin_define ("__ARM_ARCH_ISA_ARM");
+ builtin_define ("__APCS_32__");
+ if (TARGET_THUMB)
+ builtin_define ("__thumb__");
+ if (TARGET_THUMB2)
+ builtin_define ("__thumb2__");
+ if (TARGET_ARM_ARCH_ISA_THUMB)
+ builtin_define_with_int_value ("__ARM_ARCH_ISA_THUMB",
+ TARGET_ARM_ARCH_ISA_THUMB);
+
+ if (TARGET_BIG_END)
+ {
+ builtin_define ("__ARMEB__");
+ builtin_define ("__ARM_BIG_ENDIAN");
+ if (TARGET_THUMB)
+ builtin_define ("__THUMBEB__");
+ }
+ else
+ {
+ builtin_define ("__ARMEL__");
+ if (TARGET_THUMB)
+ builtin_define ("__THUMBEL__");
+ }
+
+ if (TARGET_SOFT_FLOAT)
+ builtin_define ("__SOFTFP__");
+
+ if (TARGET_VFP)
+ builtin_define ("__VFP_FP__");
+
+ if (TARGET_ARM_FP)
+ builtin_define_with_int_value ("__ARM_FP", TARGET_ARM_FP);
+ if (arm_fp16_format == ARM_FP16_FORMAT_IEEE)
+ builtin_define ("__ARM_FP16_FORMAT_IEEE");
+ if (arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE)
+ builtin_define ("__ARM_FP16_FORMAT_ALTERNATIVE");
+ if (TARGET_FMA)
+ builtin_define ("__ARM_FEATURE_FMA");
+
+ if (TARGET_NEON)
+ {
+ builtin_define ("__ARM_NEON__");
+ builtin_define ("__ARM_NEON");
+ }
+ if (TARGET_NEON_FP)
+ builtin_define_with_int_value ("__ARM_NEON_FP", TARGET_NEON_FP);
+
+ /* Add a define for interworking. Needed when building libgcc.a. */
+ if (arm_cpp_interwork)
+ builtin_define ("__THUMB_INTERWORK__");
+
+ builtin_assert ("cpu=arm");
+ builtin_assert ("machine=arm");
+
+ builtin_define (arm_arch_name);
+ if (arm_arch_xscale)
+ builtin_define ("__XSCALE__");
+ if (arm_arch_iwmmxt)
+ {
+ builtin_define ("__IWMMXT__");
+ builtin_define ("__ARM_WMMX");
+ }
+ if (arm_arch_iwmmxt2)
+ builtin_define ("__IWMMXT2__");
+ if (TARGET_AAPCS_BASED)
+ {
+ if (arm_pcs_default == ARM_PCS_AAPCS_VFP)
+ builtin_define ("__ARM_PCS_VFP");
+ else if (arm_pcs_default == ARM_PCS_AAPCS)
+ builtin_define ("__ARM_PCS");
+ builtin_define ("__ARM_EABI__");
+ }
+ if (TARGET_IDIV)
+ {
+ builtin_define ("__ARM_ARCH_EXT_IDIV__");
+ builtin_define ("__ARM_FEATURE_IDIV");
+ }
+ if (inline_asm_unified)
+ builtin_define ("__ARM_ASM_SYNTAX_UNIFIED__");
+}
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 3eafa5d..91907b8 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -216,8 +216,6 @@ extern void arm_pr_long_calls (struct cpp_reader *);
extern void arm_pr_no_long_calls (struct cpp_reader *);
extern void arm_pr_long_calls_off (struct cpp_reader *);
-extern void arm_lang_object_attributes_init(void);
-
extern const char *arm_mangle_type (const_tree);
extern const char *arm_mangle_builtin_type (const_tree);
@@ -331,6 +329,10 @@ extern void arm_emit_eabi_attribute (const char *, int, int);
/* Defined in gcc/common/config/arm-common.c. */
extern const char *arm_rewrite_selected_cpu (const char *name);
+/* Defined in gcc/common/config/arm-c.c. */
+extern void arm_lang_object_attributes_init (void);
+extern void arm_cpu_cpp_builtins (struct cpp_reader *);
+
extern bool arm_is_constant_pool_ref (rtx);
/* Flags used to identify the presence of processor capabilities. */
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 6480123..4cdd60d 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -45,132 +45,7 @@
extern char arm_arch_name[];
/* Target CPU builtins. */
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- if (TARGET_DSP_MULTIPLY) \
- builtin_define ("__ARM_FEATURE_DSP"); \
- if (TARGET_ARM_QBIT) \
- builtin_define ("__ARM_FEATURE_QBIT"); \
- if (TARGET_ARM_SAT) \
- builtin_define ("__ARM_FEATURE_SAT"); \
- if (TARGET_CRYPTO) \
- builtin_define ("__ARM_FEATURE_CRYPTO"); \
- if (unaligned_access) \
- builtin_define ("__ARM_FEATURE_UNALIGNED"); \
- if (TARGET_CRC32) \
- builtin_define ("__ARM_FEATURE_CRC32"); \
- if (TARGET_32BIT) \
- builtin_define ("__ARM_32BIT_STATE"); \
- if (TARGET_ARM_FEATURE_LDREX) \
- builtin_define_with_int_value ( \
- "__ARM_FEATURE_LDREX", TARGET_ARM_FEATURE_LDREX); \
- if ((TARGET_ARM_ARCH >= 5 && !TARGET_THUMB) \
- || TARGET_ARM_ARCH_ISA_THUMB >=2) \
- builtin_define ("__ARM_FEATURE_CLZ"); \
- if (TARGET_INT_SIMD) \
- builtin_define ("__ARM_FEATURE_SIMD32"); \
- \
- builtin_define_with_int_value ( \
- "__ARM_SIZEOF_MINIMAL_ENUM", \
- flag_short_enums ? 1 : 4); \
- builtin_define_type_sizeof ("__ARM_SIZEOF_WCHAR_T", \
- wchar_type_node); \
- if (TARGET_ARM_ARCH_PROFILE) \
- builtin_define_with_int_value ( \
- "__ARM_ARCH_PROFILE", TARGET_ARM_ARCH_PROFILE); \
- \
- /* Define __arm__ even when in thumb mode, for \
- consistency with armcc. */ \
- builtin_define ("__arm__"); \
- if (TARGET_ARM_ARCH) \
- builtin_define_with_int_value ( \
- "__ARM_ARCH", TARGET_ARM_ARCH); \
- if (arm_arch_notm) \
- builtin_define ("__ARM_ARCH_ISA_ARM"); \
- builtin_define ("__APCS_32__"); \
- if (TARGET_THUMB) \
- builtin_define ("__thumb__"); \
- if (TARGET_THUMB2) \
- builtin_define ("__thumb2__"); \
- if (TARGET_ARM_ARCH_ISA_THUMB) \
- builtin_define_with_int_value ( \
- "__ARM_ARCH_ISA_THUMB", \
- TARGET_ARM_ARCH_ISA_THUMB); \
- \
- if (TARGET_BIG_END) \
- { \
- builtin_define ("__ARMEB__"); \
- builtin_define ("__ARM_BIG_ENDIAN"); \
- if (TARGET_THUMB) \
- builtin_define ("__THUMBEB__"); \
- } \
- else \
- { \
- builtin_define ("__ARMEL__"); \
- if (TARGET_THUMB) \
- builtin_define ("__THUMBEL__"); \
- } \
- \
- if (TARGET_SOFT_FLOAT) \
- builtin_define ("__SOFTFP__"); \
- \
- if (TARGET_VFP) \
- builtin_define ("__VFP_FP__"); \
- \
- if (TARGET_ARM_FP) \
- builtin_define_with_int_value ( \
- "__ARM_FP", TARGET_ARM_FP); \
- if (arm_fp16_format == ARM_FP16_FORMAT_IEEE) \
- builtin_define ("__ARM_FP16_FORMAT_IEEE"); \
- if (arm_fp16_format == ARM_FP16_FORMAT_ALTERNATIVE) \
- builtin_define ("__ARM_FP16_FORMAT_ALTERNATIVE"); \
- if (TARGET_FMA) \
- builtin_define ("__ARM_FEATURE_FMA"); \
- \
- if (TARGET_NEON) \
- { \
- builtin_define ("__ARM_NEON__"); \
- builtin_define ("__ARM_NEON"); \
- } \
- if (TARGET_NEON_FP) \
- builtin_define_with_int_value ( \
- "__ARM_NEON_FP", TARGET_NEON_FP); \
- \
- /* Add a define for interworking. \
- Needed when building libgcc.a. */ \
- if (arm_cpp_interwork) \
- builtin_define ("__THUMB_INTERWORK__"); \
- \
- builtin_assert ("cpu=arm"); \
- builtin_assert ("machine=arm"); \
- \
- builtin_define (arm_arch_name); \
- if (arm_arch_xscale) \
- builtin_define ("__XSCALE__"); \
- if (arm_arch_iwmmxt) \
- { \
- builtin_define ("__IWMMXT__"); \
- builtin_define ("__ARM_WMMX"); \
- } \
- if (arm_arch_iwmmxt2) \
- builtin_define ("__IWMMXT2__"); \
- if (TARGET_AAPCS_BASED) \
- { \
- if (arm_pcs_default == ARM_PCS_AAPCS_VFP) \
- builtin_define ("__ARM_PCS_VFP"); \
- else if (arm_pcs_default == ARM_PCS_AAPCS) \
- builtin_define ("__ARM_PCS"); \
- builtin_define ("__ARM_EABI__"); \
- } \
- if (TARGET_IDIV) \
- { \
- builtin_define ("__ARM_ARCH_EXT_IDIV__"); \
- builtin_define ("__ARM_FEATURE_IDIV"); \
- } \
- if (inline_asm_unified) \
- builtin_define ("__ARM_ASM_SYNTAX_UNIFIED__");\
- } while (0)
+#define TARGET_CPU_CPP_BUILTINS() arm_cpu_cpp_builtins (pfile)
#include "config/arm/arm-opts.h"