Commit 3217af3e by Kaz Kojima

sh.opt (mfixed-range): New option.

	* config/sh/sh.opt (mfixed-range): New option.
	* config/sh/sh-protos.h (sh_fix_range): Declare.
	* config/sh/sh.c (sh_fix_range): New function.
	* config/sh/sh.h (sh_fixed_range_str): Declare.
	(OVERRIDE_OPTIONS): Call sh_fix_range if sh_fixed_range_str
	is not empty.
	* doc/invoke.texi (SH Options): Document -mfixed-range.

From-SVN: r135779
parent 143350a8
2008-05-22 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.opt (mfixed-range): New option.
* config/sh/sh-protos.h (sh_fix_range): Declare.
* config/sh/sh.c (sh_fix_range): New function.
* config/sh/sh.h (sh_fixed_range_str): Declare.
(OVERRIDE_OPTIONS): Call sh_fix_range if sh_fixed_range_str
is not empty.
* doc/invoke.texi (SH Options): Document -mfixed-range.
2008-05-22 Kai Tietz <kai.tietz@onevision.com> 2008-05-22 Kai Tietz <kai.tietz@onevision.com>
* config/i386/sol2-10.h (SUBTARGET_RETURN_IN_MEMORY): Undefine * config/i386/sol2-10.h (SUBTARGET_RETURN_IN_MEMORY): Undefine
......
...@@ -173,6 +173,7 @@ extern enum reg_class sh_secondary_reload (bool, rtx, enum reg_class, ...@@ -173,6 +173,7 @@ extern enum reg_class sh_secondary_reload (bool, rtx, enum reg_class,
struct secondary_reload_info *); struct secondary_reload_info *);
extern int sh2a_get_function_vector_number (rtx); extern int sh2a_get_function_vector_number (rtx);
extern int sh2a_is_function_vector_call (rtx); extern int sh2a_is_function_vector_call (rtx);
extern void sh_fix_range (const char *);
#endif /* ! GCC_SH_PROTOS_H */ #endif /* ! GCC_SH_PROTOS_H */
......
...@@ -7973,6 +7973,68 @@ initial_elimination_offset (int from, int to) ...@@ -7973,6 +7973,68 @@ initial_elimination_offset (int from, int to)
else else
return total_auto_space; return total_auto_space;
} }
/* Parse the -mfixed-range= option string. */
void
sh_fix_range (const char *const_str)
{
int i, first, last;
char *str, *dash, *comma;
/* str must be of the form REG1'-'REG2{,REG1'-'REG} where REG1 and
REG2 are either register names or register numbers. The effect
of this option is to mark the registers in the range from REG1 to
REG2 as ``fixed'' so they won't be used by the compiler. */
i = strlen (const_str);
str = (char *) alloca (i + 1);
memcpy (str, const_str, i + 1);
while (1)
{
dash = strchr (str, '-');
if (!dash)
{
warning (0, "value of -mfixed-range must have form REG1-REG2");
return;
}
*dash = '\0';
comma = strchr (dash + 1, ',');
if (comma)
*comma = '\0';
first = decode_reg_name (str);
if (first < 0)
{
warning (0, "unknown register name: %s", str);
return;
}
last = decode_reg_name (dash + 1);
if (last < 0)
{
warning (0, "unknown register name: %s", dash + 1);
return;
}
*dash = '-';
if (first > last)
{
warning (0, "%s-%s is an empty range", str, dash + 1);
return;
}
for (i = first; i <= last; ++i)
fixed_regs[i] = call_used_regs[i] = 1;
if (!comma)
break;
*comma = ',';
str = comma + 1;
}
}
/* Insert any deferred function attributes from earlier pragmas. */ /* Insert any deferred function attributes from earlier pragmas. */
static void static void
......
...@@ -533,6 +533,8 @@ extern enum sh_divide_strategy_e sh_div_strategy; ...@@ -533,6 +533,8 @@ extern enum sh_divide_strategy_e sh_div_strategy;
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0 #define SUBTARGET_OVERRIDE_OPTIONS (void) 0
extern const char *sh_fixed_range_str;
#define OVERRIDE_OPTIONS \ #define OVERRIDE_OPTIONS \
do { \ do { \
int regno; \ int regno; \
...@@ -754,6 +756,9 @@ do { \ ...@@ -754,6 +756,9 @@ do { \
if (align_functions < min_align) \ if (align_functions < min_align) \
align_functions = min_align; \ align_functions = min_align; \
} \ } \
\
if (sh_fixed_range_str) \
sh_fix_range (sh_fixed_range_str); \
} while (0) } while (0)
/* Target machine storage layout. */ /* Target machine storage layout. */
......
...@@ -248,6 +248,10 @@ mdivsi3_libfunc= ...@@ -248,6 +248,10 @@ mdivsi3_libfunc=
Target RejectNegative Joined Var(sh_divsi3_libfunc) Init("") Target RejectNegative Joined Var(sh_divsi3_libfunc) Init("")
Specify name for 32 bit signed division function Specify name for 32 bit signed division function
mfixed-range=
Target RejectNegative Joined Var(sh_fixed_range_str)
Specify range of registers to make fixed
mfmovd mfmovd
Target RejectNegative Mask(FMOVD) Undocumented Target RejectNegative Mask(FMOVD) Undocumented
......
...@@ -748,7 +748,7 @@ See RS/6000 and PowerPC Options. ...@@ -748,7 +748,7 @@ See RS/6000 and PowerPC Options.
-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
-mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
-mdivsi3_libfunc=@var{name} @gol -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
-minvalid-symbols} -minvalid-symbols}
...@@ -14090,6 +14090,14 @@ Set the name of the library function used for 32 bit signed division to ...@@ -14090,6 +14090,14 @@ Set the name of the library function used for 32 bit signed division to
division strategies, and the compiler will still expect the same division strategies, and the compiler will still expect the same
sets of input/output/clobbered registers as if this option was not present. sets of input/output/clobbered registers as if this option was not present.
@item -mfixed-range=@var{register-range}
@opindex mfixed-range
Generate code treating the given register range as fixed registers.
A fixed register is one that the register allocator can not use. This is
useful when compiling kernel code. A register range is specified as
two registers separated by a dash. Multiple register ranges can be
specified separated by a comma.
@item -madjust-unroll @item -madjust-unroll
@opindex madjust-unroll @opindex madjust-unroll
Throttle unrolling to avoid thrashing target registers. Throttle unrolling to avoid thrashing target registers.
......
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