avr.md: Fix two 0x80000000 constants to make them negative also on 64-bit hosts.
authorMarek Michalkiewicz <marekm@amelek.gda.pl>
Wed, 10 Jul 2002 21:08:41 +0000 (23:08 +0200)
committerMarek Michalkiewicz <marekm@gcc.gnu.org>
Wed, 10 Jul 2002 21:08:41 +0000 (21:08 +0000)
* 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
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/avr/avr.md

index 49fee82..39f35e5 100644 (file)
@@ -1,3 +1,18 @@
+2002-07-10  Marek Michalkiewicz  <marekm@amelek.gda.pl>
+
+       * 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  <rupp@gnat.com>
 
        * config/i386/i386.c  (ix86_svr3_asm_out_constructor): Add
@@ -1213,7 +1228,6 @@ Thu Jun 20 00:26:53 2002  Denis Chertykov  <denisc@overta.ru>
        at start of buffer.
        * gcc.c (trad_capable_cpp): Use cc1 always.
 
->>>>>>> 1.14808
 2002-06-20  Jeffrey Law  <law@redhat.com>
 
        * i386.h (TARGET_DEFAULT): Do not turn on frame pointer
index 3d0be48..20841a7 100644 (file)
@@ -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));
index 1f51c03..bb879ef 100644 (file)
@@ -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
index 65effa6..eb40497 100644 (file)
@@ -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
index 017b8a2..c237dcd 100644 (file)
                               (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" ""))
                               (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.
                                        (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)]
   ""