Commit cabbe12a by Joseph Myers Committed by Joseph Myers

s390-opts.h: New.

	* config/s390/s390-opts.h: New.
	* config/s390/s390.c (s390_tune, s390_tune_flags, s390_arch,
	s390_arch_flags, s390_warn_framesize, s390_stack_size,
	s390_stack_guard): Remove.
	(s390_handle_arch_option): Return void.  Take enum
	s390_arch_option value instead of string and searching array.
	(s390_handle_option): Don't assert that global structures are in
	use.  Access variables via opts pointer.  Use error_at.  Don't use
	sscanf for -mstack-guard= or -mstack-size=.  Update call to
	s390_handle_arch_option.
	(s390_option_override): Update call to s390_handle_arch_option.
	(s390_emit_prologue): Use %d format for s390_stack_size in
	diagnostic.  Use %wd for HOST_WIDE_INT.
	* config/s390/s390.h (enum processor_type): Move to s390-opts.h.
	(s390_tune, s390_tune_flags, s390_arch, s390_arch_flags): Remove.
	* config/s390/s390.opt (config/s390/s390-opts.h): New
	HeaderInclude entry.
	(s390_arch_string, s390_tune, s390_tune_flags, s390_arch,
	s390_arch_flags, s390_warn_framesize): New Variable entries.
	(s390_arch_option): New Enum and EnumValue entries.
	(march=): Use Enum instead of Var.
	(mstack-guard=, mstack-size=): Use UInteger and Var.
	(mtune=): Use Enum.

From-SVN: r171330
parent 05b12036
2011-03-22 Joseph Myers <joseph@codesourcery.com> 2011-03-22 Joseph Myers <joseph@codesourcery.com>
* config/s390/s390-opts.h: New.
* config/s390/s390.c (s390_tune, s390_tune_flags, s390_arch,
s390_arch_flags, s390_warn_framesize, s390_stack_size,
s390_stack_guard): Remove.
(s390_handle_arch_option): Return void. Take enum
s390_arch_option value instead of string and searching array.
(s390_handle_option): Don't assert that global structures are in
use. Access variables via opts pointer. Use error_at. Don't use
sscanf for -mstack-guard= or -mstack-size=. Update call to
s390_handle_arch_option.
(s390_option_override): Update call to s390_handle_arch_option.
(s390_emit_prologue): Use %d format for s390_stack_size in
diagnostic. Use %wd for HOST_WIDE_INT.
* config/s390/s390.h (enum processor_type): Move to s390-opts.h.
(s390_tune, s390_tune_flags, s390_arch, s390_arch_flags): Remove.
* config/s390/s390.opt (config/s390/s390-opts.h): New
HeaderInclude entry.
(s390_arch_string, s390_tune, s390_tune_flags, s390_arch,
s390_arch_flags, s390_warn_framesize): New Variable entries.
(s390_arch_option): New Enum and EnumValue entries.
(march=): Use Enum instead of Var.
(mstack-guard=, mstack-size=): Use UInteger and Var.
(mtune=): Use Enum.
2011-03-22 Joseph Myers <joseph@codesourcery.com>
* config/score/score.c (score_handle_option): Don't assert that * config/score/score.c (score_handle_option): Don't assert that
global structures are in use. Access target_flags via opts global structures are in use. Access target_flags via opts
pointer. Use value of -march= option to determine target_flags pointer. Use value of -march= option to determine target_flags
......
/* Definitions for option handling for IBM S/390.
Copyright (C) 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 S390_OPTS_H
#define S390_OPTS_H
/* Which processor to generate code or schedule for. The cpu attribute
defines a list that mirrors this list, so changes to s390.md must be
made at the same time. */
enum processor_type
{
PROCESSOR_9672_G5,
PROCESSOR_9672_G6,
PROCESSOR_2064_Z900,
PROCESSOR_2084_Z990,
PROCESSOR_2094_Z9_109,
PROCESSOR_2097_Z10,
PROCESSOR_2817_Z196,
PROCESSOR_max
};
/* This enumeration must match processor_alias_table in
s390_handle_arch_option. It is different from enum processor_type
because some processors differ for option handling but not for
scheduling. */
enum s390_arch_option
{
s390_arch_g5,
s390_arch_g6,
s390_arch_z900,
s390_arch_z990,
s390_arch_z9_109,
s390_arch_z9_ec,
s390_arch_z10,
s390_arch_z196
};
#endif
...@@ -278,17 +278,6 @@ struct s390_address ...@@ -278,17 +278,6 @@ struct s390_address
bool literal_pool; bool literal_pool;
}; };
/* Which cpu are we tuning for. */
enum processor_type s390_tune = PROCESSOR_max;
int s390_tune_flags;
/* Which instruction set architecture to use. */
enum processor_type s390_arch;
int s390_arch_flags;
HOST_WIDE_INT s390_warn_framesize = 0;
HOST_WIDE_INT s390_stack_size = 0;
HOST_WIDE_INT s390_stack_guard = 0;
/* The following structure is embedded in the machine /* The following structure is embedded in the machine
specific part of struct function. */ specific part of struct function. */
...@@ -1541,88 +1530,81 @@ s390_option_init_struct (struct gcc_options *opts) ...@@ -1541,88 +1530,81 @@ s390_option_init_struct (struct gcc_options *opts)
opts->x_flag_asynchronous_unwind_tables = 1; opts->x_flag_asynchronous_unwind_tables = 1;
} }
/* Return true if ARG is the name of a processor. Set *TYPE and *FLAGS /* Set *TYPE and *FLAGS to the associated processor_type and
to the associated processor_type and processor_flags if so. */ processor_flags for processor ARCH. */
static bool static void
s390_handle_arch_option (const char *arg, s390_handle_arch_option (enum s390_arch_option arch,
enum processor_type *type, enum processor_type *type,
int *flags) int *flags)
{ {
/* This must match enum s390_arch_option in s390-opts.h. */
static struct pta static struct pta
{ {
const char *const name; /* processor name or nickname. */
const enum processor_type processor; const enum processor_type processor;
const int flags; /* From enum processor_flags. */ const int flags; /* From enum processor_flags. */
} }
const processor_alias_table[] = const processor_alias_table[] =
{ {
{"g5", PROCESSOR_9672_G5, PF_IEEE_FLOAT}, {PROCESSOR_9672_G5, PF_IEEE_FLOAT},
{"g6", PROCESSOR_9672_G6, PF_IEEE_FLOAT}, {PROCESSOR_9672_G6, PF_IEEE_FLOAT},
{"z900", PROCESSOR_2064_Z900, PF_IEEE_FLOAT | PF_ZARCH}, {PROCESSOR_2064_Z900, PF_IEEE_FLOAT | PF_ZARCH},
{"z990", PROCESSOR_2084_Z990, PF_IEEE_FLOAT | PF_ZARCH {PROCESSOR_2084_Z990, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT}, | PF_LONG_DISPLACEMENT},
{"z9-109", PROCESSOR_2094_Z9_109, PF_IEEE_FLOAT | PF_ZARCH {PROCESSOR_2094_Z9_109, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT | PF_EXTIMM}, | PF_LONG_DISPLACEMENT | PF_EXTIMM},
{"z9-ec", PROCESSOR_2094_Z9_109, PF_IEEE_FLOAT | PF_ZARCH {PROCESSOR_2094_Z9_109, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP }, | PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP },
{"z10", PROCESSOR_2097_Z10, PF_IEEE_FLOAT | PF_ZARCH {PROCESSOR_2097_Z10, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP | PF_Z10}, | PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP | PF_Z10},
{"z196", PROCESSOR_2817_Z196, PF_IEEE_FLOAT | PF_ZARCH {PROCESSOR_2817_Z196, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 }, | PF_LONG_DISPLACEMENT | PF_EXTIMM | PF_DFP | PF_Z10 | PF_Z196 },
}; };
size_t i;
for (i = 0; i < ARRAY_SIZE (processor_alias_table); i++)
if (strcmp (arg, processor_alias_table[i].name) == 0)
{
*type = processor_alias_table[i].processor;
*flags = processor_alias_table[i].flags;
return true;
}
*type = PROCESSOR_max; *type = processor_alias_table[(int) arch].processor;
*flags = 0; *flags = processor_alias_table[(int) arch].flags;
return false;
} }
/* Implement TARGET_HANDLE_OPTION. */ /* Implement TARGET_HANDLE_OPTION. */
static bool static bool
s390_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, s390_handle_option (struct gcc_options *opts,
struct gcc_options *opts_set ATTRIBUTE_UNUSED,
const struct cl_decoded_option *decoded, const struct cl_decoded_option *decoded,
location_t loc ATTRIBUTE_UNUSED) location_t loc)
{ {
size_t code = decoded->opt_index; size_t code = decoded->opt_index;
const char *arg = decoded->arg; const char *arg = decoded->arg;
int value = decoded->value;
gcc_assert (opts == &global_options);
gcc_assert (opts_set == &global_options_set);
switch (code) switch (code)
{ {
case OPT_march_: case OPT_march_:
return s390_handle_arch_option (arg, &s390_arch, &s390_arch_flags); s390_handle_arch_option ((enum s390_arch_option) value,
&opts->x_s390_arch,
&opts->x_s390_arch_flags);
opts->x_s390_arch_string = arg;
return true;
case OPT_mstack_guard_: case OPT_mstack_guard_:
if (sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_stack_guard) != 1) if (exact_log2 (value) == -1)
return false; error_at (loc, "stack guard value must be an exact power of 2");
if (exact_log2 (s390_stack_guard) == -1)
error ("stack guard value must be an exact power of 2");
return true; return true;
case OPT_mstack_size_: case OPT_mstack_size_:
if (sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_stack_size) != 1) if (exact_log2 (value) == -1)
return false; error_at (loc, "stack size must be an exact power of 2");
if (exact_log2 (s390_stack_size) == -1)
error ("stack size must be an exact power of 2");
return true; return true;
case OPT_mtune_: case OPT_mtune_:
return s390_handle_arch_option (arg, &s390_tune, &s390_tune_flags); s390_handle_arch_option ((enum s390_arch_option) value,
&opts->x_s390_tune,
&opts->x_s390_tune_flags);
return true;
case OPT_mwarn_framesize_: case OPT_mwarn_framesize_:
return sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_warn_framesize) == 1; return sscanf (arg, HOST_WIDE_INT_PRINT_DEC,
&opts->x_s390_warn_framesize) == 1;
default: default:
return true; return true;
...@@ -1648,7 +1630,8 @@ s390_option_override (void) ...@@ -1648,7 +1630,8 @@ s390_option_override (void)
if (!s390_arch_string) if (!s390_arch_string)
{ {
s390_arch_string = TARGET_ZARCH? "z900" : "g5"; s390_arch_string = TARGET_ZARCH? "z900" : "g5";
s390_handle_arch_option (s390_arch_string, &s390_arch, &s390_arch_flags); s390_handle_arch_option ((TARGET_ZARCH ? s390_arch_z900 : s390_arch_g5),
&s390_arch, &s390_arch_flags);
} }
/* This check is triggered when the user specified a wrong -march= /* This check is triggered when the user specified a wrong -march=
...@@ -8162,10 +8145,9 @@ s390_emit_prologue (void) ...@@ -8162,10 +8145,9 @@ s390_emit_prologue (void)
if (cfun_frame_layout.frame_size >= s390_stack_size) if (cfun_frame_layout.frame_size >= s390_stack_size)
{ {
warning (0, "frame size of function %qs is " warning (0, "frame size of function %qs is %wd"
HOST_WIDE_INT_PRINT_DEC
" bytes exceeding user provided stack limit of " " bytes exceeding user provided stack limit of "
HOST_WIDE_INT_PRINT_DEC " bytes. " "%d bytes. "
"An unconditional trap is added.", "An unconditional trap is added.",
current_function_name(), cfun_frame_layout.frame_size, current_function_name(), cfun_frame_layout.frame_size,
s390_stack_size); s390_stack_size);
......
...@@ -24,22 +24,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -24,22 +24,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef _S390_H #ifndef _S390_H
#define _S390_H #define _S390_H
/* Which processor to generate code or schedule for. The cpu attribute
defines a list that mirrors this list, so changes to s390.md must be
made at the same time. */
enum processor_type
{
PROCESSOR_9672_G5,
PROCESSOR_9672_G6,
PROCESSOR_2064_Z900,
PROCESSOR_2084_Z990,
PROCESSOR_2094_Z9_109,
PROCESSOR_2097_Z10,
PROCESSOR_2817_Z196,
PROCESSOR_max
};
/* Optional architectural facilities supported by the processor. */ /* Optional architectural facilities supported by the processor. */
enum processor_flags enum processor_flags
...@@ -53,16 +37,10 @@ enum processor_flags ...@@ -53,16 +37,10 @@ enum processor_flags
PF_Z196 = 64 PF_Z196 = 64
}; };
extern enum processor_type s390_tune;
extern int s390_tune_flags;
/* This is necessary to avoid a warning about comparing different enum /* This is necessary to avoid a warning about comparing different enum
types. */ types. */
#define s390_tune_attr ((enum attr_cpu)s390_tune) #define s390_tune_attr ((enum attr_cpu)s390_tune)
extern enum processor_type s390_arch;
extern int s390_arch_flags;
/* These flags indicate that the generated code should run on a cpu /* These flags indicate that the generated code should run on a cpu
providing the respective hardware facility regardless of the providing the respective hardware facility regardless of the
current cpu mode (ESA or z/Architecture). */ current cpu mode (ESA or z/Architecture). */
......
; Options for the S/390 / zSeries port of the compiler. ; Options for the S/390 / zSeries port of the compiler.
; Copyright (C) 2005, 2006, 2007, 2010 Free Software Foundation, Inc. ; Copyright (C) 2005, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
; ;
; This file is part of GCC. ; This file is part of GCC.
; ;
...@@ -18,6 +18,30 @@ ...@@ -18,6 +18,30 @@
; along with GCC; see the file COPYING3. If not see ; along with GCC; see the file COPYING3. If not see
; <http://www.gnu.org/licenses/>. ; <http://www.gnu.org/licenses/>.
HeaderInclude
config/s390/s390-opts.h
; The architecture name to use in diagnostics.
Variable
const char *s390_arch_string
; Which cpu are we tuning for.
Variable
enum processor_type s390_tune = PROCESSOR_max
Variable
int s390_tune_flags
; Which instruction set architecture to use.
Variable
enum processor_type s390_arch
Variable
int s390_arch_flags
Variable
HOST_WIDE_INT s390_warn_framesize = 0
m31 m31
Target Report RejectNegative Negative(m64) InverseMask(64BIT) Target Report RejectNegative Negative(m64) InverseMask(64BIT)
31 bit ABI 31 bit ABI
...@@ -27,9 +51,36 @@ Target Report RejectNegative Negative(m31) Mask(64BIT) ...@@ -27,9 +51,36 @@ Target Report RejectNegative Negative(m31) Mask(64BIT)
64 bit ABI 64 bit ABI
march= march=
Target RejectNegative Joined Var(s390_arch_string) Target RejectNegative Joined Enum(s390_arch_option)
Generate code for given CPU Generate code for given CPU
Enum
Name(s390_arch_option) Type(enum s390_arch_option)
EnumValue
Enum(s390_arch_option) String(g5) Value(s390_arch_g5)
EnumValue
Enum(s390_arch_option) String(g6) Value(s390_arch_g6)
EnumValue
Enum(s390_arch_option) String(z900) Value(s390_arch_z900)
EnumValue
Enum(s390_arch_option) String(z990) Value(s390_arch_z990)
EnumValue
Enum(s390_arch_option) String(z9-109) Value(s390_arch_z9_109)
EnumValue
Enum(s390_arch_option) String(z9-ec) Value(s390_arch_z9_ec)
EnumValue
Enum(s390_arch_option) String(z10) Value(s390_arch_z10)
EnumValue
Enum(s390_arch_option) String(z196) Value(s390_arch_z196)
mbackchain mbackchain
Target Report Mask(BACKCHAIN) Target Report Mask(BACKCHAIN)
Maintain backchain pointer Maintain backchain pointer
...@@ -71,15 +122,15 @@ Target Report RejectNegative Negative(mhard-float) Mask(SOFT_FLOAT) ...@@ -71,15 +122,15 @@ Target Report RejectNegative Negative(mhard-float) Mask(SOFT_FLOAT)
Disable hardware floating point Disable hardware floating point
mstack-guard= mstack-guard=
Target RejectNegative Joined Target RejectNegative Joined UInteger Var(s390_stack_guard)
Set the max. number of bytes which has to be left to stack size before a trap instruction is triggered Set the max. number of bytes which has to be left to stack size before a trap instruction is triggered
mstack-size= mstack-size=
Target RejectNegative Joined Target RejectNegative Joined UInteger Var(s390_stack_size)
Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit
mtune= mtune=
Target RejectNegative Joined Target RejectNegative Joined Enum(s390_arch_option)
Schedule code for given CPU Schedule code for given CPU
mmvcle mmvcle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment