summaryrefslogtreecommitdiff
path: root/gcc/config/mn10300
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mn10300')
-rw-r--r--gcc/config/mn10300/mn10300-protos.h2
-rw-r--r--gcc/config/mn10300/mn10300.c65
-rw-r--r--gcc/config/mn10300/mn10300.h4
-rw-r--r--gcc/config/mn10300/mn10300.md2
4 files changed, 42 insertions, 31 deletions
diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h
index fe0452b8825..b6760e8e407 100644
--- a/gcc/config/mn10300/mn10300-protos.h
+++ b/gcc/config/mn10300/mn10300-protos.h
@@ -25,7 +25,7 @@ extern int mn10300_legitimate_pic_operand_p (rtx);
extern rtx mn10300_legitimize_reload_address (rtx, enum machine_mode,
int, int, int);
extern bool mn10300_function_value_regno_p (const unsigned int);
-extern int mn10300_get_live_callee_saved_regs (void);
+extern unsigned int mn10300_get_live_callee_saved_regs (unsigned int *);
extern bool mn10300_hard_regno_mode_ok (unsigned int, enum machine_mode);
extern bool mn10300_modes_tieable (enum machine_mode, enum machine_mode);
extern const char *mn10300_output_add (rtx[3], bool);
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 5b9f0699469..769e883f01b 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -46,6 +46,7 @@
#include "df.h"
#include "opts.h"
#include "cfgloop.h"
+#include "dumpfile.h"
/* This is used in the am33_2.0-linux-gnu port, in which global symbol
names are not prefixed by underscores, to tell whether to prefix a
@@ -56,18 +57,6 @@ int mn10300_protect_label;
/* Selected processor type for tuning. */
enum processor_type mn10300_tune_cpu = PROCESSOR_DEFAULT;
-/* The size of the callee register save area. Right now we save everything
- on entry since it costs us nothing in code size. It does cost us from a
- speed standpoint, so we want to optimize this sooner or later. */
-#define REG_SAVE_BYTES (4 * df_regs_ever_live_p (2) \
- + 4 * df_regs_ever_live_p (3) \
- + 4 * df_regs_ever_live_p (6) \
- + 4 * df_regs_ever_live_p (7) \
- + 16 * (df_regs_ever_live_p (14) \
- || df_regs_ever_live_p (15) \
- || df_regs_ever_live_p (16) \
- || df_regs_ever_live_p (17)))
-
#define CC_FLAG_Z 1
#define CC_FLAG_N 2
#define CC_FLAG_C 4
@@ -634,20 +623,35 @@ mn10300_can_use_rets_insn (void)
/* Returns the set of live, callee-saved registers as a bitmask. The
callee-saved extended registers cannot be stored individually, so
- all of them will be included in the mask if any one of them is used. */
+ Also returns the number of bytes in the registers in the mask if
+ BYTES_SAVED is not NULL. */
-int
-mn10300_get_live_callee_saved_regs (void)
+unsigned int
+mn10300_get_live_callee_saved_regs (unsigned int * bytes_saved)
{
int mask;
int i;
+ unsigned int count;
- mask = 0;
+ count = mask = 0;
for (i = 0; i <= LAST_EXTENDED_REGNUM; i++)
if (df_regs_ever_live_p (i) && ! call_really_used_regs[i])
- mask |= (1 << i);
+ {
+ mask |= (1 << i);
+ ++ count;
+ }
+
if ((mask & 0x3c000) != 0)
- mask |= 0x3c000;
+ {
+ for (i = 0x04000; i < 0x40000; i <<= 1)
+ if ((mask & i) == 0)
+ ++ count;
+
+ mask |= 0x3c000;
+ }
+
+ if (bytes_saved)
+ * bytes_saved = count * UNITS_PER_WORD;
return mask;
}
@@ -740,8 +744,11 @@ mn10300_expand_prologue (void)
{
HOST_WIDE_INT size = mn10300_frame_size ();
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = size;
+
/* If we use any of the callee-saved registers, save them now. */
- mn10300_gen_multiple_store (mn10300_get_live_callee_saved_regs ());
+ mn10300_gen_multiple_store (mn10300_get_live_callee_saved_regs (NULL));
if (TARGET_AM33_2 && fp_regs_to_save ())
{
@@ -998,8 +1005,10 @@ void
mn10300_expand_epilogue (void)
{
HOST_WIDE_INT size = mn10300_frame_size ();
- int reg_save_bytes = REG_SAVE_BYTES;
-
+ unsigned int reg_save_bytes;
+
+ mn10300_get_live_callee_saved_regs (& reg_save_bytes);
+
if (TARGET_AM33_2 && fp_regs_to_save ())
{
int num_regs_to_save = fp_regs_to_save (), i;
@@ -1219,7 +1228,7 @@ mn10300_expand_epilogue (void)
if (mn10300_can_use_rets_insn ())
emit_jump_insn (ret_rtx);
else
- emit_jump_insn (gen_return_ret (GEN_INT (size + REG_SAVE_BYTES)));
+ emit_jump_insn (gen_return_ret (GEN_INT (size + reg_save_bytes)));
}
/* Recognize the PARALLEL rtx generated by mn10300_gen_multiple_store().
@@ -1434,7 +1443,10 @@ mn10300_initial_offset (int from, int to)
is the size of the callee register save area. */
if (from == ARG_POINTER_REGNUM)
{
- diff += REG_SAVE_BYTES;
+ unsigned int reg_save_bytes;
+
+ mn10300_get_live_callee_saved_regs (& reg_save_bytes);
+ diff += reg_save_bytes;
diff += 4 * fp_regs_to_save ();
}
@@ -2468,12 +2480,15 @@ mn10300_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
may access it using GOTOFF instead of GOT. */
static void
-mn10300_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
+mn10300_encode_section_info (tree decl, rtx rtl, int first)
{
rtx symbol;
+ default_encode_section_info (decl, rtl, first);
+
if (! MEM_P (rtl))
return;
+
symbol = XEXP (rtl, 0);
if (GET_CODE (symbol) != SYMBOL_REF)
return;
@@ -3175,7 +3190,7 @@ mn10300_insert_setlb_lcc (rtx label, rtx branch)
}
static bool
-mn10300_block_contains_call (struct basic_block_def * block)
+mn10300_block_contains_call (basic_block block)
{
rtx insn;
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 79b20f5a4d8..eb4f2f9f42f 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -703,10 +703,6 @@ do { \
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-/* This flag, if defined, says the same insns that convert to a signed fixnum
- also convert validly to an unsigned one. */
-#define FIXUNS_TRUNC_LIKE_FIX_TRUNC
-
/* Max number of bytes we can move from memory to memory
in one reasonably fast instruction. */
#define MOVE_MAX 4
diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md
index a1cbc7a9fd4..ee92b68a535 100644
--- a/gcc/config/mn10300/mn10300.md
+++ b/gcc/config/mn10300/mn10300.md
@@ -2048,7 +2048,7 @@
{
/* The RETF insn is up to 3 cycles faster than RET. */
fputs ((mn10300_can_use_retf_insn () ? "\tretf " : "\tret "), asm_out_file);
- mn10300_print_reg_list (asm_out_file, mn10300_get_live_callee_saved_regs ());
+ mn10300_print_reg_list (asm_out_file, mn10300_get_live_callee_saved_regs (NULL));
fprintf (asm_out_file, ",%d\n", (int) INTVAL (operands[0]));
return "";
})