[Bug c/38416] New: c-parser.c puts pragma_kind as a 7 bit field, when 8 will generate better code

gnu at the-meissners dot org gcc-bugzilla@gcc.gnu.org
Fri Dec 5 19:06:00 GMT 2008


I was modifying the named address support to add the named address keywords via
the C keyword tables rather than via a target hook, and I noticed the c_token
structure has pragma_kind as a 7 bit field.  All of the previous bit fields are
8 bits in size, and next field is a tree, so we are not saving any space by
declaring the field to be 7 bits instead of 8, which would allow byte
loads/stores to be used to access the field.  Here is the declaration.

typedef struct c_token GTY (())
{
  /* The kind of token.  */
  ENUM_BITFIELD (cpp_ttype) type : 8;
  /* If this token is a CPP_NAME, this value indicates whether also
     declared as some kind of type.  Otherwise, it is C_ID_NONE.  */
  ENUM_BITFIELD (c_id_kind) id_kind : 8;
  /* If this token is a keyword, this value indicates which keyword.
     Otherwise, this value is RID_MAX.  */
  ENUM_BITFIELD (rid) keyword : 8;
  /* If this token is a CPP_PRAGMA, this indicates the pragma that
     was seen.  Otherwise it is PRAGMA_NONE.  */
  ENUM_BITFIELD (pragma_kind) pragma_kind : 7;
  /* The value associated with this token, if any.  */
  tree value;
  /* The location at which this token was found.  */
  location_t location;
} c_token;


-- 
           Summary: c-parser.c puts pragma_kind as a 7 bit field, when 8
                    will generate better code
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gnu at the-meissners dot org
 GCC build triplet: x86_64-gnu-linux
  GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38416



More information about the Gcc-bugs mailing list