This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AVR port cleanup.


Hello.

This patch add 'avr_' prefix to the frame_pointer_required_p and
initial_elimination_offset function names and implement the CAN_ELIMINATE
macro as function.

2008-03-29  Anatoly Sokolov  <aesok@post.ru>

        * config/avr/avr.c (initial_elimination_offset) : Rename to
        avr_initial_elimination_offset.
        (frame_pointer_required_p): Rename to avr_frame_pointer_required_p,
        change return type to bool.
        (avr_can_eliminate): New function.
        * config/avr/avr.h (CAN_ELIMINATE): Use avr_can_eliminate.
        (FRAME_POINTER_REQUIRED): Use avr_frame_pointer_required_p.
        (INITIAL_ELIMINATION_OFFSET): Use avr_initial_elimination_offset.
        * config/avr/avr-protos.h (initial_elimination_offset) : Rename to
        avr_initial_elimination_offset.
        (frame_pointer_required_p): Rename to avr_frame_pointer_required_p,
        change return type to bool.
        (avr_initial_elimination_offset): Declare.

Index: gcc/config/avr/avr-protos.h
===================================================================
--- gcc/config/avr/avr-protos.h	(revision 146987)
+++ gcc/config/avr/avr-protos.h	(working copy)
@@ -30,11 +30,12 @@
 extern enum reg_class class_likely_spilled_p (int c);
 extern enum reg_class avr_regno_reg_class (int r);
 extern enum reg_class avr_reg_class_from_letter (int c);
-extern int frame_pointer_required_p (void);
+extern int avr_frame_pointer_required_p (void);
 extern void asm_globalize_label (FILE *file, const char *name);
 extern void avr_asm_declare_function_name (FILE *, const char *, tree);
 extern void order_regs_for_local_alloc (void);
-extern int initial_elimination_offset (int from, int to);
+extern bool avr_can_eliminate (int, int);
+extern int avr_initial_elimination_offset (int from, int to);
 extern int avr_simple_epilogue (void);
 extern void gas_output_limited_string (FILE *file, const char *str);
 extern void gas_output_ascii (FILE *file, const char *str, size_t length);
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c        (revision 146987)
+++ gcc/config/avr/avr.c        (working copy)
@@ -545,10 +545,21 @@
   return count;
 }
 
+/* Return true if register FROM can be eliminated via register TO.  */
+
+bool
+avr_can_eliminate (int from, int to)
+{
+  return ((from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
+         || ((from == FRAME_POINTER_REGNUM 
+              || from == FRAME_POINTER_REGNUM + 1)
+             && !frame_pointer_needed));
+}
+
 /* Compute offset between arg_pointer and frame_pointer.  */
 
 int
-initial_elimination_offset (int from, int to)
+avr_initial_elimination_offset (int from, int to)
 {
   if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
     return 0;
@@ -2843,8 +2854,8 @@
 
 /* Return 1 if frame pointer for current function required.  */
 
-int
-frame_pointer_required_p (void)
+bool
+avr_frame_pointer_required_p (void)
 {
   return (cfun->calls_alloca
          || crtl->args.info.nregs == 0
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h        (revision 146987)
+++ gcc/config/avr/avr.h        (working copy)
@@ -350,7 +350,7 @@
 
 #define STATIC_CHAIN_REGNUM 2
 
-#define FRAME_POINTER_REQUIRED frame_pointer_required_p()
+#define FRAME_POINTER_REQUIRED avr_frame_pointer_required_p()
 
 /* Offset from the frame pointer register value to the top of the stack.  */
 #define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
@@ -360,15 +360,10 @@
        {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}            \
        ,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
 
-#define CAN_ELIMINATE(FROM, TO) (((FROM) == ARG_POINTER_REGNUM            \
-                                 && (TO) == FRAME_POINTER_REGNUM)         \
-                                || (((FROM) == FRAME_POINTER_REGNUM       \
-                                     || (FROM) == FRAME_POINTER_REGNUM+1) \
-                                    && ! FRAME_POINTER_REQUIRED           \
-                                    ))
+#define CAN_ELIMINATE(FROM, TO)        avr_can_eliminate (FROM, TO)
 
 #define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET)                   \
-     OFFSET = initial_elimination_offset (FROM, TO)
+  OFFSET = avr_initial_elimination_offset (FROM, TO)
 
 #define RETURN_ADDR_RTX(count, x) \
   gen_rtx_MEM (Pmode, memory_address (Pmode, plus_constant (tem, 1)))


Anatoly





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]