summaryrefslogtreecommitdiff
path: root/gcc/config/mn10300/mn10300.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mn10300/mn10300.c')
-rw-r--r--gcc/config/mn10300/mn10300.c65
1 files changed, 40 insertions, 25 deletions
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;