diff mbox

[Richard,Sandiford,ARM] Define unspecs using define_c_enum

Message ID g4aagdouhw.fsf@linaro.org
State Accepted
Headers show

Commit Message

Richard Sandiford March 30, 2011, 8:58 a.m. UTC
This ARM patch allows *UNSPEC_* constants to be printed in dump files.
It's very much a target decision whether this is worth doing, but just
in case...

...tested on arm-linux-gnueabi.  OK to install?

Richard


gcc/
	* config/arm/neon.md: Use define_c_enum to define UNSPEC* and
	VUNSPEC* constants.
	* config/arm/arm.md: Likewise.  Move the synchronization ones to...
	* config/arm/sync.md: ...here.
diff mbox

Patch

Index: gcc/config/arm/neon.md
===================================================================
--- gcc/config/arm/neon.md	2011-03-29 09:46:11.000000000 +0100
+++ gcc/config/arm/neon.md	2011-03-29 09:57:52.000000000 +0100
@@ -19,131 +19,131 @@ 
 ;; <http://www.gnu.org/licenses/>.
 
 ;; Constants for unspecs.
-(define_constants
-  [(UNSPEC_ASHIFT_SIGNED	65)
-   (UNSPEC_ASHIFT_UNSIGNED	66)
-   (UNSPEC_VABD			69)
-   (UNSPEC_VABDL		70)
-   (UNSPEC_VADD			72)
-   (UNSPEC_VADDHN		73)
-   (UNSPEC_VADDL		74)
-   (UNSPEC_VADDW		75)
-   (UNSPEC_VBSL			78)
-   (UNSPEC_VCAGE		79)
-   (UNSPEC_VCAGT		80)
-   (UNSPEC_VCEQ			81)
-   (UNSPEC_VCGE			82)
-   (UNSPEC_VCGT			83)
-   (UNSPEC_VCLS			84)
-   (UNSPEC_VCVT			88)
-   (UNSPEC_VCVT_N		89)
-   (UNSPEC_VEXT			93)
-   (UNSPEC_VHADD		97)
-   (UNSPEC_VHSUB		98)
-   (UNSPEC_VLD1			99)
-   (UNSPEC_VLD1_DUP		100)
-   (UNSPEC_VLD1_LANE		101)
-   (UNSPEC_VLD2			102)
-   (UNSPEC_VLD2_DUP		103)
-   (UNSPEC_VLD2_LANE		104)
-   (UNSPEC_VLD3			105)
-   (UNSPEC_VLD3A		106)
-   (UNSPEC_VLD3B		107)
-   (UNSPEC_VLD3_DUP		108)
-   (UNSPEC_VLD3_LANE		109)
-   (UNSPEC_VLD4			110)
-   (UNSPEC_VLD4A		111)
-   (UNSPEC_VLD4B		112)
-   (UNSPEC_VLD4_DUP		113)
-   (UNSPEC_VLD4_LANE		114)
-   (UNSPEC_VMAX			115)
-   (UNSPEC_VMIN			116)
-   (UNSPEC_VMLA			117)
-   (UNSPEC_VMLAL		118)
-   (UNSPEC_VMLA_LANE		119)
-   (UNSPEC_VMLAL_LANE		120)
-   (UNSPEC_VMLS			121)
-   (UNSPEC_VMLSL		122)
-   (UNSPEC_VMLS_LANE		123)
-   (UNSPEC_VMLSL_LANE		124)
-   (UNSPEC_VMOVL		125)
-   (UNSPEC_VMOVN		126)
-   (UNSPEC_VMUL			127)
-   (UNSPEC_VMULL		128)
-   (UNSPEC_VMUL_LANE		129)
-   (UNSPEC_VMULL_LANE		130)
-   (UNSPEC_VPADAL		135)
-   (UNSPEC_VPADD		136)
-   (UNSPEC_VPADDL		137)
-   (UNSPEC_VPMAX		138)
-   (UNSPEC_VPMIN		139)
-   (UNSPEC_VPSMAX		140)
-   (UNSPEC_VPSMIN		141)
-   (UNSPEC_VPUMAX		142)
-   (UNSPEC_VPUMIN		143)
-   (UNSPEC_VQABS		144)
-   (UNSPEC_VQADD		145)
-   (UNSPEC_VQDMLAL		146)
-   (UNSPEC_VQDMLAL_LANE		147)
-   (UNSPEC_VQDMLSL		148)
-   (UNSPEC_VQDMLSL_LANE		149)
-   (UNSPEC_VQDMULH		150)
-   (UNSPEC_VQDMULH_LANE		151)
-   (UNSPEC_VQDMULL		152)
-   (UNSPEC_VQDMULL_LANE		153)
-   (UNSPEC_VQMOVN		154)
-   (UNSPEC_VQMOVUN		155)
-   (UNSPEC_VQNEG		156)
-   (UNSPEC_VQSHL		157)
-   (UNSPEC_VQSHL_N		158)
-   (UNSPEC_VQSHLU_N		159)
-   (UNSPEC_VQSHRN_N		160)
-   (UNSPEC_VQSHRUN_N		161)
-   (UNSPEC_VQSUB		162)
-   (UNSPEC_VRECPE		163)
-   (UNSPEC_VRECPS		164)
-   (UNSPEC_VREV16		165)
-   (UNSPEC_VREV32		166)
-   (UNSPEC_VREV64		167)
-   (UNSPEC_VRSQRTE		168)
-   (UNSPEC_VRSQRTS		169)
-   (UNSPEC_VSHL			171)
-   (UNSPEC_VSHLL_N		172)
-   (UNSPEC_VSHL_N		173)
-   (UNSPEC_VSHR_N		174)
-   (UNSPEC_VSHRN_N		175)
-   (UNSPEC_VSLI			176)
-   (UNSPEC_VSRA_N		177)
-   (UNSPEC_VSRI			178)
-   (UNSPEC_VST1			179)
-   (UNSPEC_VST1_LANE		180)
-   (UNSPEC_VST2			181)
-   (UNSPEC_VST2_LANE		182)
-   (UNSPEC_VST3			183)
-   (UNSPEC_VST3A		184)
-   (UNSPEC_VST3B		185)
-   (UNSPEC_VST3_LANE		186)
-   (UNSPEC_VST4			187)
-   (UNSPEC_VST4A		188)
-   (UNSPEC_VST4B		189)
-   (UNSPEC_VST4_LANE		190)
-   (UNSPEC_VSTRUCTDUMMY		191)
-   (UNSPEC_VSUB			192)
-   (UNSPEC_VSUBHN		193)
-   (UNSPEC_VSUBL		194)
-   (UNSPEC_VSUBW		195)
-   (UNSPEC_VTBL			196)
-   (UNSPEC_VTBX			197)
-   (UNSPEC_VTRN1		198)
-   (UNSPEC_VTRN2		199)
-   (UNSPEC_VTST			200)
-   (UNSPEC_VUZP1		201)
-   (UNSPEC_VUZP2		202)
-   (UNSPEC_VZIP1		203)
-   (UNSPEC_VZIP2		204)
-   (UNSPEC_MISALIGNED_ACCESS	205)
-   (UNSPEC_VCLE			206)
-   (UNSPEC_VCLT			207)])
+(define_c_enum "unspec"
+  [UNSPEC_ASHIFT_SIGNED
+   UNSPEC_ASHIFT_UNSIGNED
+   UNSPEC_VABD
+   UNSPEC_VABDL
+   UNSPEC_VADD
+   UNSPEC_VADDHN
+   UNSPEC_VADDL
+   UNSPEC_VADDW
+   UNSPEC_VBSL
+   UNSPEC_VCAGE
+   UNSPEC_VCAGT
+   UNSPEC_VCEQ
+   UNSPEC_VCGE
+   UNSPEC_VCGT
+   UNSPEC_VCLS
+   UNSPEC_VCVT
+   UNSPEC_VCVT_N
+   UNSPEC_VEXT
+   UNSPEC_VHADD
+   UNSPEC_VHSUB
+   UNSPEC_VLD1
+   UNSPEC_VLD1_DUP
+   UNSPEC_VLD1_LANE
+   UNSPEC_VLD2
+   UNSPEC_VLD2_DUP
+   UNSPEC_VLD2_LANE
+   UNSPEC_VLD3
+   UNSPEC_VLD3A
+   UNSPEC_VLD3B
+   UNSPEC_VLD3_DUP
+   UNSPEC_VLD3_LANE
+   UNSPEC_VLD4
+   UNSPEC_VLD4A
+   UNSPEC_VLD4B
+   UNSPEC_VLD4_DUP
+   UNSPEC_VLD4_LANE
+   UNSPEC_VMAX
+   UNSPEC_VMIN
+   UNSPEC_VMLA
+   UNSPEC_VMLAL
+   UNSPEC_VMLA_LANE
+   UNSPEC_VMLAL_LANE
+   UNSPEC_VMLS
+   UNSPEC_VMLSL
+   UNSPEC_VMLS_LANE
+   UNSPEC_VMLSL_LANE
+   UNSPEC_VMOVL
+   UNSPEC_VMOVN
+   UNSPEC_VMUL
+   UNSPEC_VMULL
+   UNSPEC_VMUL_LANE
+   UNSPEC_VMULL_LANE
+   UNSPEC_VPADAL
+   UNSPEC_VPADD
+   UNSPEC_VPADDL
+   UNSPEC_VPMAX
+   UNSPEC_VPMIN
+   UNSPEC_VPSMAX
+   UNSPEC_VPSMIN
+   UNSPEC_VPUMAX
+   UNSPEC_VPUMIN
+   UNSPEC_VQABS
+   UNSPEC_VQADD
+   UNSPEC_VQDMLAL
+   UNSPEC_VQDMLAL_LANE
+   UNSPEC_VQDMLSL
+   UNSPEC_VQDMLSL_LANE
+   UNSPEC_VQDMULH
+   UNSPEC_VQDMULH_LANE
+   UNSPEC_VQDMULL
+   UNSPEC_VQDMULL_LANE
+   UNSPEC_VQMOVN
+   UNSPEC_VQMOVUN
+   UNSPEC_VQNEG
+   UNSPEC_VQSHL
+   UNSPEC_VQSHL_N
+   UNSPEC_VQSHLU_N
+   UNSPEC_VQSHRN_N
+   UNSPEC_VQSHRUN_N
+   UNSPEC_VQSUB
+   UNSPEC_VRECPE
+   UNSPEC_VRECPS
+   UNSPEC_VREV16
+   UNSPEC_VREV32
+   UNSPEC_VREV64
+   UNSPEC_VRSQRTE
+   UNSPEC_VRSQRTS
+   UNSPEC_VSHL
+   UNSPEC_VSHLL_N
+   UNSPEC_VSHL_N
+   UNSPEC_VSHR_N
+   UNSPEC_VSHRN_N
+   UNSPEC_VSLI
+   UNSPEC_VSRA_N
+   UNSPEC_VSRI
+   UNSPEC_VST1
+   UNSPEC_VST1_LANE
+   UNSPEC_VST2
+   UNSPEC_VST2_LANE
+   UNSPEC_VST3
+   UNSPEC_VST3A
+   UNSPEC_VST3B
+   UNSPEC_VST3_LANE
+   UNSPEC_VST4
+   UNSPEC_VST4A
+   UNSPEC_VST4B
+   UNSPEC_VST4_LANE
+   UNSPEC_VSTRUCTDUMMY
+   UNSPEC_VSUB
+   UNSPEC_VSUBHN
+   UNSPEC_VSUBL
+   UNSPEC_VSUBW
+   UNSPEC_VTBL
+   UNSPEC_VTBX
+   UNSPEC_VTRN1
+   UNSPEC_VTRN2
+   UNSPEC_VTST
+   UNSPEC_VUZP1
+   UNSPEC_VUZP2
+   UNSPEC_VZIP1
+   UNSPEC_VZIP2
+   UNSPEC_MISALIGNED_ACCESS
+   UNSPEC_VCLE
+   UNSPEC_VCLT])
 
 
 ;; Attribute used to permit string comparisons against <VQH_mnem> in
Index: gcc/config/arm/arm.md
===================================================================
--- gcc/config/arm/arm.md	2011-03-25 18:21:18.000000000 +0000
+++ gcc/config/arm/arm.md	2011-03-29 10:02:06.000000000 +0100
@@ -50,99 +50,88 @@  (define_constants
 )
 
 ;; UNSPEC Usage:
-;; Note: sin and cos are no-longer used.
 ;; Unspec constants for Neon are defined in neon.md.
 
-(define_constants
-  [(UNSPEC_SIN       0)	; `sin' operation (MODE_FLOAT):
-			;   operand 0 is the result,
-			;   operand 1 the parameter.
-   (UNPSEC_COS	     1)	; `cos' operation (MODE_FLOAT):
-			;   operand 0 is the result,
-			;   operand 1 the parameter.
-   (UNSPEC_PUSH_MULT 2)	; `push multiple' operation:
+(define_c_enum "unspec"
+  [UNSPEC_PUSH_MULT	; `push multiple' operation:
 			;   operand 0 is the first register,
 			;   subsequent registers are in parallel (use ...)
 			;   expressions.
-   (UNSPEC_PIC_SYM   3) ; A symbol that has been treated properly for pic
+   UNSPEC_PIC_SYM	; A symbol that has been treated properly for pic
 			;   usage, that is, we will add the pic_register
 			;   value to it before trying to dereference it.
-   (UNSPEC_PIC_BASE  4)	; Add PC and all but the last operand together,
+   UNSPEC_PIC_BASE	; Add PC and all but the last operand together,
 			;   The last operand is the number of a PIC_LABEL
 			;   that points at the containing instruction.
-   (UNSPEC_PRLG_STK  5) ; A special barrier that prevents frame accesses 
+   UNSPEC_PRLG_STK	; A special barrier that prevents frame accesses
 			;   being scheduled before the stack adjustment insn.
-   (UNSPEC_PROLOGUE_USE 6) ; As USE insns are not meaningful after reload,
+   UNSPEC_PROLOGUE_USE	; As USE insns are not meaningful after reload,
    			; this unspec is used to prevent the deletion of
    			; instructions setting registers for EH handling
    			; and stack frame generation.  Operand 0 is the
    			; register to "use".
-   (UNSPEC_CHECK_ARCH 7); Set CCs to indicate 26-bit or 32-bit mode.
-   (UNSPEC_WSHUFH    8) ; Used by the intrinsic form of the iWMMXt WSHUFH instruction.
-   (UNSPEC_WACC      9) ; Used by the intrinsic form of the iWMMXt WACC instruction.
-   (UNSPEC_TMOVMSK  10) ; Used by the intrinsic form of the iWMMXt TMOVMSK instruction.
-   (UNSPEC_WSAD     11) ; Used by the intrinsic form of the iWMMXt WSAD instruction.
-   (UNSPEC_WSADZ    12) ; Used by the intrinsic form of the iWMMXt WSADZ instruction.
-   (UNSPEC_WMACS    13) ; Used by the intrinsic form of the iWMMXt WMACS instruction.
-   (UNSPEC_WMACU    14) ; Used by the intrinsic form of the iWMMXt WMACU instruction.
-   (UNSPEC_WMACSZ   15) ; Used by the intrinsic form of the iWMMXt WMACSZ instruction.
-   (UNSPEC_WMACUZ   16) ; Used by the intrinsic form of the iWMMXt WMACUZ instruction.
-   (UNSPEC_CLRDI    17) ; Used by the intrinsic form of the iWMMXt CLRDI instruction.
-   (UNSPEC_WMADDS   18) ; Used by the intrinsic form of the iWMMXt WMADDS instruction.
-   (UNSPEC_WMADDU   19) ; Used by the intrinsic form of the iWMMXt WMADDU instruction.
-   (UNSPEC_TLS      20) ; A symbol that has been treated properly for TLS usage.
-   (UNSPEC_PIC_LABEL 21) ; A label used for PIC access that does not appear in the
-                         ; instruction stream.
-   (UNSPEC_STACK_ALIGN 22) ; Doubleword aligned stack pointer.  Used to
-			   ; generate correct unwind information.
-   (UNSPEC_PIC_OFFSET 23) ; A symbolic 12-bit OFFSET that has been treated
-			  ; correctly for PIC usage.
-   (UNSPEC_GOTSYM_OFF 24) ; The offset of the start of the the GOT from a
-			  ; a given symbolic address.
-   (UNSPEC_THUMB1_CASESI 25) ; A Thumb1 compressed dispatch-table call.
-   (UNSPEC_RBIT 26)       ; rbit operation.
-   (UNSPEC_SYMBOL_OFFSET 27) ; The offset of the start of the symbol from
-                             ; another symbolic address.
-   (UNSPEC_MEMORY_BARRIER 28) ; Represent a memory barrier.
+   UNSPEC_CHECK_ARCH	; Set CCs to indicate 26-bit or 32-bit mode.
+   UNSPEC_WSHUFH	; Used by the intrinsic form of the iWMMXt WSHUFH instruction.
+   UNSPEC_WACC		; Used by the intrinsic form of the iWMMXt WACC instruction.
+   UNSPEC_TMOVMSK	; Used by the intrinsic form of the iWMMXt TMOVMSK instruction.
+   UNSPEC_WSAD		; Used by the intrinsic form of the iWMMXt WSAD instruction.
+   UNSPEC_WSADZ		; Used by the intrinsic form of the iWMMXt WSADZ instruction.
+   UNSPEC_WMACS		; Used by the intrinsic form of the iWMMXt WMACS instruction.
+   UNSPEC_WMACU		; Used by the intrinsic form of the iWMMXt WMACU instruction.
+   UNSPEC_WMACSZ	; Used by the intrinsic form of the iWMMXt WMACSZ instruction.
+   UNSPEC_WMACUZ	; Used by the intrinsic form of the iWMMXt WMACUZ instruction.
+   UNSPEC_CLRDI		; Used by the intrinsic form of the iWMMXt CLRDI instruction.
+   UNSPEC_WMADDS	; Used by the intrinsic form of the iWMMXt WMADDS instruction.
+   UNSPEC_WMADDU	; Used by the intrinsic form of the iWMMXt WMADDU instruction.
+   UNSPEC_TLS		; A symbol that has been treated properly for TLS usage.
+   UNSPEC_PIC_LABEL	; A label used for PIC access that does not appear in the
+			; instruction stream.
+   UNSPEC_STACK_ALIGN	; Doubleword aligned stack pointer.  Used to
+			; generate correct unwind information.
+   UNSPEC_PIC_OFFSET	; A symbolic 12-bit OFFSET that has been treated
+			; correctly for PIC usage.
+   UNSPEC_GOTSYM_OFF	; The offset of the start of the the GOT from a
+			; a given symbolic address.
+   UNSPEC_THUMB1_CASESI	; A Thumb1 compressed dispatch-table call.
+   UNSPEC_RBIT		; rbit operation.
+   UNSPEC_SYMBOL_OFFSET ; The offset of the start of the symbol from
+			; another symbolic address.
+   UNSPEC_MEMORY_BARRIER ; Represent a memory barrier.
   ]
 )
 
 ;; UNSPEC_VOLATILE Usage:
+;; Unspec constants for synchronization primitives are defined in sync.md.
 
-(define_constants
-  [(VUNSPEC_BLOCKAGE 0) ; `blockage' insn to prevent scheduling across an
+(define_c_enum "unspecv"
+  [VUNSPEC_BLOCKAGE	; `blockage' insn to prevent scheduling across an
 			;   insn in the code.
-   (VUNSPEC_EPILOGUE 1) ; `epilogue' insn, used to represent any part of the
+   VUNSPEC_EPILOGUE	; `epilogue' insn, used to represent any part of the
 			;   instruction epilogue sequence that isn't expanded
 			;   into normal RTL.  Used for both normal and sibcall
 			;   epilogues.
-   (VUNSPEC_ALIGN    2) ; `align' insn.  Used at the head of a minipool table 
+   VUNSPEC_ALIGN	; `align' insn.  Used at the head of a minipool table
 			;   for inlined constants.
-   (VUNSPEC_POOL_END 3) ; `end-of-table'.  Used to mark the end of a minipool
+   VUNSPEC_POOL_END	; `end-of-table'.  Used to mark the end of a minipool
 			;   table.
-   (VUNSPEC_POOL_1   4) ; `pool-entry(1)'.  An entry in the constant pool for
+   VUNSPEC_POOL_1	; `pool-entry(1)'.  An entry in the constant pool for
 			;   an 8-bit object.
-   (VUNSPEC_POOL_2   5) ; `pool-entry(2)'.  An entry in the constant pool for
+   VUNSPEC_POOL_2	; `pool-entry(2)'.  An entry in the constant pool for
 			;   a 16-bit object.
-   (VUNSPEC_POOL_4   6) ; `pool-entry(4)'.  An entry in the constant pool for
+   VUNSPEC_POOL_4	; `pool-entry(4)'.  An entry in the constant pool for
 			;   a 32-bit object.
-   (VUNSPEC_POOL_8   7) ; `pool-entry(8)'.  An entry in the constant pool for
+   VUNSPEC_POOL_8	; `pool-entry(8)'.  An entry in the constant pool for
 			;   a 64-bit object.
-   (VUNSPEC_POOL_16  8) ; `pool-entry(16)'.  An entry in the constant pool for
+   VUNSPEC_POOL_16	; `pool-entry(16)'.  An entry in the constant pool for
 			;   a 128-bit object.
-   (VUNSPEC_TMRC     9) ; Used by the iWMMXt TMRC instruction.
-   (VUNSPEC_TMCR     10) ; Used by the iWMMXt TMCR instruction.
-   (VUNSPEC_ALIGN8   11) ; 8-byte alignment version of VUNSPEC_ALIGN
-   (VUNSPEC_WCMP_EQ  12) ; Used by the iWMMXt WCMPEQ instructions
-   (VUNSPEC_WCMP_GTU 13) ; Used by the iWMMXt WCMPGTU instructions
-   (VUNSPEC_WCMP_GT  14) ; Used by the iwMMXT WCMPGT instructions
-   (VUNSPEC_EH_RETURN 20); Use to override the return address for exception
-			 ; handling.
-   (VUNSPEC_SYNC_COMPARE_AND_SWAP 21)	; Represent an atomic compare swap.
-   (VUNSPEC_SYNC_LOCK             22)	; Represent a sync_lock_test_and_set.
-   (VUNSPEC_SYNC_OP               23)	; Represent a sync_<op>
-   (VUNSPEC_SYNC_NEW_OP           24)	; Represent a sync_new_<op>
-   (VUNSPEC_SYNC_OLD_OP           25)	; Represent a sync_old_<op>
+   VUNSPEC_TMRC		; Used by the iWMMXt TMRC instruction.
+   VUNSPEC_TMCR		; Used by the iWMMXt TMCR instruction.
+   VUNSPEC_ALIGN8	; 8-byte alignment version of VUNSPEC_ALIGN
+   VUNSPEC_WCMP_EQ	; Used by the iWMMXt WCMPEQ instructions
+   VUNSPEC_WCMP_GTU	; Used by the iWMMXt WCMPGTU instructions
+   VUNSPEC_WCMP_GT	; Used by the iwMMXT WCMPGT instructions
+   VUNSPEC_EH_RETURN	; Use to override the return address for exception
+			; handling.
   ]
 )
 
Index: gcc/config/arm/sync.md
===================================================================
--- gcc/config/arm/sync.md	2011-01-05 15:12:07.000000000 +0000
+++ gcc/config/arm/sync.md	2011-03-29 09:55:52.000000000 +0100
@@ -24,6 +24,15 @@ 
 ;; AND/OR sequences into the synchronization loop to mask out the
 ;; relevant component of an SI access.
 
+(define_c_enum "unspecv"
+  [VUNSPEC_SYNC_COMPARE_AND_SWAP ; Represent an atomic compare swap.
+   VUNSPEC_SYNC_LOCK		 ; Represent a sync_lock_test_and_set.
+   VUNSPEC_SYNC_OP		 ; Represent a sync_<op>
+   VUNSPEC_SYNC_NEW_OP		 ; Represent a sync_new_<op>
+   VUNSPEC_SYNC_OLD_OP		 ; Represent a sync_old_<op>
+  ]
+)
+
 (define_expand "memory_barrier"
   [(set (match_dup 0)
 	(unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BARRIER))]