From 037176b69ce4cdcb68aaab0bf66c679bcb489dd3 Mon Sep 17 00:00:00 2001 From: amylaar Date: Fri, 26 Nov 2010 17:38:20 +0000 Subject: [PATCH] PR target/46623 * config/microblaze/microblaze.c (microblaze_block_move_straight): Use XALLOCAVEC. (microblaze_option_override): Don't use C++ style comments. (save_restore_insns): Remove unused variable base_offset. (microblaze_expand_prologue): Remove unused variable insn. (microblaze_secondary_reload): Adjust type to match target.h . (microblaze_elf_in_small_data_p): Move declarations to start of block. (microblaze_expand_move): Likewise. * config/microblaze/microblaze.h (LARGE_INT): Avoid signed / unsigned comparisons. (ASM_OUTPUT_ALIGNED_COMMON, ASM_OUTPUT_ALIGNED_LOCAL): Likewise. (ASM_FORMAT_PRIVATE_NAME): Make format specifier match printed data. (ASM_FINISH_DECLARE_OBJECT): Likewise. Constify name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167186 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 17 +++++++++++++++++ gcc/config/microblaze/microblaze.c | 36 ++++++++++++++++++++++-------------- gcc/config/microblaze/microblaze.h | 23 ++++++++++++++--------- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e996ca0f50..808afedd8b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2010-11-26 Joern Rennecke + + PR target/46623 + * config/microblaze/microblaze.c (microblaze_block_move_straight): + Use XALLOCAVEC. + (microblaze_option_override): Don't use C++ style comments. + (save_restore_insns): Remove unused variable base_offset. + (microblaze_expand_prologue): Remove unused variable insn. + (microblaze_secondary_reload): Adjust type to match target.h . + (microblaze_elf_in_small_data_p): Move declarations to start of block. + (microblaze_expand_move): Likewise. + * config/microblaze/microblaze.h (LARGE_INT): + Avoid signed / unsigned comparisons. + (ASM_OUTPUT_ALIGNED_COMMON, ASM_OUTPUT_ALIGNED_LOCAL): Likewise. + (ASM_FORMAT_PRIVATE_NAME): Make format specifier match printed data. + (ASM_FINISH_DECLARE_OBJECT): Likewise. Constify name. + 2010-11-26 Michael Matz * tree-ssa-copy.c (fini_copy_prop): Don't DCE when we have loops. diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c index e81285c9067..efa000c49c0 100644 --- a/gcc/config/microblaze/microblaze.c +++ b/gcc/config/microblaze/microblaze.c @@ -729,7 +729,7 @@ microblaze_block_move_straight (rtx dest, rtx src, HOST_WIDE_INT length) delta = bits / BITS_PER_UNIT; /* Allocate a buffer for the temporary registers. */ - regs = alloca (sizeof (rtx) * length / delta); + regs = XALLOCAVEC (rtx, length / delta); /* Load as many BITS-sized chunks as possible. Use a normal load if the source has enough alignment, otherwise use left/right pairs. */ @@ -1317,7 +1317,9 @@ microblaze_option_override (void) if (ver < 0) { /* No hardware exceptions in earlier versions. So no worries. */ - // microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#if 0 + microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#endif microblaze_no_unsafe_delay = 0; microblaze_pipe = MICROBLAZE_PIPE_3; } @@ -1325,7 +1327,9 @@ microblaze_option_override (void) || (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v4.00.b") == 0)) { - // microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#if 0 + microblaze_select_flags |= (MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#endif microblaze_no_unsafe_delay = 1; microblaze_pipe = MICROBLAZE_PIPE_3; } @@ -1333,7 +1337,9 @@ microblaze_option_override (void) { /* We agree to use 5 pipe-stage model even on area optimized 3 pipe-stage variants. */ - // microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#if 0 + microblaze_select_flags &= ~(MICROBLAZE_MASK_NO_UNSAFE_DELAY); +#endif microblaze_no_unsafe_delay = 0; microblaze_pipe = MICROBLAZE_PIPE_5; if (MICROBLAZE_VERSION_COMPARE (microblaze_select_cpu, "v5.00.a") == 0 @@ -1362,7 +1368,9 @@ microblaze_option_override (void) /* Always use DFA scheduler. */ microblaze_sched_use_dfa = 1; - // microblaze_abicalls = MICROBLAZE_ABICALLS_NO; +#if 0 + microblaze_abicalls = MICROBLAZE_ABICALLS_NO; +#endif /* Initialize the high, low values for legit floating point constants. */ real_maxval (&dfhigh, 0, DFmode); @@ -2068,7 +2076,7 @@ save_restore_insns (int prologue) 0, isr_mem_rtx = 0; rtx isr_msr_rtx = 0, insn; long mask = current_frame_info.mask; - HOST_WIDE_INT base_offset, gp_offset; + HOST_WIDE_INT gp_offset; int regno; if (frame_pointer_needed @@ -2094,7 +2102,6 @@ save_restore_insns (int prologue) gcc_assert (gp_offset > 0); base_reg_rtx = stack_pointer_rtx; - base_offset = 0; /* For interrupt_handlers, need to save/restore the MSR. */ if (interrupt_handler) @@ -2391,9 +2398,8 @@ microblaze_expand_prologue (void) if (flag_pic == 2 && df_regs_ever_live_p (MB_ABI_PIC_ADDR_REGNUM)) { - rtx insn; SET_REGNO (pic_offset_table_rtx, MB_ABI_PIC_ADDR_REGNUM); - insn = emit_insn (gen_set_got (pic_offset_table_rtx)); /* setting GOT. */ + emit_insn (gen_set_got (pic_offset_table_rtx)); /* setting GOT. */ } /* If we are profiling, make sure no instructions are scheduled before @@ -2518,9 +2524,9 @@ microblaze_can_use_return_insn (void) /* Implement TARGET_SECONDARY_RELOAD. */ -static enum reg_class +static reg_class_t microblaze_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED, - enum reg_class rclass, enum machine_mode mode ATTRIBUTE_UNUSED, + reg_class_t rclass, enum machine_mode mode ATTRIBUTE_UNUSED, secondary_reload_info *sri ATTRIBUTE_UNUSED) { if (rclass == ST_REGS) @@ -2546,6 +2552,8 @@ microblaze_globalize_label (FILE * stream, const char *name) static bool microblaze_elf_in_small_data_p (const_tree decl) { + HOST_WIDE_INT size; + if (!TARGET_XLGPOPT) return false; @@ -2567,7 +2575,7 @@ microblaze_elf_in_small_data_p (const_tree decl) return true; } - HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl)); + size = int_size_in_bytes (TREE_TYPE (decl)); return (size > 0 && size <= microblaze_section_threshold); } @@ -2624,11 +2632,11 @@ microblaze_expand_move (enum machine_mode mode, rtx operands[]) rtx addr = XEXP (operands[0], 0); if (GET_CODE (addr) == SYMBOL_REF) { + rtx ptr_reg, result; + if (reload_in_progress) df_set_regs_ever_live (PIC_OFFSET_TABLE_REGNUM, true); - rtx ptr_reg, result; - addr = expand_pic_symbol_ref (mode, addr); ptr_reg = gen_reg_rtx (Pmode); emit_move_insn (ptr_reg, addr); diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h index 2fb438de30f..7290f75187d 100644 --- a/gcc/config/microblaze/microblaze.h +++ b/gcc/config/microblaze/microblaze.h @@ -369,7 +369,8 @@ extern enum reg_class microblaze_regno_to_class[]; /* REGISTER AND CONSTANT CLASSES */ #define SMALL_INT(X) ((unsigned HOST_WIDE_INT) (INTVAL (X) + 0x8000) < 0x10000) -#define LARGE_INT(X) (INTVAL (X) >= 0x80000000 && INTVAL (X) <= 0xffffffff) +#define LARGE_INT(X) \ + (INTVAL (X) > 0 && UINTVAL (X) >= 0x80000000 && UINTVAL (X) <= 0xffffffff) #define PLT_ADDR_P(X) (GET_CODE (X) == UNSPEC && XINT (X,1) == UNSPEC_PLT) /* Test for a valid operand for a call instruction. Don't allow the arg pointer register or virtual regs @@ -647,8 +648,9 @@ typedef struct microblaze_args #undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ do { \ - if (SIZE > 0 && SIZE <= microblaze_section_threshold \ - && TARGET_XLGPOPT) \ + if ((SIZE) > 0 && (SIZE) <= INT_MAX \ + && (int) (SIZE) <= microblaze_section_threshold \ + && TARGET_XLGPOPT) \ { \ switch_to_section (sbss_section); \ } \ @@ -666,8 +668,9 @@ do { \ #undef ASM_OUTPUT_ALIGNED_LOCAL #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ do { \ - if (SIZE > 0 && SIZE <= microblaze_section_threshold \ - && TARGET_XLGPOPT) \ + if ((SIZE) > 0 && (SIZE) <= INT_MAX \ + && (int) (SIZE) <= microblaze_section_threshold \ + && TARGET_XLGPOPT) \ { \ switch_to_section (sbss_section); \ } \ @@ -736,7 +739,7 @@ do { \ LABELNO is an integer which is different for each call. */ #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \ ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10), \ - sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO))) + sprintf ((OUTPUT), "%s.%lu", (NAME), (unsigned long)(LABELNO))) /* How to start an assembler comment. The leading space is important (the microblaze assembler requires it). */ @@ -817,7 +820,8 @@ extern int save_volatiles; size_directive_output = 1; \ fprintf (FILE, "%s", SIZE_ASM_OP); \ assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + fprintf (FILE, "," HOST_WIDE_INT_PRINT_DEC "\n", \ + int_size_in_bytes (TREE_TYPE (DECL))); \ } \ microblaze_declare_object (FILE, NAME, "", ":\n", 0); \ } while (0) @@ -825,7 +829,7 @@ extern int save_volatiles; #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ + const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ && ! AT_END && TOP_LEVEL \ && DECL_INITIAL (DECL) == error_mark_node \ @@ -834,7 +838,8 @@ do { \ size_directive_output = 1; \ fprintf (FILE, "%s", SIZE_ASM_OP); \ assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + fprintf (FILE, "," HOST_WIDE_INT_PRINT_DEC "\n", \ + int_size_in_bytes (TREE_TYPE (DECL))); \ } \ } while (0) -- 2.11.0