+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
/* 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);
#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 *,
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 *,
}
/* 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,
/* 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;
{
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__");
+}
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);
/* 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. */
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"