Add a few RTL predicates

Steven Bosscher stevenb@suse.de
Thu Jun 10 23:48:00 GMT 2004


Hi,

The new predicates will be used soon, when we start
substituting them for the compares.
Can we consider patches that only replace explicit
compares with predicates as pre-approved?

The redefinition of INSN_P is a marginal speed-up.

Gr.
Steven

-------------- next part --------------
	* rtl.h (MEM_P, NONJUMP_INSN_P, CALL_INSN_P): New predicates.
	(INSN_P): Don't look at the rtx code class, just explicitly
	check for one of the tree RTX_INSN codes.

Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.362.2.46
diff -c -3 -p -r1.362.2.46 rtl.h
*** rtl.h	29 Apr 2004 19:44:31 -0000	1.362.2.46
--- rtl.h	9 May 2004 21:21:47 -0000
*************** struct rtvec_def GTY(()) {
*** 311,325 ****
  #define GET_NUM_ELEM(RTVEC)		((RTVEC)->num_elem)
  #define PUT_NUM_ELEM(RTVEC, NUM)	((RTVEC)->num_elem = (NUM))
  
! /* Predicate yielding nonzero iff X is an rtl for a register.  */
  #define REG_P(X) (GET_CODE (X) == REG)
  
  /* Predicate yielding nonzero iff X is a label insn.  */
  #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
  
  /* Predicate yielding nonzero iff X is a jump insn.  */
  #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
  
  /* Predicate yielding nonzero iff X is a note insn.  */
  #define NOTE_P(X) (GET_CODE (X) == NOTE)
  
--- 305,332 ----
  #define GET_NUM_ELEM(RTVEC)		((RTVEC)->num_elem)
  #define PUT_NUM_ELEM(RTVEC, NUM)	((RTVEC)->num_elem = (NUM))
  
! /* Predicate yielding nonzero iff X is an rtx for a register.  */
  #define REG_P(X) (GET_CODE (X) == REG)
  
+ /* Predicate yielding nonzero iff X is an rtx for a memory location.  */
+ #define MEM_P(X) (GET_CODE (X) == MEM)
+ 
  /* Predicate yielding nonzero iff X is a label insn.  */
  #define LABEL_P(X) (GET_CODE (X) == CODE_LABEL)
  
  /* Predicate yielding nonzero iff X is a jump insn.  */
  #define JUMP_P(X) (GET_CODE (X) == JUMP_INSN)
  
+ /* Predicate yielding nonzero iff X is a call insn.  */
+ #define CALL_P(X) (GET_CODE (X) == CALL_INSN)
+ 
+ /* Predicate yielding nonzero iff X is an insn that cannot jump.  */
+ #define NONJUMP_INSN_P(X) (GET_CODE (X) == INSN)
+ 
+ /* Predicate yielding nonzero iff X is a real insn.  */
+ #define INSN_P(X) \
+   (NONJUMP_INSN_P (X) || JUMP_P (X) || CALL_P (X))
+ 
  /* Predicate yielding nonzero iff X is a note insn.  */
  #define NOTE_P(X) (GET_CODE (X) == NOTE)
  
*************** struct rtvec_def GTY(()) {
*** 330,340 ****
  #define JUMP_TABLE_DATA_P(INSN) \
    (JUMP_P (INSN) && (GET_CODE (PATTERN (INSN)) == ADDR_VEC || \
  		     GET_CODE (PATTERN (INSN)) == ADDR_DIFF_VEC))
- 
- 
- /* 1 if X is an insn.  */
- #define INSN_P(X)    \
-   (GET_RTX_CLASS (GET_CODE(X)) == RTX_INSN)
  
  /* 1 if X is a unary operator.  */
  
--- 337,342 ----


More information about the Gcc-patches mailing list