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 to use strchr for IS_EXPR_CODE_CLASS


I noticed this idea in a prototype patch of rth's that was never checked
in.  It seemed like a good idea, so I gave it a spin.  In my informal
testing, it seems to reduce 'user' time in a make bootstrap by 4%, though
it has no effect on testing time.  That seems too much of an improvement to
believe, but I think we can be confident that it doesn't slow things down.
:)

The EXPR_P macro is the missing sibling of DECL_P and TYPE_P which we
already had.

Tested x86_64-pc-linux-gnu, applied to trunk.

2003-10-21  Jason Merrill  <jason@redhat.com>

	* tree.h (IS_EXPR_CODE_CLASS): Use strchr.
	(EXPR_P): New macro.

*** tree.h.~1~	2003-10-20 14:47:12.000000000 -0400
--- tree.h	2003-10-21 17:52:32.000000000 -0400
*************** extern const char tree_code_type[];
*** 56,64 ****
  /* Returns nonzero iff CLASS is the tree-code class of an
     expression.  */
  
! #define IS_EXPR_CODE_CLASS(CLASS) \
!   ((CLASS) == '<' || (CLASS) == '1' || (CLASS) == '2' || (CLASS) == 'e' \
!    || (CLASS) == 'r' || (CLASS) == 's')
  
  /* Number of argument-words in each kind of tree-node.  */
  
--- 56,66 ----
  /* Returns nonzero iff CLASS is the tree-code class of an
     expression.  */
  
! #define IS_EXPR_CODE_CLASS(CLASS) (strchr ("<12ers", (CLASS)) != 0)
! 
! /* Returns nonzero iff NODE is an expression of some kind.  */
! 
! #define EXPR_P(NODE) IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE)))
  
  /* Number of argument-words in each kind of tree-node.  */
  

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