From: Alfie Richards <alfie.richa...@arm.com> Hi Joseph and all,
I worked through Josephs feedback, and as I fixed certain issues I came to the conclusion he was correct that a rethink was required. I reworked this to only have the one FMV binding for each function set which gets replaced with the dispatched symbol decl when the second target is processed. I prefer this code structure, and think it is far clearer to the reader to what was happening previously. I also added some more tests for more error situations in particular. This probably still has some rough edges, but I'm hoping its a better direction overall. Note, this does slightly change the interface for backend hooks. In particular it will require changing the assumptions for get_function_versions_dispatcher as it now can get called before all the functions have been processed in the C frontend (maybe without default). This shouldn't be a big deal but will require work in other backends if we want to enable this for them also. Kind regards, Alfie Richards Alfie Richards (1): C: Support Function multiversioning in the C front end gcc/attribs.cc | 21 ++- gcc/attribs.h | 3 +- gcc/c-family/c-gimplify.cc | 13 ++ gcc/c/c-decl.cc | 162 ++++++++++++++++-- gcc/calls.cc | 17 ++ gcc/calls.h | 2 + gcc/cgraph.cc | 61 ++++++- gcc/cgraphunit.cc | 23 +++ gcc/config/aarch64/aarch64.cc | 29 +--- .../g++.target/aarch64/mv-symbols10.C | 42 +++++ .../g++.target/aarch64/mv-symbols6.C | 16 ++ .../g++.target/aarch64/mv-symbols8.C | 47 +++++ .../g++.target/aarch64/mv-symbols9.C | 44 +++++ gcc/testsuite/gcc.target/aarch64/mv-1.c | 40 +++++ .../gcc.target/aarch64/mv-symbols-error1.c | 11 ++ .../gcc.target/aarch64/mv-symbols-error10.c | 11 ++ .../gcc.target/aarch64/mv-symbols-error2.c | 8 + .../gcc.target/aarch64/mv-symbols-error3.c | 8 + .../gcc.target/aarch64/mv-symbols-error4.c | 8 + .../gcc.target/aarch64/mv-symbols-error5.c | 11 ++ .../gcc.target/aarch64/mv-symbols-error6.c | 8 + .../gcc.target/aarch64/mv-symbols-error7.c | 12 ++ .../gcc.target/aarch64/mv-symbols-error8.c | 11 ++ .../gcc.target/aarch64/mv-symbols-error9.c | 10 ++ .../gcc.target/aarch64/mv-symbols1.c | 38 ++++ .../gcc.target/aarch64/mv-symbols10.c | 42 +++++ .../gcc.target/aarch64/mv-symbols11.c | 16 ++ .../gcc.target/aarch64/mv-symbols2.c | 28 +++ .../gcc.target/aarch64/mv-symbols3.c | 27 +++ .../gcc.target/aarch64/mv-symbols4.c | 31 ++++ .../gcc.target/aarch64/mv-symbols5.c | 36 ++++ .../gcc.target/aarch64/mv-symbols6.c | 16 ++ .../gcc.target/aarch64/mv-symbols7.c | 47 +++++ .../gcc.target/aarch64/mv-symbols8.c | 47 +++++ .../gcc.target/aarch64/mv-symbols9.c | 44 +++++ .../gcc.target/aarch64/mvc-symbols1.c | 25 +++ .../gcc.target/aarch64/mvc-symbols2.c | 15 ++ .../gcc.target/aarch64/mvc-symbols3.c | 19 ++ .../gcc.target/aarch64/mvc-symbols4.c | 12 ++ 39 files changed, 1011 insertions(+), 50 deletions(-) create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols10.C create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols6.C create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols8.C create mode 100644 gcc/testsuite/g++.target/aarch64/mv-symbols9.C create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error10.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols-error9.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols10.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols11.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols4.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols5.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols6.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols7.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols8.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mv-symbols9.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/mvc-symbols4.c -- 2.34.1