aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2008-05-22 22:23:54 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2008-05-22 22:23:54 +0000
commit3217af3e616fde3ebfc47747327885439ffc8724 (patch)
treeb2c226e9b1e83787ed86c0958d4b5d6a57d413a1 /gcc
parent143350a8e2a65c8604f2fc5d36e04cf838bf280a (diff)
downloadgcc-3217af3e616fde3ebfc47747327885439ffc8724.zip
gcc-3217af3e616fde3ebfc47747327885439ffc8724.tar.gz
gcc-3217af3e616fde3ebfc47747327885439ffc8724.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/sh/sh-protos.h1
-rw-r--r--gcc/config/sh/sh.c62
-rw-r--r--gcc/config/sh/sh.h5
-rw-r--r--gcc/config/sh/sh.opt4
-rw-r--r--gcc/doc/invoke.texi10
6 files changed, 91 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 68a0406..116fb96 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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>
* config/i386/sol2-10.h (SUBTARGET_RETURN_IN_MEMORY): Undefine
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index 9e1a488..a03c624 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -173,6 +173,7 @@ extern enum reg_class sh_secondary_reload (bool, rtx, enum reg_class,
struct secondary_reload_info *);
extern int sh2a_get_function_vector_number (rtx);
extern int sh2a_is_function_vector_call (rtx);
+extern void sh_fix_range (const char *);
#endif /* ! GCC_SH_PROTOS_H */
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index a41783d..3af0ee8 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -7973,6 +7973,68 @@ initial_elimination_offset (int from, int to)
else
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. */
static void
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 67a6e39..2ff4a81 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -533,6 +533,8 @@ extern enum sh_divide_strategy_e sh_div_strategy;
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
+extern const char *sh_fixed_range_str;
+
#define OVERRIDE_OPTIONS \
do { \
int regno; \
@@ -754,6 +756,9 @@ do { \
if (align_functions < min_align) \
align_functions = min_align; \
} \
+ \
+ if (sh_fixed_range_str) \
+ sh_fix_range (sh_fixed_range_str); \
} while (0)
/* Target machine storage layout. */
diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt
index b62530f..145e2d5 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -248,6 +248,10 @@ mdivsi3_libfunc=
Target RejectNegative Joined Var(sh_divsi3_libfunc) Init("")
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
Target RejectNegative Mask(FMOVD) Undocumented
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 842755d..061311f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -748,7 +748,7 @@ See RS/6000 and PowerPC Options.
-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
-mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @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
-minvalid-symbols}
@@ -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
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
@opindex madjust-unroll
Throttle unrolling to avoid thrashing target registers.