aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-01-12 09:36:17 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2007-01-12 09:36:17 +0000
commit7eb4f04449cc0be1bdf6a1ec976dcefaedf97c88 (patch)
treea1ef587399345760032a197d445988bb648f2901 /gcc
parent9321405c4a8792d7e8faf39b369e5a76436c63df (diff)
downloadgcc-7eb4f04449cc0be1bdf6a1ec976dcefaedf97c88.zip
gcc-7eb4f04449cc0be1bdf6a1ec976dcefaedf97c88.tar.gz
gcc-7eb4f04449cc0be1bdf6a1ec976dcefaedf97c88.tar.bz2
200x-xx-xx Nathan Sidwell <nathan@codesourcery.com> Richard Sandiford <richard@codesourcery.com>
gcc/ 200x-xx-xx Nathan Sidwell <nathan@codesourcery.com> Richard Sandiford <richard@codesourcery.com> * doc/invoke.texi: Document the macros that are defined by m68k's -mtune and -mhard-float options. * config/m68k/m68k-protos.h (m68k_cpp_cpu_ident) Declare. (m68k_cpp_cpu_family): Likewise. * config/m68k/m68k.h (TARGET_CPU_CPP_BUILTINS): Add a full set of __ucfv*__ macros. Define __mcffpu__ if generating code for ColdFire FPUs. Define __mcf_cpu_* and __mcf_family_* macros. * config/m68k/m68k.c (m68k_cpp_cpu_ident): New function. (m68k_cpp_cpu_family): Likewise. Co-Authored-By: Richard Sandiford <richard@codesourcery.com> From-SVN: r120716
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/m68k/m68k-protos.h2
-rw-r--r--gcc/config/m68k/m68k.c24
-rw-r--r--gcc/config/m68k/m68k.h34
-rw-r--r--gcc/doc/invoke.texi19
5 files changed, 89 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 910bfb9..837f085 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2007-01-12 Nathan Sidwell <nathan@codesourcery.com>
+ Richard Sandiford <richard@codesourcery.com>
+
+ * doc/invoke.texi: Document the macros that are defined by
+ m68k's -mtune and -mhard-float options.
+ * config/m68k/m68k-protos.h (m68k_cpp_cpu_ident) Declare.
+ (m68k_cpp_cpu_family): Likewise.
+ * config/m68k/m68k.h (TARGET_CPU_CPP_BUILTINS): Add a full set
+ of __ucfv*__ macros. Define __mcffpu__ if generating code for
+ ColdFire FPUs. Define __mcf_cpu_* and __mcf_family_* macros.
+ * config/m68k/m68k.c (m68k_cpp_cpu_ident): New function.
+ (m68k_cpp_cpu_family): Likewise.
+
2007-01-12 Richard Sandiford <richard@codesourcery.com>
* config/m68k/m68k.h (TARGET_CPU_CPP_BUILTINS): Treat all mc68*
diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h
index 531c695..75f6f25 100644
--- a/gcc/config/m68k/m68k-protos.h
+++ b/gcc/config/m68k/m68k-protos.h
@@ -61,5 +61,7 @@ extern bool m68k_regno_mode_ok (int, enum machine_mode);
extern int flags_in_68881 (void);
extern bool use_return_insn (void);
extern void override_options (void);
+extern const char *m68k_cpp_cpu_ident (const char *);
+extern const char *m68k_cpp_cpu_family (const char *);
extern void init_68881_table (void);
extern int m68k_hard_regno_rename_ok(unsigned int, unsigned int);
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 2941757..edf8a7e 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -540,6 +540,30 @@ override_options (void)
SUBTARGET_OVERRIDE_OPTIONS;
}
+
+/* Generate a macro of the form __mPREFIX_cpu_NAME, where PREFIX is the
+ given argument and NAME is the argument passed to -mcpu. Return NULL
+ if -mcpu was not passed. */
+
+const char *
+m68k_cpp_cpu_ident (const char *prefix)
+{
+ if (!m68k_cpu_entry)
+ return NULL;
+ return concat ("__m", prefix, "_cpu_", m68k_cpu_entry->name, NULL);
+}
+
+/* Generate a macro of the form __mPREFIX_family_NAME, where PREFIX is the
+ given argument and NAME is the name of the representative device for
+ the -mcpu argument's family. Return NULL if -mcpu was not passed. */
+
+const char *
+m68k_cpp_cpu_family (const char *prefix)
+{
+ if (!m68k_cpu_entry)
+ return NULL;
+ return concat ("__m", prefix, "_family_", m68k_cpu_entry->family, NULL);
+}
/* Return nonzero if FUNC is an interrupt function as specified by the
"interrupt_handler" attribute. */
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 030dc4d..17105b5 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -107,6 +107,26 @@ Boston, MA 02110-1301, USA. */
builtin_define_std ("mc68020"); \
break; \
\
+ case ucfv2: \
+ builtin_define ("__mcfv2__"); \
+ break; \
+ \
+ case ucfv3: \
+ builtin_define ("__mcfv3__"); \
+ break; \
+ \
+ case ucfv4: \
+ builtin_define ("__mcfv4__"); \
+ break; \
+ \
+ case ucfv4e: \
+ builtin_define ("__mcfv4e__"); \
+ break; \
+ \
+ case ucfv5: \
+ builtin_define ("__mcfv5__"); \
+ break; \
+ \
default: \
break; \
} \
@@ -116,7 +136,16 @@ Boston, MA 02110-1301, USA. */
\
if (TARGET_COLDFIRE) \
{ \
+ const char *tmp; \
+ \
+ tmp = m68k_cpp_cpu_ident ("cf"); \
+ if (tmp) \
+ builtin_define (tmp); \
+ tmp = m68k_cpp_cpu_family ("cf"); \
+ if (tmp) \
+ builtin_define (tmp); \
builtin_define ("__mcoldfire__"); \
+ \
if (TARGET_ISAC) \
builtin_define ("__mcfisac__"); \
else if (TARGET_ISAB) \
@@ -152,10 +181,11 @@ Boston, MA 02110-1301, USA. */
break; \
} \
} \
- if (m68k_tune == ucfv4e) \
- builtin_define ("__mcfv4e__"); \
} \
\
+ if (TARGET_COLDFIRE_FPU) \
+ builtin_define ("__mcffpu__"); \
+ \
if (TARGET_CF_HWDIV) \
builtin_define ("__mcfhwdiv__"); \
\
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 145c322..a3b9c90 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -10328,6 +10328,10 @@ below, which also classifies the CPUs into families:
@var{arch} is compatible with @var{cpu}. Other combinations of
@option{-mcpu} and @option{-march} are rejected.
+gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
+@var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
+where the value of @var{family} is given by the table above.
+
@item -mtune=@var{tune}
@opindex mtune
Tune the code for a particular microarchitecture, within the
@@ -10343,6 +10347,17 @@ to run relatively well on 68020, 68030 and 68040 targets.
as well. These two options select the same tuning decisions as
@option{-m68020-40} and @option{-m68020-60} respectively.
+gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
+when tuning for 680x0 architecture @var{arch}. It also defines
+@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
+option is used. If gcc is tuning for a range of architectures,
+as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
+it defines the macros for every architecture in the range.
+
+gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
+ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
+of the arguments given above.
+
@item -m68000
@itemx -mc68000
@opindex m68000
@@ -10465,7 +10480,9 @@ The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
@opindex mhard-float
@opindex m68881
Generate floating-point instructions. This is the default for 68020
-and above, and for ColdFire devices that have an FPU.
+and above, and for ColdFire devices that have an FPU. It defines the
+macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
+on ColdFire targets.
@item -msoft-float
@opindex msoft-float