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]

[Patch][AVR]: Use define_c_enum where appropriate


Use define_c_enum instead of magic numbers to get unspec resp.
unspec_volatile constants.

2011-03-23  Georg-Johann Lay  <avr@gjlay.de>

	* config/avr/avr.md (define_constants): Move UNSPEC_*
	resp. UNSPECV_* defines to...
	(define_c_enum "unspec") ...this new enum resp. ...
	(define_c_enum "unspecv") ...this new enum.
Index: config/avr/avr.md
===================================================================
--- config/avr/avr.md	(Revision 171340)
+++ config/avr/avr.md	(Arbeitskopie)
@@ -35,10 +35,6 @@
 ;;  ~  Output 'r' if not AVR_HAVE_JMP_CALL.
 ;;  !  Output 'e' if AVR_HAVE_EIJMP_EICALL.
 
-;; UNSPEC usage:
-;;  0  Length of a string, see "strlenhi".
-;;  1  Jump by register pair Z or by table addressed by Z, see "casesi".
-
 (define_constants
   [(REG_X	26)
    (REG_Y	28)
@@ -50,17 +46,22 @@ (define_constants
    
    (SREG_ADDR   0x5F)
    (RAMPZ_ADDR  0x5B)
-   
-   (UNSPEC_STRLEN	0)
-   (UNSPEC_INDEX_JMP	1)
-   (UNSPEC_SEI		2)
-   (UNSPEC_CLI		3)
+   ])
+
+(define_c_enum "unspec"
+  [UNSPEC_STRLEN
+   UNSPEC_INDEX_JMP
+   UNSPEC_SEI
+   UNSPEC_CLI
+   ])
 
-   (UNSPECV_PROLOGUE_SAVES	0)
-   (UNSPECV_EPILOGUE_RESTORES	1)
-   (UNSPECV_WRITE_SP_IRQ_ON	2)
-   (UNSPECV_WRITE_SP_IRQ_OFF	3)
-   (UNSPECV_GOTO_RECEIVER	4)])
+(define_c_enum "unspecv"
+  [UNSPECV_PROLOGUE_SAVES
+   UNSPECV_EPILOGUE_RESTORES
+   UNSPECV_WRITE_SP_IRQ_ON
+   UNSPECV_WRITE_SP_IRQ_OFF
+   UNSPECV_GOTO_RECEIVER
+   ])
 
 (include "predicates.md")
 (include "constraints.md")

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