From: Arsen Arsenović <[email protected]> Hi!
This patch implements the refactor discussed in https://inbox.sourceware.org/gcc/[email protected]/ for all the frontends and backends. No functional changes intended. A few points of note: 1. The C FE could undergo a process of "modernization" to remove the places where it implements qualifier joins/merges ad-hocly. I decided to leave this aside for now. 2. I decided to make qualifier_set a struct after all. In most cases, it should be easy to remove all of the potential overhead that entails, which is limited to just the 32-bit targets anyway, AFAICT (it is trivially copyable and destructible, and it is 2 chars long, so it should be passed by registers on many ABIs). 3. Due to cp_declarator, I had to make qualifier_set trivially default-constructible (or, alternatively, add a constructor to cp_declarator). This means it is slightly easier to misuse (because 'qualifier_set foo;' is uninitialized). 4. I didn't remove the Rust copies of expected/optional.h, as that broke compilation a good bit. Also, the Rust versions use rust_assert, the new GCC one of course does not. It'd be good to remove the former. 5. I've added a new union operation besides the 'merge' one discussed in the previous email. Merging two qualifier sets produces a qualifier set that can be used in place of both. The new operation ended up being called 'join', and it simply produces a qualifier set containing the qualifiers of both by simple syntactic concatenation. 6. Making the distinction above also made it quite clear what needs to be done about the atomic qualifier. For join, it is OK for one QS to have _Atomic but not the other; for merge, it is not. The C++ Named Address Space implementation benefited greatly from this patch (the changes here turned a number of bugs in that patch into compile errors). I will send it soon (I want to write more target-independent self-tests for it first). The reason the CC list is so long is because this patch touches multiple backends and nearly all frontends. Luckily, most of the changes are mechanical, so, hopefully it shouldn't be difficult to review. Reg-strapped on x86_64-linux-gnu, powerpc64le-linux-gnu. Build-tested for rl78-elf. Will be regression tested soon for amdgcn-amdhsa and (reg-strapped) for s390x-ibm-linux-gnu. (these are slower) OK for trunk? Assuming those tests find no bugs, of course. TIA, have a lovely day! Arsen Arsenović (2): gcc: copy expected and optional out of rust/utils gcc: stop using 'int' to represent sets of qualifiers gcc/ada/gcc-interface/decl.cc | 15 +- gcc/ada/gcc-interface/gigi.h | 14 +- gcc/ada/gcc-interface/utils.cc | 3 +- gcc/attribs.cc | 9 +- gcc/attribs.h | 2 +- gcc/c-family/c-ada-spec.cc | 6 +- gcc/c-family/c-common.cc | 18 +- gcc/c-family/c-common.h | 8 +- gcc/c-family/c-format.cc | 2 +- gcc/c-family/c-pretty-print.cc | 9 +- gcc/c-family/c-pretty-print.h | 2 +- gcc/c/c-aux-info.cc | 2 +- gcc/c/c-decl.cc | 144 +- gcc/c/c-objc-common.cc | 4 +- gcc/c/c-parser.cc | 16 +- gcc/c/c-tree.h | 6 +- gcc/c/c-typeck.cc | 108 +- gcc/config/gcn/gcn-tree.cc | 11 +- gcc/config/i386/i386-builtins.cc | 2 +- gcc/config/i386/i386.cc | 2 +- gcc/config/rl78/rl78.cc | 2 +- gcc/config/rs6000/rs6000-c.cc | 6 +- gcc/config/rs6000/rs6000.cc | 2 +- gcc/config/s390/s390-c.cc | 6 +- gcc/coretypes.h | 2 +- gcc/cp/call.cc | 8 +- gcc/cp/class.cc | 2 +- gcc/cp/cp-objcp-common.h | 5 +- gcc/cp/cp-tree.h | 12 +- gcc/cp/decl.cc | 12 +- gcc/cp/error.cc | 2 +- gcc/cp/mangle.cc | 7 +- gcc/cp/method.cc | 32 +- gcc/cp/module.cc | 3 +- gcc/cp/pt.cc | 11 +- gcc/cp/reflect.cc | 12 +- gcc/cp/semantics.cc | 4 +- gcc/cp/tree.cc | 34 +- gcc/cp/typeck.cc | 42 +- gcc/d/d-codegen.cc | 2 +- gcc/d/types.cc | 2 +- gcc/dwarf2out.cc | 46 +- gcc/fold-const.cc | 2 +- gcc/fortran/trans-openmp.cc | 2 +- gcc/fortran/trans-types.cc | 3 +- gcc/gimple-lower-bitint.cc | 21 +- gcc/gimplify.cc | 13 +- gcc/ipa-free-lang-data.cc | 5 +- gcc/jit/dummy-frontend.cc | 2 +- gcc/langhooks-def.h | 2 +- gcc/langhooks.cc | 2 +- gcc/langhooks.h | 5 +- gcc/objc/objc-act.cc | 6 +- gcc/omp-low.cc | 4 +- gcc/omp-oacc-neuter-broadcast.cc | 4 +- gcc/omp-offload.cc | 21 +- gcc/rust/backend/rust-tree.cc | 35 +- gcc/rust/backend/rust-tree.h | 10 +- gcc/tree-core.h | 68 +- gcc/tree-dump.cc | 7 +- gcc/tree-inline.cc | 4 +- gcc/tree-pretty-print.cc | 14 +- gcc/tree-profile.cc | 2 +- gcc/tree-sra.cc | 3 +- gcc/tree-ssa-address.cc | 3 +- gcc/tree-switch-conversion.cc | 3 +- gcc/tree-vect-stmts.cc | 3 +- gcc/tree.cc | 149 +- gcc/tree.h | 322 +++- gcc/ubsan.cc | 4 +- gcc/util/expected.h | 2439 ++++++++++++++++++++++++++++++ gcc/util/expected_fwd.h | 24 + gcc/util/optional.h | 2131 ++++++++++++++++++++++++++ gcc/util/optional_fwd.h | 24 + gcc/vtable-verify.cc | 10 +- libcc1/libcc1plugin.cc | 2 +- libcc1/libcp1plugin.cc | 4 +- 77 files changed, 5569 insertions(+), 421 deletions(-) create mode 100644 gcc/util/expected.h create mode 100644 gcc/util/expected_fwd.h create mode 100644 gcc/util/optional.h create mode 100644 gcc/util/optional_fwd.h -- 2.54.0
