* 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
+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
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 */
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;
+ }
+}
\f
/* Insert any deferred function attributes from earlier pragmas. */
static void
#define SUBTARGET_OVERRIDE_OPTIONS (void) 0
+extern const char *sh_fixed_range_str;
+
#define OVERRIDE_OPTIONS \
do { \
int regno; \
if (align_functions < min_align) \
align_functions = min_align; \
} \
+ \
+ if (sh_fixed_range_str) \
+ sh_fix_range (sh_fixed_range_str); \
} while (0)
\f
/* Target machine storage layout. */
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
-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}
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.