diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-11-01 15:46:42 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-11-01 15:46:42 +0000 |
commit | ce12115844ef8f66a28205d1f1e81ea0ccc946b1 (patch) | |
tree | 1dba75c64dce051b6ee0933505d31b39046940fa /gcc/cp/cp-tree.h | |
parent | 4a110e3478460101b4c0d6591d7cdb0b1d3a276b (diff) | |
download | gcc-ce12115844ef8f66a28205d1f1e81ea0ccc946b1.zip gcc-ce12115844ef8f66a28205d1f1e81ea0ccc946b1.tar.gz gcc-ce12115844ef8f66a28205d1f1e81ea0ccc946b1.tar.bz2 |
[C++ PATCH] overloaded operator fns [6/N]
https://gcc.gnu.org/ml/gcc-patches/2017-11/msg00019.html
gcc/cp/
* cp-tree.h (assign_op_identifier, call_op_identifier): Use
compressed code.
(struct lang_decl_fn): Use compressed operator code.
(DECL_OVERLOADED_OPERATOR_CODE): Replace with ...
(DECL_OVERLOADED_OPERATOR_CODE_RAW): ... this.
(DECL_OVERLOADED_OPERATOR_CODE_IS): Use it.
* decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE_RAW.
(build_library_fn): Likewise.
(grok_op_properties): Likewise.
* mangle.c (write_unqualified_name): Likewise.
* method.c (implicitly_declare_fn): Likewise.
* typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_IS.
libcc1/
* libcp1plugin.cc (plugin_build_decl): Use
DECL_OVERLOADED_OPERATOR_CODE_RAW.
From-SVN: r254314
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 76ee854..d1d772f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -246,8 +246,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX]; #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER] #define ovl_op_identifier(ISASS, CODE) (OVL_OP_INFO(ISASS, CODE)->identifier) -#define assign_op_identifier (ovl_op_identifier (true, NOP_EXPR)) -#define call_op_identifier (ovl_op_identifier (false, CALL_EXPR)) +#define assign_op_identifier (ovl_op_info[true][OVL_OP_NOP_EXPR].identifier) +#define call_op_identifier (ovl_op_info[false][OVL_OP_CALL_EXPR].identifier) /* The name used for conversion operators -- but note that actual conversion functions use special identifiers outside the identifier table. */ @@ -2479,26 +2479,24 @@ struct GTY(()) lang_decl_min { struct GTY(()) lang_decl_fn { struct lang_decl_min min; - /* In an overloaded operator, this is the value of - DECL_OVERLOADED_OPERATOR_P. - FIXME: We should really do better in compressing this. */ - ENUM_BITFIELD (tree_code) operator_code : 16; - + /* In a overloaded operator, this is the compressed operator code. */ + unsigned ovl_op_code : 6; unsigned global_ctor_p : 1; unsigned global_dtor_p : 1; + unsigned static_function : 1; unsigned pure_virtual : 1; unsigned defaulted_p : 1; unsigned has_in_charge_parm_p : 1; unsigned has_vtt_parm_p : 1; unsigned pending_inline_p : 1; - unsigned nonconverting : 1; unsigned thunk_p : 1; + unsigned this_thunk_p : 1; unsigned hidden_friend_p : 1; unsigned omp_declare_reduction_p : 1; - /* 3 spare bits. */ + unsigned spare : 13; /* 32-bits padding on 64-bit host. */ @@ -2814,14 +2812,14 @@ struct GTY(()) lang_decl { IDENTIFIER_ASSIGN_OP_P (DECL_NAME (NODE)) /* NODE is a function_decl for an overloaded operator. Return its - operator code. */ -#define DECL_OVERLOADED_OPERATOR_CODE(NODE) \ - (LANG_DECL_FN_CHECK (NODE)->operator_code) + compressed (raw) operator code. Note that this is not a TREE_CODE. */ +#define DECL_OVERLOADED_OPERATOR_CODE_RAW(NODE) \ + (LANG_DECL_FN_CHECK (NODE)->ovl_op_code) /* DECL is an overloaded operator. Test whether it is for TREE_CODE (a literal constant). */ #define DECL_OVERLOADED_OPERATOR_IS(DECL, CODE) \ - (DECL_OVERLOADED_OPERATOR_CODE (DECL) == CODE) + (DECL_OVERLOADED_OPERATOR_CODE_RAW (DECL) == OVL_OP_##CODE) /* For FUNCTION_DECLs: nonzero means that this function is a constructor or a destructor with an extra in-charge parameter to @@ -5526,7 +5524,8 @@ extern GTY(()) unsigned char ovl_op_mapping[MAX_TREE_CODES]; extern GTY(()) unsigned char ovl_op_alternate[OVL_OP_MAX]; /* Given an ass_op_p boolean and a tree code, return a pointer to its - overloaded operator info. */ + overloaded operator info. Tree codes for non-overloaded operators + map to the error-operator. */ #define OVL_OP_INFO(IS_ASS_P, TREE_CODE) \ (&ovl_op_info[(IS_ASS_P) != 0][ovl_op_mapping[(TREE_CODE)]]) /* Overloaded operator info for an identifier for which |