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]

[CPP PATCH] node field bits


Last bit of cleanup in the preprocessor. We only need 2 bits to hold the node_type enumeration, and 8 bits for the flags.

That leaves several unused bits, which we may as well note.

nathan
--
Nathan Sidwell
2018-08-20  Nathan Sidwell  <nathan@acm.org>

	* include/cpplib.h: Fixup some whitespace.
	(cpp_hashnode): Reduce type to 2 bit & flags to 8.

Index: include/cpplib.h
===================================================================
--- include/cpplib.h	(revision 263667)
+++ include/cpplib.h	(working copy)
@@ -813,8 +813,10 @@ struct GTY(()) cpp_hashnode {
 					   then index into directive table.
 					   Otherwise, a NODE_OPERATOR.  */
   unsigned char rid_code;		/* Rid code - for front ends.  */
-  ENUM_BITFIELD(node_type) type : 6;	/* CPP node type.  */
-  unsigned int flags : 10;		/* CPP flags.  */
+  ENUM_BITFIELD(node_type) type : 2;	/* CPP node type.  */
+  unsigned int flags : 8;		/* CPP flags.  */
+
+  /* 6 bits spare (plus another 32 on 64-bit hosts).  */
 
   union _cpp_hashnode_value GTY ((desc ("%1.type"))) value;
 };
@@ -940,7 +942,6 @@ extern const cpp_token *cpp_get_token_wi
 inline bool cpp_user_macro_p (const cpp_hashnode *node)
 {
   return node->type == NT_USER_MACRO;
-
 }
 inline bool cpp_builtin_macro_p (const cpp_hashnode *node)
 {
@@ -950,6 +951,7 @@ inline bool cpp_macro_p (const cpp_hashn
 {
   return node->type & NT_MACRO_MASK;
 }
+
 /* Returns true if NODE is a function-like user macro.  */
 inline bool cpp_fun_like_macro_p (cpp_hashnode *node)
 {

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