This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, ARM] attribute target (thumb,arm) [5.2/6] respin (5th)
- From: Christian Bruel <christian dot bruel at st dot com>
- To: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, "nickc at redhat dot com" <nickc at redhat dot com>
- Date: Mon, 18 May 2015 12:45:33 +0200
- Subject: Re: [PATCH, ARM] attribute target (thumb,arm) [5.2/6] respin (5th)
- Authentication-results: sourceware.org; auth=none
- References: <554A24D0 dot 8020407 at st dot com> <554C7F50 dot 4090705 at arm dot com> <5559A23B dot 9030705 at st dot com>
+ additional chunks needed to redefine the macros for #pragma GCC target
Applies on top of [5/6]
thanks,
Christian
2014-09-23 Christian Bruel <christian.bruel@st.com>
* config/arm/arm-c.c (arm_cpu_cpp_builtins): Conditionally define
macros in ...
(arm_cpu_builtins): New function.
(arm_pragma_target_parse): Call arm_cpu_builtins.
* config/arm/arm-protos.h (arm_cpu_builtins): New function.
diff '--exclude=.svn' -ruN gnu_trunk.p4/gcc/gcc/config/arm/arm-c.c gnu_trunk.p5/gcc/gcc/config/arm/arm-c.c
--- gnu_trunk.p4/gcc/gcc/config/arm/arm-c.c 2015-05-18 12:08:18.087479113 +0200
+++ gnu_trunk.p5/gcc/gcc/config/arm/arm-c.c 2015-05-18 11:34:40.808410823 +0200
@@ -71,10 +71,8 @@
}
void
-arm_cpu_cpp_builtins (struct cpp_reader * pfile)
+arm_cpu_builtins (struct cpp_reader* pfile, int flags)
{
- int flags = target_flags;
-
def_or_undef_macro (pfile, "__ARM_FEATURE_DSP",
TARGET_DSP_MULTIPLY_P (flags));
def_or_undef_macro (pfile, "__ARM_FEATURE_QBIT",
@@ -166,8 +164,6 @@
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)
@@ -188,14 +184,21 @@
builtin_define ("__ARM_EABI__");
}
-
-
def_or_undef_macro (pfile, "__ARM_ARCH_EXT_IDIV__", TARGET_IDIV_P (flags));
def_or_undef_macro (pfile, "__ARM_FEATURE_IDIV", TARGET_IDIV_P (flags));
def_or_undef_macro (pfile, "__ARM_ASM_SYNTAX_UNIFIED__", inline_asm_unified);
}
+void
+arm_cpu_cpp_builtins (struct cpp_reader * pfile)
+{
+ builtin_assert ("cpu=arm");
+ builtin_assert ("machine=arm");
+
+ arm_cpu_builtins (pfile, target_flags);
+}
+
/* Hook to validate the current #pragma GCC target and set the arch custom
mode state. If ARGS is NULL, then POP_TARGET is used to reset
the options. */
@@ -206,7 +209,6 @@
tree cur_tree;
struct cl_target_option *prev_opt;
struct cl_target_option *cur_opt;
- bool cur_mode, prev_mode;
if (! args)
{
@@ -236,10 +238,7 @@
gcc_assert (prev_opt);
gcc_assert (cur_opt);
- cur_mode = TARGET_THUMB_P (cur_opt->x_target_flags);
- prev_mode = TARGET_THUMB_P (prev_opt->x_target_flags);
-
- if (prev_mode != cur_mode)
+ if (cur_opt->x_target_flags != prev_opt->x_target_flags)
{
/* For the definitions, ensure all newly defined macros are considered
as used for -Wunused-macros. There is no point warning about the
@@ -248,9 +247,8 @@
unsigned char saved_warn_unused_macros = cpp_opts->warn_unused_macros;
cpp_opts->warn_unused_macros = 0;
- /* Update macros.
- arm_cpp_builtins (parse_in, cur_mode);
- */
+ /* Update macros. */
+ arm_cpu_builtins (parse_in, cur_opt->x_target_flags);
cpp_opts->warn_unused_macros = saved_warn_unused_macros;
}
diff '--exclude=.svn' -ruN gnu_trunk.p4/gcc/gcc/config/arm/arm-protos.h gnu_trunk.p5/gcc/gcc/config/arm/arm-protos.h
--- gnu_trunk.p4/gcc/gcc/config/arm/arm-protos.h 2015-05-18 12:08:18.099479131 +0200
+++ gnu_trunk.p5/gcc/gcc/config/arm/arm-protos.h 2015-05-18 11:34:49.300423564 +0200
@@ -338,6 +338,7 @@
extern void arm_lang_object_attributes_init (void);
extern void arm_register_target_pragmas (void);
extern void arm_cpu_cpp_builtins (struct cpp_reader *);
+extern void arm_cpu_builtins (struct cpp_reader *, int);
extern bool arm_is_constant_pool_ref (rtx);