summaryrefslogtreecommitdiff
path: root/gcc/config/m32r
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-22 22:39:54 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-22 22:39:54 +0000
commite3d1b41b783afc3d2444883b3460b666416a9ec9 (patch)
treed20d6a85fe62458ab93ac7e82137cd4f7f90cb4a /gcc/config/m32r
parenteea6e787a8ad8139edc71b3d6ec1b439386d62d5 (diff)
downloadgcc-e3d1b41b783afc3d2444883b3460b666416a9ec9.tar.gz
* config/m32r/m32r-opts.h: New.
* config/m32r/m32r.c (m32r_model, m32r_sdata): Remove. (m32r_handle_option): Don't assert that global structures are in use. Access target_flags and m32r_cache_flush_func via opts pointer. Don't handle OPT_mmodel_, OPT_msdata_ or OPT_mno_flush_trap here. * config/m32r/m32r.h (Code Models, Small Data Area): Replace by include of m32r-opts.h. * config/m32r/m32r.opt (config/m32r/m32r-opts.h): New HeaderInclude entry. (m32r_model_selected, m32r_sdata_selected): New Variable entries. (mmodel=): Use Enum and Var. (m32r_model): New Enum and EnumValue entries. (mno-flush-trap): Use Var. (msdata=): Use Enum and Var. (m32r_sdata): New Enum and EnumValue entries. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/m32r')
-rw-r--r--gcc/config/m32r/m32r-opts.h109
-rw-r--r--gcc/config/m32r/m32r.c43
-rw-r--r--gcc/config/m32r/m32r.h87
-rw-r--r--gcc/config/m32r/m32r.opt43
4 files changed, 154 insertions, 128 deletions
diff --git a/gcc/config/m32r/m32r-opts.h b/gcc/config/m32r/m32r-opts.h
new file mode 100644
index 00000000000..f8dc2289896
--- /dev/null
+++ b/gcc/config/m32r/m32r-opts.h
@@ -0,0 +1,109 @@
+/* Definitions for option handling for Renesas M32R cpu.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+ 2005, 2006, 2007, 2008, 2009, 2010, 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/>. */
+
+#ifndef M32R_OPTS_H
+#define M32R_OPTS_H
+
+/* Code Models
+
+ Code models are used to select between two choices of two separate
+ possibilities (address space size, call insn to use):
+
+ small: addresses use 24 bits, use bl to make calls
+ medium: addresses use 32 bits, use bl to make calls (*1)
+ large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
+
+ The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
+ using this one doesn't make much sense.
+
+ (*1) The linker may eventually be able to relax seth/add3 -> ld24.
+ (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
+
+ Internally these are recorded as TARGET_ADDR{24,32} and
+ TARGET_CALL{26,32}.
+
+ The __model__ attribute can be used to select the code model to use when
+ accessing particular objects. */
+
+enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
+
+#define TARGET_MODEL_SMALL (m32r_model_selected == M32R_MODEL_SMALL)
+#define TARGET_MODEL_MEDIUM (m32r_model_selected == M32R_MODEL_MEDIUM)
+#define TARGET_MODEL_LARGE (m32r_model_selected == M32R_MODEL_LARGE)
+#define TARGET_ADDR24 (m32r_model_selected == M32R_MODEL_SMALL)
+#define TARGET_ADDR32 (! TARGET_ADDR24)
+#define TARGET_CALL26 (! TARGET_CALL32)
+#define TARGET_CALL32 (m32r_model_selected == M32R_MODEL_LARGE)
+
+/* The default is the small model. */
+#ifndef M32R_MODEL_DEFAULT
+#define M32R_MODEL_DEFAULT M32R_MODEL_SMALL
+#endif
+
+/* Small Data Area
+
+ The SDA consists of sections .sdata, .sbss, and .scommon.
+ .scommon isn't a real section, symbols in it have their section index
+ set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
+
+ Two switches control the SDA:
+
+ -G NNN - specifies the maximum size of variable to go in the SDA
+
+ -msdata=foo - specifies how such variables are handled
+
+ -msdata=none - small data area is disabled
+
+ -msdata=sdata - small data goes in the SDA, special code isn't
+ generated to use it, and special relocs aren't
+ generated
+
+ -msdata=use - small data goes in the SDA, special code is generated
+ to use the SDA and special relocs are generated
+
+ The SDA is not multilib'd, it isn't necessary.
+ MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
+ libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
+ -msdata=use will successfully link with them (references in header files
+ will cause the compiler to emit code that refers to library objects in
+ .data). ??? There can be a problem if the user passes a -G value greater
+ than the default and a library object in a header file is that size.
+ The default is 8 so this should be rare - if it occurs the user
+ is required to rebuild the libraries or use a smaller value for -G. */
+
+/* Maximum size of variables that go in .sdata/.sbss.
+ The -msdata=foo switch also controls how small variables are handled. */
+#ifndef SDATA_DEFAULT_SIZE
+#define SDATA_DEFAULT_SIZE 8
+#endif
+
+enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
+
+#define TARGET_SDATA_NONE (m32r_sdata_selected == M32R_SDATA_NONE)
+#define TARGET_SDATA_SDATA (m32r_sdata_selected == M32R_SDATA_SDATA)
+#define TARGET_SDATA_USE (m32r_sdata_selected == M32R_SDATA_USE)
+
+/* Default is to disable the SDA
+ [for upward compatibility with previous toolchains]. */
+#ifndef M32R_SDATA_DEFAULT
+#define M32R_SDATA_DEFAULT M32R_SDATA_NONE
+#endif
+
+#endif
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 648afb97538..86af3b3a8c9 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -47,12 +47,6 @@
/* Array of valid operand punctuation characters. */
static char m32r_punct_chars[256];
-/* Selected code model. */
-enum m32r_model m32r_model = M32R_MODEL_DEFAULT;
-
-/* Selected SDA support. */
-enum m32r_sdata m32r_sdata = M32R_SDATA_DEFAULT;
-
/* Machine-specific symbol_ref flags. */
#define SYMBOL_FLAG_MODEL_SHIFT SYMBOL_FLAG_MACH_DEP_SHIFT
#define SYMBOL_REF_MODEL(X) \
@@ -225,56 +219,27 @@ struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
static bool
-m32r_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
+m32r_handle_option (struct gcc_options *opts,
+ struct gcc_options *opts_set ATTRIBUTE_UNUSED,
const struct cl_decoded_option *decoded,
location_t loc ATTRIBUTE_UNUSED)
{
size_t code = decoded->opt_index;
- const char *arg = decoded->arg;
int value = decoded->value;
- gcc_assert (opts == &global_options);
- gcc_assert (opts_set == &global_options_set);
-
switch (code)
{
case OPT_m32r:
- target_flags &= ~(MASK_M32R2 | MASK_M32RX);
- return true;
-
- case OPT_mmodel_:
- if (strcmp (arg, "small") == 0)
- m32r_model = M32R_MODEL_SMALL;
- else if (strcmp (arg, "medium") == 0)
- m32r_model = M32R_MODEL_MEDIUM;
- else if (strcmp (arg, "large") == 0)
- m32r_model = M32R_MODEL_LARGE;
- else
- return false;
- return true;
-
- case OPT_msdata_:
- if (strcmp (arg, "none") == 0)
- m32r_sdata = M32R_SDATA_NONE;
- else if (strcmp (arg, "sdata") == 0)
- m32r_sdata = M32R_SDATA_SDATA;
- else if (strcmp (arg, "use") == 0)
- m32r_sdata = M32R_SDATA_USE;
- else
- return false;
+ opts->x_target_flags &= ~(MASK_M32R2 | MASK_M32RX);
return true;
case OPT_mno_flush_func:
- m32r_cache_flush_func = NULL;
+ opts->x_m32r_cache_flush_func = NULL;
return true;
case OPT_mflush_trap_:
return value <= 15;
- case OPT_mno_flush_trap:
- m32r_cache_flush_trap = -1;
- return true;
-
default:
return true;
}
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index ef24ec1090c..a43e2956c94 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -194,91 +194,8 @@
#define TARGET_CPU_DEFAULT 0
#endif
-/* Code Models
-
- Code models are used to select between two choices of two separate
- possibilities (address space size, call insn to use):
-
- small: addresses use 24 bits, use bl to make calls
- medium: addresses use 32 bits, use bl to make calls (*1)
- large: addresses use 32 bits, use seth/add3/jl to make calls (*2)
-
- The fourth is "addresses use 24 bits, use seth/add3/jl to make calls" but
- using this one doesn't make much sense.
-
- (*1) The linker may eventually be able to relax seth/add3 -> ld24.
- (*2) The linker may eventually be able to relax seth/add3/jl -> bl.
-
- Internally these are recorded as TARGET_ADDR{24,32} and
- TARGET_CALL{26,32}.
-
- The __model__ attribute can be used to select the code model to use when
- accessing particular objects. */
-
-enum m32r_model { M32R_MODEL_SMALL, M32R_MODEL_MEDIUM, M32R_MODEL_LARGE };
-
-extern enum m32r_model m32r_model;
-#define TARGET_MODEL_SMALL (m32r_model == M32R_MODEL_SMALL)
-#define TARGET_MODEL_MEDIUM (m32r_model == M32R_MODEL_MEDIUM)
-#define TARGET_MODEL_LARGE (m32r_model == M32R_MODEL_LARGE)
-#define TARGET_ADDR24 (m32r_model == M32R_MODEL_SMALL)
-#define TARGET_ADDR32 (! TARGET_ADDR24)
-#define TARGET_CALL26 (! TARGET_CALL32)
-#define TARGET_CALL32 (m32r_model == M32R_MODEL_LARGE)
-
-/* The default is the small model. */
-#ifndef M32R_MODEL_DEFAULT
-#define M32R_MODEL_DEFAULT M32R_MODEL_SMALL
-#endif
-
-/* Small Data Area
-
- The SDA consists of sections .sdata, .sbss, and .scommon.
- .scommon isn't a real section, symbols in it have their section index
- set to SHN_M32R_SCOMMON, though support for it exists in the linker script.
-
- Two switches control the SDA:
-
- -G NNN - specifies the maximum size of variable to go in the SDA
-
- -msdata=foo - specifies how such variables are handled
-
- -msdata=none - small data area is disabled
-
- -msdata=sdata - small data goes in the SDA, special code isn't
- generated to use it, and special relocs aren't
- generated
-
- -msdata=use - small data goes in the SDA, special code is generated
- to use the SDA and special relocs are generated
-
- The SDA is not multilib'd, it isn't necessary.
- MULTILIB_EXTRA_OPTS is set in tmake_file to -msdata=sdata so multilib'd
- libraries have small data in .sdata/SHN_M32R_SCOMMON so programs that use
- -msdata=use will successfully link with them (references in header files
- will cause the compiler to emit code that refers to library objects in
- .data). ??? There can be a problem if the user passes a -G value greater
- than the default and a library object in a header file is that size.
- The default is 8 so this should be rare - if it occurs the user
- is required to rebuild the libraries or use a smaller value for -G. */
-
-/* Maximum size of variables that go in .sdata/.sbss.
- The -msdata=foo switch also controls how small variables are handled. */
-#ifndef SDATA_DEFAULT_SIZE
-#define SDATA_DEFAULT_SIZE 8
-#endif
-
-enum m32r_sdata { M32R_SDATA_NONE, M32R_SDATA_SDATA, M32R_SDATA_USE };
-
-extern enum m32r_sdata m32r_sdata;
-#define TARGET_SDATA_NONE (m32r_sdata == M32R_SDATA_NONE)
-#define TARGET_SDATA_SDATA (m32r_sdata == M32R_SDATA_SDATA)
-#define TARGET_SDATA_USE (m32r_sdata == M32R_SDATA_USE)
-
-/* Default is to disable the SDA
- [for upward compatibility with previous toolchains]. */
-#ifndef M32R_SDATA_DEFAULT
-#define M32R_SDATA_DEFAULT M32R_SDATA_NONE
+#ifndef M32R_OPTS_H
+#include "config/m32r/m32r-opts.h"
#endif
/* Define this macro as a C expression for the initializer of an array of
diff --git a/gcc/config/m32r/m32r.opt b/gcc/config/m32r/m32r.opt
index a1aa9666861..2f266c29b86 100644
--- a/gcc/config/m32r/m32r.opt
+++ b/gcc/config/m32r/m32r.opt
@@ -1,6 +1,6 @@
; Options for the Renesas M32R port of the compiler.
-; Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+; Copyright (C) 2005, 2007, 2011 Free Software Foundation, Inc.
;
; This file is part of GCC.
;
@@ -18,6 +18,17 @@
; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>.
+HeaderInclude
+config/m32r/m32r-opts.h
+
+; Selected code model.
+Variable
+enum m32r_model m32r_model_selected = M32R_MODEL_DEFAULT
+
+; Selected SDA support.
+Variable
+enum m32r_sdata m32r_sdata_selected = M32R_SDATA_DEFAULT
+
m32rx
Target Report RejectNegative Mask(M32RX)
Compile for the m32rx
@@ -63,20 +74,44 @@ Target Report RejectNegative InverseMask(LOW_ISSUE_RATE)
Allow two instructions to be issued per cycle
mmodel=
-Target RejectNegative Joined
+Target RejectNegative Joined Enum(m32r_model) Var(m32r_model_selected)
Code size: small, medium or large
+Enum
+Name(m32r_model) Type(enum m32r_model)
+
+EnumValue
+Enum(m32r_model) String(small) Value(M32R_MODEL_SMALL)
+
+EnumValue
+Enum(m32r_model) String(medium) Value(M32R_MODEL_MEDIUM)
+
+EnumValue
+Enum(m32r_model) String(large) Value(M32R_MODEL_LARGE)
+
mno-flush-func
Target RejectNegative
Don't call any cache flush functions
mno-flush-trap
-Target RejectNegative
+Target RejectNegative Var(m32r_cache_flush_trap, -1)
Don't call any cache flush trap
; mrelax
; Target Mask(RELAX)
msdata=
-Target RejectNegative Joined
+Target RejectNegative Joined Enum(m32r_sdata) Var(m32r_sdata_selected)
Small data area: none, sdata, use
+
+Enum
+Name(m32r_sdata) Type(enum m32r_sdata)
+
+EnumValue
+Enum(m32r_sdata) String(none) Value(M32R_SDATA_NONE)
+
+EnumValue
+Enum(m32r_sdata) String(sdata) Value(M32R_SDATA_SDATA)
+
+EnumValue
+Enum(m32r_sdata) String(use) Value(M32R_SDATA_USE)