[patch commit] [SH] Use define_c_enum in sh.md

Kaz Kojima kkojima@rr.iij4u.or.jp
Mon Sep 29 23:18:00 GMT 2014


I've noticed that config/sh/sh.md uses define_constants to define
unspec and unspecv numbers, though config/sh/sync.md uses define_c_enum
for them.  This causes collisions of some numbers.  The attached
patch would be an obvious fix.  Tested on sh4-unknown-linux.  Applied
to trunk.  I'll backport it to branches in a week or so.

Regards,
	kaz
--
2014-09-29  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.md: Use define_c_enum for "unspec" and "unspecv".

--- ORIG/trunk/gcc/config/sh/sh.md	2014-09-20 08:59:46.000000000 +0900
+++ trunk/gcc/config/sh/sh.md	2014-09-29 09:36:41.661822991 +0900
@@ -109,73 +109,73 @@
   (TR2_REG	130)
 
   (XD0_REG	136)
+])
 
+(define_c_enum "unspec" [
   ;; These are used with unspec.
-  (UNSPEC_COMPACT_ARGS	0)
-  (UNSPEC_MOVA		1)
-  (UNSPEC_CASESI	2)
-  (UNSPEC_DATALABEL	3)
-  (UNSPEC_BBR		4)
-  (UNSPEC_SFUNC		5)
-  (UNSPEC_PIC		6)
-  (UNSPEC_GOT		7)
-  (UNSPEC_GOTOFF	8)
-  (UNSPEC_PLT		9)
-  (UNSPEC_CALLER	10)
-  (UNSPEC_GOTPLT	11)
-  (UNSPEC_ICACHE	12)
-  (UNSPEC_INIT_TRAMP	13)
-  (UNSPEC_FCOSA		14)
-  (UNSPEC_FSRRA		15)
-  (UNSPEC_FSINA		16)
-  (UNSPEC_NSB		17)
-  (UNSPEC_ALLOCO	18)
-  (UNSPEC_TLSGD		20)
-  (UNSPEC_TLSLDM	21)
-  (UNSPEC_TLSIE		22)
-  (UNSPEC_DTPOFF	23)
-  (UNSPEC_GOTTPOFF	24)
-  (UNSPEC_TPOFF		25)
-  (UNSPEC_RA		26)
-  (UNSPEC_DIV_INV_M0	30)
-  (UNSPEC_DIV_INV_M1	31)
-  (UNSPEC_DIV_INV_M2	32)
-  (UNSPEC_DIV_INV_M3	33)
-  (UNSPEC_DIV_INV20	34)
-  (UNSPEC_DIV_INV_TABLE	37)
-  (UNSPEC_ASHIFTRT	35)
-  (UNSPEC_THUNK		36)
-  (UNSPEC_CHKADD	38)
-  (UNSPEC_SP_SET	40)
-  (UNSPEC_SP_TEST	41)
-  (UNSPEC_MOVUA		42)
-
+  UNSPEC_COMPACT_ARGS
+  UNSPEC_MOVA
+  UNSPEC_CASESI
+  UNSPEC_DATALABEL
+  UNSPEC_BBR
+  UNSPEC_SFUNC
+  UNSPEC_PIC
+  UNSPEC_GOT
+  UNSPEC_GOTOFF
+  UNSPEC_PLT
+  UNSPEC_CALLER
+  UNSPEC_GOTPLT
+  UNSPEC_ICACHE
+  UNSPEC_INIT_TRAMP
+  UNSPEC_FCOSA
+  UNSPEC_FSRRA
+  UNSPEC_FSINA
+  UNSPEC_NSB
+  UNSPEC_ALLOCO
+  UNSPEC_TLSGD
+  UNSPEC_TLSLDM
+  UNSPEC_TLSIE
+  UNSPEC_DTPOFF
+  UNSPEC_GOTTPOFF
+  UNSPEC_TPOFF
+  UNSPEC_RA
+  UNSPEC_DIV_INV_M0
+  UNSPEC_DIV_INV_M1
+  UNSPEC_DIV_INV_M2
+  UNSPEC_DIV_INV_M3
+  UNSPEC_DIV_INV20
+  UNSPEC_DIV_INV_TABLE
+  UNSPEC_ASHIFTRT
+  UNSPEC_THUNK
+  UNSPEC_CHKADD
+  UNSPEC_SP_SET
+  UNSPEC_SP_TEST
+  UNSPEC_MOVUA
   ;; (unspec [VAL SHIFT] UNSPEC_EXTRACT_S16) computes (short) (VAL >> SHIFT).
   ;; UNSPEC_EXTRACT_U16 is the unsigned equivalent.
-  (UNSPEC_EXTRACT_S16	43)
-  (UNSPEC_EXTRACT_U16	44)
-
+  UNSPEC_EXTRACT_S16
+  UNSPEC_EXTRACT_U16
   ;; (unspec [TARGET ANCHOR] UNSPEC_SYMOFF) == TARGET - ANCHOR.
-  (UNSPEC_SYMOFF	45)
-
+  UNSPEC_SYMOFF
   ;; (unspec [OFFSET ANCHOR] UNSPEC_PCREL_SYMOFF) == OFFSET - (ANCHOR - .).
-  (UNSPEC_PCREL_SYMOFF	46)
-
+  UNSPEC_PCREL_SYMOFF
   ;; Misc builtins
-  (UNSPEC_BUILTIN_STRLEN 47)
+  UNSPEC_BUILTIN_STRLEN
+])
 
+(define_c_enum "unspecv" [
   ;; These are used with unspec_volatile.
-  (UNSPECV_BLOCKAGE	0)
-  (UNSPECV_ALIGN	1)
-  (UNSPECV_CONST2	2)
-  (UNSPECV_CONST4	4)
-  (UNSPECV_CONST8	6)
-  (UNSPECV_WINDOW_END	10)
-  (UNSPECV_CONST_END	11)
-  (UNSPECV_EH_RETURN	12)
-  (UNSPECV_GBR		13)
-  (UNSPECV_SP_SWITCH_B  14)
-  (UNSPECV_SP_SWITCH_E  15)
+  UNSPECV_BLOCKAGE
+  UNSPECV_ALIGN
+  UNSPECV_CONST2
+  UNSPECV_CONST4
+  UNSPECV_CONST8
+  UNSPECV_WINDOW_END
+  UNSPECV_CONST_END
+  UNSPECV_EH_RETURN
+  UNSPECV_GBR
+  UNSPECV_SP_SWITCH_B
+  UNSPECV_SP_SWITCH_E
 ])
 
 ;; -------------------------------------------------------------------------



More information about the Gcc-patches mailing list