From 126dbce033efc65645fd30054f0c33c56df91529 Mon Sep 17 00:00:00 2001 From: Marek Michalkiewicz Date: Wed, 10 Jul 2002 23:08:41 +0200 Subject: [PATCH] avr.md: Fix two 0x80000000 constants to make them negative also on 64-bit hosts. * config/avr/avr.md: Fix two 0x80000000 constants to make them negative also on 64-bit hosts. Default to -fno-reorder-blocks when optimizing for size. * config/avr/avr-protos.h (avr_optimization_options): Declare. * config/avr/avr.c (avr_optimization_options): New function. * config/avr/avr.h (OPTIMIZATION_OPTIONS): New. Optimize returning from simple functions. * config/avr/avr-protos.h (avr_simple_epilogue): Declare. * config/avr/avr.c (avr_simple_epilogue): New function. * config/avr/avr.md (return): New insn. From-SVN: r55378 --- gcc/ChangeLog | 16 +++++++++++++++- gcc/config/avr/avr-protos.h | 2 ++ gcc/config/avr/avr.c | 25 +++++++++++++++++++++++++ gcc/config/avr/avr.h | 5 ++++- gcc/config/avr/avr.md | 11 +++++++++-- 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 49fee82..39f35e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2002-07-10 Marek Michalkiewicz + + * config/avr/avr.md: Fix two 0x80000000 constants to make them + negative also on 64-bit hosts. + + Default to -fno-reorder-blocks when optimizing for size. + * config/avr/avr-protos.h (avr_optimization_options): Declare. + * config/avr/avr.c (avr_optimization_options): New function. + * config/avr/avr.h (OPTIMIZATION_OPTIONS): New. + + Optimize returning from simple functions. + * config/avr/avr-protos.h (avr_simple_epilogue): Declare. + * config/avr/avr.c (avr_simple_epilogue): New function. + * config/avr/avr.md (return): New insn. + 2002-07-10 Douglas B Rupp * config/i386/i386.c (ix86_svr3_asm_out_constructor): Add @@ -1213,7 +1228,6 @@ Thu Jun 20 00:26:53 2002 Denis Chertykov at start of buffer. * gcc.c (trad_capable_cpp): Use cc1 always. ->>>>>>> 1.14808 2002-06-20 Jeffrey Law * i386.h (TARGET_DEFAULT): Do not turn on frame pointer diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 3d0be48..20841a7 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -26,6 +26,7 @@ extern void asm_file_start PARAMS ((FILE *file)); extern void asm_file_end PARAMS ((FILE *file)); extern void avr_init_once PARAMS ((void)); extern void avr_override_options PARAMS ((void)); +extern void avr_optimization_options PARAMS ((int level, int size)); extern char * avr_change_section PARAMS ((char *sect_name)); extern int avr_ret_register PARAMS ((void)); extern enum reg_class class_likely_spilled_p PARAMS ((int c)); @@ -35,6 +36,7 @@ extern int frame_pointer_required_p PARAMS ((void)); extern void asm_globalize_label PARAMS ((FILE *file, const char *name)); extern void order_regs_for_local_alloc PARAMS ((void)); extern int initial_elimination_offset PARAMS ((int from, int to)); +extern int avr_simple_epilogue PARAMS ((void)); extern void progmem_section PARAMS ((void)); extern int mask_one_bit_p PARAMS ((HOST_WIDE_INT mask)); extern void gas_output_limited_string PARAMS ((FILE *file, const char *str)); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 1f51c03..bb879ef 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -259,6 +259,16 @@ avr_override_options () } +void +avr_optimization_options (level, size) + int level ATTRIBUTE_UNUSED; + int size; +{ + if (size) + flag_reorder_blocks = 0; +} + + /* Initialize TMP_REG_RTX and ZERO_REG_RTX */ void avr_init_once () @@ -445,6 +455,21 @@ initial_elimination_offset (from, to) } } +/* Return 1 if the function epilogue is just a single "ret". */ + +int +avr_simple_epilogue () +{ + return (! frame_pointer_needed + && get_frame_size () == 0 + && avr_regs_to_save (NULL) == 0 + && ! interrupt_function_p (current_function_decl) + && ! signal_function_p (current_function_decl) + && ! avr_naked_function_p (current_function_decl) + && ! MAIN_NAME_P (DECL_NAME (current_function_decl)) + && ! TREE_THIS_VOLATILE (current_function_decl)); +} + /* This function checks sequence of live registers */ static int diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 65effa6..eb40497 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -121,7 +121,7 @@ extern int avr_asm_only_p; fprintf (stderr, " (68k, MIT syntax)"); #endif */ -#define OVERRIDE_OPTIONS avr_override_options() +#define OVERRIDE_OPTIONS avr_override_options () /* `OVERRIDE_OPTIONS' Sometimes certain combinations of command options do not make sense on a particular target machine. You can define a macro @@ -132,6 +132,9 @@ extern int avr_asm_only_p; Don't use this macro to turn on various extra optimizations for `-O'. That is what `OPTIMIZATION_OPTIONS' is for. */ +#define OPTIMIZATION_OPTIONS(LEVEL, SIZE) \ + avr_optimization_options (LEVEL, SIZE) + #define CAN_DEBUG_WITHOUT_FP /* Define this macro if debugging can be performed even without a frame pointer. If this macro is defined, GNU CC will turn on the diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 017b8a2..c237dcd 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -1966,7 +1966,7 @@ (const_int 0)) (label_ref (match_dup 1)) (pc)))] - "operands[2] = GEN_INT (0x80000000);") + "operands[2] = GEN_INT (-2147483647 - 1);") (define_peephole2 [(set (cc0) (match_operand:SI 0 "register_operand" "")) @@ -1978,7 +1978,7 @@ (const_int 0)) (label_ref (match_dup 1)) (pc)))] - "operands[2] = GEN_INT (0x80000000);") + "operands[2] = GEN_INT (-2147483647 - 1);") ;; ************************************************************************ ;; Implementation of conditional jumps here. @@ -2143,6 +2143,13 @@ (const_int 2) (const_int 1))])]) +(define_insn "return" + [(return)] + "reload_completed && avr_simple_epilogue ()" + "ret" + [(set_attr "cc" "none") + (set_attr "length" "1")]) + (define_insn "nop" [(const_int 0)] "" -- 2.7.4