diff mbox

[AVR] : Bit of Cleanup [3/3]: Remove byte_immediate_operand

Message ID 4E564E91.2000103@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay Aug. 25, 2011, 1:30 p.m. UTC
Georg-Johann Lay wrote:
> These are three small patches to clean up the avr BE a bit:
> 
> #1: Use custom macro to test of a string starts with given prefix
> 
> #2: Let avr_regno_reg_class return smallest register class
> 
> #3: Replace/remove superfluous byte_immediate_operand and some protos.
> 
> All patches tested without regression.
> 
> Ok to install them?
> 
> Johann
> 

	* config/avr-protos.h (byte_immediate_operand): Remove Prototype.
	(secondary_input_reload_class): Remove Prototype.
	* config/avr/avr.c (byte_immediate_operand): Remove Function.
	* config/avr/avr.md (setmemhi): Use u8_operand.
	(strlenhi): Use const0_rtx for comparison.
	* config/avr/avr.h (avr_reg_order): Remove Declaration.

Comments

Weddington, Eric Aug. 25, 2011, 1:45 p.m. UTC | #1
> -----Original Message-----
> From: Georg-Johann Lay [mailto:avr@gjlay.de]
> Sent: Thursday, August 25, 2011 7:31 AM
> To: gcc-patches@gcc.gnu.org
> Cc: Denis Chertykov; Weddington, Eric
> Subject: Re: [Patch,AVR]: Bit of Cleanup [3/3]: Remove
> byte_immediate_operand
> 
> Georg-Johann Lay wrote:
> > These are three small patches to clean up the avr BE a bit:
> >
> > #1: Use custom macro to test of a string starts with given prefix
> >
> > #2: Let avr_regno_reg_class return smallest register class
> >
> > #3: Replace/remove superfluous byte_immediate_operand and some protos.
> >
> > All patches tested without regression.
> >
> > Ok to install them?
> >
> > Johann
> >
> 
> 	* config/avr-protos.h (byte_immediate_operand): Remove Prototype.
> 	(secondary_input_reload_class): Remove Prototype.
> 	* config/avr/avr.c (byte_immediate_operand): Remove Function.
> 	* config/avr/avr.md (setmemhi): Use u8_operand.
> 	(strlenhi): Use const0_rtx for comparison.
> 	* config/avr/avr.h (avr_reg_order): Remove Declaration.

Ok for #3.

Thanks for doing this cleanup.

Eric
diff mbox

Patch

Index: config/avr/avr.md
===================================================================
--- config/avr/avr.md	(revision 178058)
+++ config/avr/avr.md	(working copy)
@@ -591,18 +591,16 @@  (define_expand "setmemhi"
   ""
   "{
   rtx addr0;
-  int cnt8;
   enum machine_mode mode;
 
   /* If value to set is not zero, use the library routine.  */
   if (operands[2] != const0_rtx)
     FAIL;
 
-  if (GET_CODE (operands[1]) != CONST_INT)
+  if (!CONST_INT_P (operands[1]))
     FAIL;
 
-  cnt8 = byte_immediate_operand (operands[1], GET_MODE (operands[1]));
-  mode = cnt8 ? QImode : HImode;
+  mode = u8_operand (operands[1], VOIDmode) ? QImode : HImode;
   operands[5] = gen_rtx_SCRATCH (mode);
   operands[1] = copy_to_mode_reg (mode,
                                   gen_int_mode (INTVAL (operands[1]), mode));
@@ -660,7 +658,7 @@  (define_expand "strlenhi"
    ""
    "{
   rtx addr;
-  if (! (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 0))
+  if (operands[2] != const0_rtx)
     FAIL;
   addr = copy_to_mode_reg (Pmode, XEXP (operands[1],0));
   operands[1] = gen_rtx_MEM (BLKmode, addr); 
Index: config/avr/avr-protos.h
===================================================================
--- config/avr/avr-protos.h	(revision 178035)
+++ config/avr/avr-protos.h	(working copy)
@@ -86,16 +86,12 @@  extern int extra_constraint_Q (rtx x);
 extern int adjust_insn_length (rtx insn, int len);
 extern const char *output_reload_inhi (rtx insn, rtx *operands, int *len);
 extern const char *output_reload_insisf (rtx insn, rtx *operands, rtx clobber, int *len);
-extern enum reg_class secondary_input_reload_class (enum reg_class,
-						    enum machine_mode,
-						    rtx);
 extern void notice_update_cc (rtx body, rtx insn);
 extern void print_operand (FILE *file, rtx x, int code);
 extern void print_operand_address (FILE *file, rtx addr);
 extern int reg_unused_after (rtx insn, rtx reg);
 extern int _reg_unused_after (rtx insn, rtx reg);
 extern int avr_jump_mode (rtx x, rtx insn);
-extern int byte_immediate_operand (rtx op, enum machine_mode mode);
 extern int test_hard_reg_class (enum reg_class rclass, rtx x);
 extern int jump_over_one_insn_p (rtx insn, rtx dest);
 
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 178035)
+++ config/avr/avr.h	(working copy)
@@ -376,8 +376,6 @@  typedef struct avr_args {
 
 #define FUNCTION_ARG_REGNO_P(r) function_arg_regno_p(r)
 
-extern int avr_reg_order[];
-
 #define DEFAULT_PCC_STRUCT_RETURN 0
 
 #define EPILOGUE_USES(REGNO) avr_epilogue_uses(REGNO)