aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-09-26 19:04:35 +0000
committerDavid S. Miller <davem@gcc.gnu.org>2011-09-26 12:04:35 -0700
commit8d12174db5a92005143deae74b57e553cfa97266 (patch)
tree6c047b798984899fe89ec8b5c02c76d52d97768a /gcc/config
parent6cb1ef51438f731064431977ca56f7db598409d1 (diff)
downloadgcc-8d12174db5a92005143deae74b57e553cfa97266.zip
gcc-8d12174db5a92005143deae74b57e553cfa97266.tar.gz
gcc-8d12174db5a92005143deae74b57e553cfa97266.tar.bz2
Move target CPP macro handling to C file and add __VIS/__VIS__.
* config/sparc/sparc-c.c: New file implementing sparc_target_macros, which will now define __VIS and __VIS__ when -mvis is enabled. * config/sparc/t-sparc: Likewise. * config.gcc: Add sparc-c.o to c_target_objs and cxx_target_objs, and add t-sparc to tmake_file for all sparc targets. * config/sparc/sparc-protos.h (sparc_target_macros): Declare. * config/sparc/sparc.h (TARGE_CPU_CPP_BUILTINS): Call it. From-SVN: r179210
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/sparc/sparc-c.c53
-rw-r--r--gcc/config/sparc/sparc-protos.h1
-rw-r--r--gcc/config/sparc/sparc.h20
-rw-r--r--gcc/config/sparc/t-sparc36
4 files changed, 91 insertions, 19 deletions
diff --git a/gcc/config/sparc/sparc-c.c b/gcc/config/sparc/sparc-c.c
new file mode 100644
index 0000000..6e30950
--- /dev/null
+++ b/gcc/config/sparc/sparc-c.c
@@ -0,0 +1,53 @@
+/* Subroutines used for macro/preprocessor support on SPARC.
+ Copyright (C) 2011
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+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/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "tm_p.h"
+#include "flags.h"
+#include "c-family/c-common.h"
+#include "c-family/c-pragma.h"
+#include "cpplib.h"
+
+void
+sparc_target_macros (void)
+{
+ builtin_define_std ("sparc");
+
+ if (TARGET_64BIT)
+ {
+ cpp_assert (parse_in, "cpu=sparc64");
+ cpp_assert (parse_in, "machine=sparc64");
+ }
+ else
+ {
+ cpp_assert (parse_in, "cpu=sparc");
+ cpp_assert (parse_in, "machine=sparc");
+ }
+
+ if (TARGET_VIS)
+ {
+ cpp_define (parse_in, "__VIS__=0x100");
+ cpp_define (parse_in, "__VIS=0x100");
+ }
+}
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index a5e2587..dfa461a 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -47,6 +47,7 @@ extern int short_branch (int, int);
extern void sparc_profile_hook (int);
extern void sparc_override_options (void);
extern void sparc_output_scratch_registers (FILE *);
+extern void sparc_target_macros (void);
#ifdef RTX_CODE
extern enum machine_mode select_cc_mode (enum rtx_code, rtx, rtx);
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index ad1e0ef..cccd4446 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -105,25 +105,7 @@ struct processor_costs {
extern const struct processor_costs *sparc_costs;
-/* Target CPU builtins. FIXME: Defining sparc is for the benefit of
- Solaris only; otherwise just define __sparc__. Sadly the headers
- are such a mess there is no Solaris-specific header. */
-#define TARGET_CPU_CPP_BUILTINS() \
- do \
- { \
- builtin_define_std ("sparc"); \
- if (TARGET_64BIT) \
- { \
- builtin_assert ("cpu=sparc64"); \
- builtin_assert ("machine=sparc64"); \
- } \
- else \
- { \
- builtin_assert ("cpu=sparc"); \
- builtin_assert ("machine=sparc"); \
- } \
- } \
- while (0)
+#define TARGET_CPU_CPP_BUILTINS() sparc_target_macros ()
/* Specify this in a cover file to provide bi-architecture (32/64) support. */
/* #define SPARC_BI_ARCH */
diff --git a/gcc/config/sparc/t-sparc b/gcc/config/sparc/t-sparc
new file mode 100644
index 0000000..ea9d0e8
--- /dev/null
+++ b/gcc/config/sparc/t-sparc
@@ -0,0 +1,36 @@
+# General rules that all sparc/ targets must have.
+#
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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/>.
+
+sparc.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TREE_H) $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h \
+ insn-codes.h conditions.h output.h $(INSN_ATTR_H) $(FLAGS_H) \
+ $(FUNCTION_H) $(EXCEPT_H) $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
+ $(DIAGNOSTIC_CORE_H) $(GGC_H) $(TM_P_H) debug.h $(TARGET_H) \
+ $(TARGET_DEF_H) $(COMMON_TARGET_H) $(CFGLAYOUT_H) $(GIMPLE_H) \
+ langhooks.h reload.h $(PARAMS_H) $(DF_H) dwarf2out.h $(OPTS_H) \
+ gt-sparc.h
+
+sparc-c.o: $(srcdir)/config/sparc/sparc-c.c \
+ $(srcdir)/config/sparc/sparc-protos.h \
+ $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) $(FLAGS_H) \
+ $(TM_P_H) coretypes.h $(TM_H) $(TREE_H) \
+ $(C_COMMON_H) $(C_PRAGMA_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(srcdir)/config/sparc/sparc-c.c