diff options
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/config/m68k/m68k-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.c | 24 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.h | 34 | ||||
-rw-r--r-- | gcc/doc/invoke.texi | 19 |
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 |