-
- Downloads
Implement P0479R5, [[likely]] and [[unlikely]].
[[likely]] and [[unlikely]] are equivalent to the GNU hot/cold attributes, except that they can be applied to arbitrary statements as well as labels; this is most likely to be useful for marking if/else branches as likely or unlikely. Conveniently, PREDICT_EXPR fits the bill nicely as a representation. I also had to fix marking case labels as hot/cold, which didn't work before. Which then required me to force __attribute ((fallthrough)) to apply to the statement rather than the label. gcc/ * gimplify.c (gimplify_case_label_expr): Handle hot/cold attributes. gcc/c-family/ * c-lex.c (c_common_has_attribute): Handle likely/unlikely. * c-attribs.c (attr_cold_hot_exclusions): Make public. gcc/cp/ * tree.c (handle_likeliness_attribute): New. (std_attribute_table): Add likely/unlikely. * cp-gimplify.c (lookup_hotness_attribute, remove_hotness_attribute) (process_stmt_hotness_attribute, first_stmt): New. (genericize_if_stmt): Check for duplicate predictions. * parser.c (cp_parser_statement): Call process_stmt_hotness_attribute. (cp_parser_label_for_labeled_statement): Apply attributes to case. * decl.c (finish_case_label): Give label in template type void. * pt.c (tsubst_expr) [CASE_LABEL_EXPR]: Copy attributes. [PREDICT_EXPR]: Handle. From-SVN: r266223
Showing
- gcc/ChangeLog 4 additions, 0 deletionsgcc/ChangeLog
- gcc/c-family/ChangeLog 5 additions, 0 deletionsgcc/c-family/ChangeLog
- gcc/c-family/c-attribs.c 1 addition, 1 deletiongcc/c-family/c-attribs.c
- gcc/c-family/c-common.h 1 addition, 0 deletionsgcc/c-family/c-common.h
- gcc/c-family/c-lex.c 3 additions, 1 deletiongcc/c-family/c-lex.c
- gcc/cp/ChangeLog 15 additions, 0 deletionsgcc/cp/ChangeLog
- gcc/cp/cp-gimplify.c 93 additions, 0 deletionsgcc/cp/cp-gimplify.c
- gcc/cp/cp-tree.h 2 additions, 0 deletionsgcc/cp/cp-tree.h
- gcc/cp/decl.c 1 addition, 1 deletiongcc/cp/decl.c
- gcc/cp/parser.c 33 additions, 8 deletionsgcc/cp/parser.c
- gcc/cp/pt.c 10 additions, 2 deletionsgcc/cp/pt.c
- gcc/cp/tree.c 30 additions, 0 deletionsgcc/cp/tree.c
- gcc/gimplify.c 9 additions, 1 deletiongcc/gimplify.c
- gcc/testsuite/g++.dg/cpp2a/attr-likely1.C 38 additions, 0 deletionsgcc/testsuite/g++.dg/cpp2a/attr-likely1.C
- gcc/testsuite/g++.dg/cpp2a/attr-likely2.C 12 additions, 0 deletionsgcc/testsuite/g++.dg/cpp2a/attr-likely2.C
- gcc/testsuite/g++.dg/cpp2a/attr-likely3.C 8 additions, 0 deletionsgcc/testsuite/g++.dg/cpp2a/attr-likely3.C
- gcc/testsuite/g++.dg/cpp2a/attr-likely4.C 19 additions, 0 deletionsgcc/testsuite/g++.dg/cpp2a/attr-likely4.C
- gcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C 12 additions, 0 deletionsgcc/testsuite/g++.dg/cpp2a/feat-cxx2a.C
Loading
Please register or sign in to comment