aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authorMarek Michalkiewicz <marekm@amelek.gda.pl>2002-07-10 23:08:41 +0200
committerMarek Michalkiewicz <marekm@gcc.gnu.org>2002-07-10 21:08:41 +0000
commit126dbce033efc65645fd30054f0c33c56df91529 (patch)
tree911076be84594cb92d5006b163a575cc0dcd7dbf /gcc/config/avr
parent21c318ba4d9b2e6d4cbdd9241e8649f4c27c3098 (diff)
downloadgcc-126dbce033efc65645fd30054f0c33c56df91529.zip
gcc-126dbce033efc65645fd30054f0c33c56df91529.tar.gz
gcc-126dbce033efc65645fd30054f0c33c56df91529.tar.bz2
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
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr-protos.h2
-rw-r--r--gcc/config/avr/avr.c25
-rw-r--r--gcc/config/avr/avr.h5
-rw-r--r--gcc/config/avr/avr.md11
4 files changed, 40 insertions, 3 deletions
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)]
""