Commit f5db779b by Richard Sandiford Committed by Richard Sandiford

* config/s390/s390.h (s390_tune_string, s390_arch_string)

	(s390_warn_framesize_string, s390_warn_dynamicstack_string)
	(s390_stack_size_string, s390_stack_guard_string, target_flags)
	(MASK_HARD_FLOAT, MASK_SMALL_EXEC, MASK_DEBUG_ARG, MASK_64BIT)
	(MASK_ZARCH, MASK_MVCLE, MASK_TPF_PROFILING, MASK_NO_FUSED_MADD)
	(MASK_BACKCHAIN, MASK_PACKED_STACK, TARGET_HARD_FLOAT)
	(TARGET_SOFT_FLOAT, TARGET_SMALL_EXEC, TARGET_DEBUG_ARG)
	(TARGET_64BIT, TARGET_ZARCH, TARGET_MVCLE, TARGET_TPF_PROFILING)
	(TARGET_NO_FUSED_MADD, TARGET_FUSED_MADD, TARGET_BACKCHAIN)
	(TARGET_PACKED_STACK, TARGET_SWITCHES, TARGET_OPTIONS): Delete.
	* config/s390/s390.c (TARGET_DEFAULT_TARGET_FLAGS): Override default.
	(TARGET_HANDLE_OPTION): Likewise.
	(s390_tune): Initialize to PROCESSOR_max.
	(s390_arch_string): Make static.
	(s390_tune_string, s390_warn_framesize_string): Delete.
	(s390_warn_dynamicstack_string, s390_stack_size_string): Delete.
	(s390_stack_guard_string, s390_warn_dynamicstack_p): Delete.
	(s390_handle_arch_option, s390_handle_option): New functions.
	(override_options): Remove parsing of option strings.
	* config/s390/s390.opt: New file.

From-SVN: r97968
parent 84971f01
2005-04-11 Richard Sandiford <rsandifo@redhat.com>
* config/s390/s390.h (s390_tune_string, s390_arch_string)
(s390_warn_framesize_string, s390_warn_dynamicstack_string)
(s390_stack_size_string, s390_stack_guard_string, target_flags)
(MASK_HARD_FLOAT, MASK_SMALL_EXEC, MASK_DEBUG_ARG, MASK_64BIT)
(MASK_ZARCH, MASK_MVCLE, MASK_TPF_PROFILING, MASK_NO_FUSED_MADD)
(MASK_BACKCHAIN, MASK_PACKED_STACK, TARGET_HARD_FLOAT)
(TARGET_SOFT_FLOAT, TARGET_SMALL_EXEC, TARGET_DEBUG_ARG)
(TARGET_64BIT, TARGET_ZARCH, TARGET_MVCLE, TARGET_TPF_PROFILING)
(TARGET_NO_FUSED_MADD, TARGET_FUSED_MADD, TARGET_BACKCHAIN)
(TARGET_PACKED_STACK, TARGET_SWITCHES, TARGET_OPTIONS): Delete.
* config/s390/s390.c (TARGET_DEFAULT_TARGET_FLAGS): Override default.
(TARGET_HANDLE_OPTION): Likewise.
(s390_tune): Initialize to PROCESSOR_max.
(s390_arch_string): Make static.
(s390_tune_string, s390_warn_framesize_string): Delete.
(s390_warn_dynamicstack_string, s390_stack_size_string): Delete.
(s390_stack_guard_string, s390_warn_dynamicstack_p): Delete.
(s390_handle_arch_option, s390_handle_option): New functions.
(override_options): Remove parsing of option strings.
* config/s390/s390.opt: New file.
2005-04-11 Paolo Bonzini <bonzini@gnu.org> 2005-04-11 Paolo Bonzini <bonzini@gnu.org>
* tree-complex.c (expand_vector_operations): Call * tree-complex.c (expand_vector_operations): Call
......
...@@ -54,6 +54,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -54,6 +54,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static bool s390_assemble_integer (rtx, unsigned int, int); static bool s390_assemble_integer (rtx, unsigned int, int);
static bool s390_handle_option (size_t, const char *, int);
static void s390_encode_section_info (tree, rtx, int); static void s390_encode_section_info (tree, rtx, int);
static bool s390_cannot_force_const_mem (rtx); static bool s390_cannot_force_const_mem (rtx);
static rtx s390_delegitimize_address (rtx); static rtx s390_delegitimize_address (rtx);
...@@ -197,6 +198,11 @@ struct processor_costs z990_cost = ...@@ -197,6 +198,11 @@ struct processor_costs z990_cost =
#undef TARGET_ASM_CLOSE_PAREN #undef TARGET_ASM_CLOSE_PAREN
#define TARGET_ASM_CLOSE_PAREN "" #define TARGET_ASM_CLOSE_PAREN ""
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_FUSED_MADD)
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION s390_handle_option
#undef TARGET_ENCODE_SECTION_INFO #undef TARGET_ENCODE_SECTION_INFO
#define TARGET_ENCODE_SECTION_INFO s390_encode_section_info #define TARGET_ENCODE_SECTION_INFO s390_encode_section_info
...@@ -293,23 +299,14 @@ struct s390_address ...@@ -293,23 +299,14 @@ struct s390_address
}; };
/* Which cpu are we tuning for. */ /* Which cpu are we tuning for. */
enum processor_type s390_tune; enum processor_type s390_tune = PROCESSOR_max;
enum processor_flags s390_tune_flags; enum processor_flags s390_tune_flags;
/* Which instruction set architecture to use. */ /* Which instruction set architecture to use. */
enum processor_type s390_arch; enum processor_type s390_arch;
enum processor_flags s390_arch_flags; enum processor_flags s390_arch_flags;
static const char *s390_arch_string;
/* Strings to hold which cpu and instruction set architecture to use. */
const char *s390_tune_string; /* for -mtune=<xxx> */
const char *s390_arch_string; /* for -march=<xxx> */
const char *s390_warn_framesize_string;
const char *s390_warn_dynamicstack_string;
const char *s390_stack_size_string;
const char *s390_stack_guard_string;
HOST_WIDE_INT s390_warn_framesize = 0; HOST_WIDE_INT s390_warn_framesize = 0;
bool s390_warn_dynamicstack_p = 0;
HOST_WIDE_INT s390_stack_size = 0; HOST_WIDE_INT s390_stack_size = 0;
HOST_WIDE_INT s390_stack_guard = 0; HOST_WIDE_INT s390_stack_guard = 0;
...@@ -1244,10 +1241,14 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED) ...@@ -1244,10 +1241,14 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
flag_asynchronous_unwind_tables = 1; flag_asynchronous_unwind_tables = 1;
} }
void /* Return true if ARG is the name of a processor. Set *TYPE and *FLAGS
override_options (void) to the associated processor_type and processor_flags if so. */
static bool
s390_handle_arch_option (const char *arg,
enum processor_type *type,
enum processor_flags *flags)
{ {
int i;
static struct pta static struct pta
{ {
const char *const name; /* processor name or nickname. */ const char *const name; /* processor name or nickname. */
...@@ -1262,9 +1263,57 @@ override_options (void) ...@@ -1262,9 +1263,57 @@ override_options (void)
{"z990", PROCESSOR_2084_Z990, PF_IEEE_FLOAT | PF_ZARCH {"z990", PROCESSOR_2084_Z990, PF_IEEE_FLOAT | PF_ZARCH
| PF_LONG_DISPLACEMENT}, | PF_LONG_DISPLACEMENT},
}; };
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;
}
return false;
}
/* Implement TARGET_HANDLE_OPTION. */
static bool
s390_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
{
switch (code)
{
case OPT_march_:
s390_arch_string = arg;
return s390_handle_arch_option (arg, &s390_arch, &s390_arch_flags);
case OPT_mstack_guard_:
if (sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_stack_guard) != 1)
return false;
if (exact_log2 (s390_stack_guard) == -1)
error ("stack guard value must be an exact power of 2");
return true;
case OPT_mstack_size_:
if (sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_stack_size) != 1)
return false;
if (exact_log2 (s390_stack_size) == -1)
error ("stack size must be an exact power of 2");
return true;
int const pta_size = ARRAY_SIZE (processor_alias_table); case OPT_mtune_:
return s390_handle_arch_option (arg, &s390_tune, &s390_tune_flags);
case OPT_mwarn_framesize_:
return sscanf (arg, HOST_WIDE_INT_PRINT_DEC, &s390_warn_framesize) == 1;
default:
return true;
}
}
void
override_options (void)
{
/* Acquire a unique set number for our register saves and restores. */ /* Acquire a unique set number for our register saves and restores. */
s390_sr_alias_set = new_alias_set (); s390_sr_alias_set = new_alias_set ();
...@@ -1282,36 +1331,16 @@ override_options (void) ...@@ -1282,36 +1331,16 @@ override_options (void)
/* Determine processor architectural level. */ /* Determine processor architectural level. */
if (!s390_arch_string) if (!s390_arch_string)
s390_arch_string = TARGET_ZARCH? "z900" : "g5"; {
s390_arch_string = TARGET_ZARCH? "z900" : "g5";
for (i = 0; i < pta_size; i++) s390_handle_arch_option (s390_arch_string, &s390_arch, &s390_arch_flags);
if (! strcmp (s390_arch_string, processor_alias_table[i].name)) }
{
s390_arch = processor_alias_table[i].processor;
s390_arch_flags = processor_alias_table[i].flags;
break;
}
if (i == pta_size)
error ("Unknown cpu used in -march=%s.", s390_arch_string);
/* Determine processor to tune for. */ /* Determine processor to tune for. */
if (!s390_tune_string) if (s390_tune == PROCESSOR_max)
{ {
s390_tune = s390_arch; s390_tune = s390_arch;
s390_tune_flags = s390_arch_flags; s390_tune_flags = s390_arch_flags;
s390_tune_string = s390_arch_string;
}
else
{
for (i = 0; i < pta_size; i++)
if (! strcmp (s390_tune_string, processor_alias_table[i].name))
{
s390_tune = processor_alias_table[i].processor;
s390_tune_flags = processor_alias_table[i].flags;
break;
}
if (i == pta_size)
error ("Unknown cpu used in -mtune=%s.", s390_tune_string);
} }
/* Sanity checks. */ /* Sanity checks. */
...@@ -1332,42 +1361,14 @@ override_options (void) ...@@ -1332,42 +1361,14 @@ override_options (void)
error ("-mbackchain -mpacked-stack -mhard-float are not supported " error ("-mbackchain -mpacked-stack -mhard-float are not supported "
"in combination."); "in combination.");
if (s390_warn_framesize_string) if (s390_stack_size)
{
if (sscanf (s390_warn_framesize_string, HOST_WIDE_INT_PRINT_DEC,
&s390_warn_framesize) != 1)
error ("invalid value for -mwarn-framesize");
}
if (s390_warn_dynamicstack_string)
s390_warn_dynamicstack_p = 1;
if (s390_stack_size_string)
{ {
if (sscanf (s390_stack_size_string, HOST_WIDE_INT_PRINT_DEC, if (!s390_stack_guard)
&s390_stack_size) != 1)
error ("invalid value for -mstack-size");
if (exact_log2 (s390_stack_size) == -1)
error ("stack size must be an exact power of 2");
if (s390_stack_guard_string)
{
if (sscanf (s390_stack_guard_string, HOST_WIDE_INT_PRINT_DEC,
&s390_stack_guard) != 1)
error ("invalid value for -mstack-guard");
if (s390_stack_guard >= s390_stack_size)
error ("stack size must be greater than the stack guard value");
if (exact_log2 (s390_stack_guard) == -1)
error ("stack guard value must be an exact power of 2");
}
else
error ("-mstack-size implies use of -mstack-guard"); error ("-mstack-size implies use of -mstack-guard");
else if (s390_stack_guard >= s390_stack_size)
error ("stack size must be greater than the stack guard value");
} }
else if (s390_stack_guard)
if (s390_stack_guard_string && !s390_stack_size_string)
error ("-mstack-guard implies use of -mstack-size"); error ("-mstack-guard implies use of -mstack-size");
} }
......
...@@ -54,16 +54,9 @@ enum processor_flags ...@@ -54,16 +54,9 @@ enum processor_flags
extern enum processor_type s390_tune; extern enum processor_type s390_tune;
extern enum processor_flags s390_tune_flags; extern enum processor_flags s390_tune_flags;
extern const char *s390_tune_string;
extern enum processor_type s390_arch; extern enum processor_type s390_arch;
extern enum processor_flags s390_arch_flags; extern enum processor_flags s390_arch_flags;
extern const char *s390_arch_string;
extern const char *s390_warn_framesize_string;
extern const char *s390_warn_dynamicstack_string;
extern const char *s390_stack_size_string;
extern const char *s390_stack_guard_string;
#define TARGET_CPU_IEEE_FLOAT \ #define TARGET_CPU_IEEE_FLOAT \
(s390_arch_flags & PF_IEEE_FLOAT) (s390_arch_flags & PF_IEEE_FLOAT)
...@@ -93,33 +86,6 @@ extern const char *s390_stack_guard_string; ...@@ -93,33 +86,6 @@ extern const char *s390_stack_guard_string;
} \ } \
while (0) while (0)
/* Optional target features. */
extern int target_flags;
#define MASK_HARD_FLOAT 0x01
#define MASK_SMALL_EXEC 0x04
#define MASK_DEBUG_ARG 0x08
#define MASK_64BIT 0x10
#define MASK_ZARCH 0x20
#define MASK_MVCLE 0x40
#define MASK_TPF_PROFILING 0x80
#define MASK_NO_FUSED_MADD 0x100
#define MASK_BACKCHAIN 0x200
#define MASK_PACKED_STACK 0x400
#define TARGET_HARD_FLOAT (target_flags & MASK_HARD_FLOAT)
#define TARGET_SOFT_FLOAT (!(target_flags & MASK_HARD_FLOAT))
#define TARGET_SMALL_EXEC (target_flags & MASK_SMALL_EXEC)
#define TARGET_DEBUG_ARG (target_flags & MASK_DEBUG_ARG)
#define TARGET_64BIT (target_flags & MASK_64BIT)
#define TARGET_ZARCH (target_flags & MASK_ZARCH)
#define TARGET_MVCLE (target_flags & MASK_MVCLE)
#define TARGET_TPF_PROFILING (target_flags & MASK_TPF_PROFILING)
#define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
#define TARGET_FUSED_MADD (! TARGET_NO_FUSED_MADD)
#define TARGET_BACKCHAIN (target_flags & MASK_BACKCHAIN)
#define TARGET_PACKED_STACK (target_flags & MASK_PACKED_STACK)
/* ??? Once this actually works, it could be made a runtime option. */ /* ??? Once this actually works, it could be made a runtime option. */
#define TARGET_IBM_FLOAT 0 #define TARGET_IBM_FLOAT 0
#define TARGET_IEEE_FLOAT 1 #define TARGET_IEEE_FLOAT 1
...@@ -130,48 +96,6 @@ extern int target_flags; ...@@ -130,48 +96,6 @@ extern int target_flags;
#define TARGET_DEFAULT MASK_HARD_FLOAT #define TARGET_DEFAULT MASK_HARD_FLOAT
#endif #endif
#define TARGET_SWITCHES \
{ { "hard-float", 1, N_("Use hardware fp")}, \
{ "soft-float", -1, N_("Don't use hardware fp")}, \
{ "small-exec", 4, N_("Use bras for executable < 64k")}, \
{ "no-small-exec", -4, N_("Don't use bras")}, \
{ "debug", 8, N_("Additional debug prints")}, \
{ "no-debug", -8, N_("Don't print additional debug prints")}, \
{ "64", 16, N_("64 bit ABI")}, \
{ "31", -16, N_("31 bit ABI")}, \
{ "zarch", 32, N_("z/Architecture")}, \
{ "esa", -32, N_("ESA/390 architecture")}, \
{ "mvcle", 64, N_("mvcle use")}, \
{ "no-mvcle", -64, N_("mvc&ex")}, \
{ "tpf-trace", 128, N_("Enable tpf OS tracing code")}, \
{ "no-tpf-trace", -128, N_("Disable tpf OS tracing code")}, \
{ "no-fused-madd", 256, N_("Disable fused multiply/add instructions")},\
{ "fused-madd", -256, N_("Enable fused multiply/add instructions")}, \
{ "backchain", 512, N_("Maintain backchain pointer")}, \
{ "no-backchain", -512, N_("Don't maintain backchain pointer")}, \
{ "packed-stack", 1024, N_("Use packed stack layout")}, \
{ "no-packed-stack", -1024, N_("Don't use packed stack layout")}, \
{ "", TARGET_DEFAULT, 0 } }
#define TARGET_OPTIONS \
{ { "tune=", &s390_tune_string, \
N_("Schedule code for given CPU"), 0}, \
{ "arch=", &s390_arch_string, \
N_("Generate code for given CPU"), 0}, \
{ "warn-framesize=", &s390_warn_framesize_string, \
N_("Warn if a single function's framesize exceeds the given framesize"), \
0}, \
{ "warn-dynamicstack", &s390_warn_dynamicstack_string, \
N_("Warn if a function uses alloca or creates an array with dynamic size"),\
0}, \
{ "stack-size=", &s390_stack_size_string, \
N_("Emit extra code in the function prologue in order to trap if the stack"\
"size exceeds the given limit"), 0}, \
{ "stack-guard=", &s390_stack_guard_string, \
N_("Set the max. number of bytes which has to be left to stack size " \
"before a trap instruction is triggered"), 0}, \
}
/* Support for configure-time defaults. */ /* Support for configure-time defaults. */
#define OPTION_DEFAULT_SPECS \ #define OPTION_DEFAULT_SPECS \
{ "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \ { "mode", "%{!mesa:%{!mzarch:-m%(VALUE)}}" }, \
......
; Options for the S/390 / zSeries port of the compiler.
; Copyright (C) 2005 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 2, 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 COPYING. If not, write to the Free
; Software Foundation, 59 Temple Place - Suite 330, Boston, MA
; 02111-1307, USA.
m31
Target Report RejectNegative InverseMask(64BIT)
31 bit ABI
m64
Target Report RejectNegative Mask(64BIT)
64 bit ABI
march=
Target RejectNegative Joined
Generate code for given CPU
mbackchain
Target Report Mask(BACKCHAIN)
Maintain backchain pointer
mdebug
Target Report Mask(DEBUG_ARG)
Additional debug prints
mesa
Target Report RejectNegative InverseMask(ZARCH)
ESA/390 architecture
mfused-madd
Target Report Mask(FUSED_MADD)
Enable fused multiply/add instructions
mhard-float
Target Report RejectNegative Mask(HARD_FLOAT)
Use hardware fp
mpacked-stack
Target Report Mask(PACKED_STACK)
Use packed stack layout
msmall-exec
Target Report Mask(SMALL_EXEC)
Use bras for executable < 64k
msoft-float
Target Report RejectNegative InverseMask(HARD_FLOAT, SOFT_FLOAT)
Don't use hardware fp
mstack-guard=
Target RejectNegative Joined
Set the max. number of bytes which has to be left to stack size before a trap instruction is triggered
mstack-size=
Target RejectNegative Joined
Emit extra code in the function prologue in order to trap if the stack size exceeds the given limit
mtpf-trace
Target Report Mask(TPF_PROFILING)
Enable tpf OS tracing code
mtune=
Target RejectNegative Joined
Schedule code for given CPU
mvcle
Target Report Mask(MVCLE)
mvcle use
mwarn-dynamicstack
Target RejectNegative Var(s390_warn_dynamicstack_p)
Warn if a function uses alloca or creates an array with dynamic size
mwarn-framesize=
Target RejectNegative Joined
Warn if a single function's framesize exceeds the given framesize
mzarch
Target Report RejectNegative Mask(ZARCH)
z/Architecture
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