arch: Convert the static constexpr SIZE in vec_reg to a function.
authorGabe Black <gabeblack@google.com>
Sat, 1 Feb 2020 00:57:36 +0000 (16:57 -0800)
committerGabe Black <gabeblack@google.com>
Thu, 20 Feb 2020 23:13:00 +0000 (23:13 +0000)
commite883a6c9708739e33a66333fed4250042008da76
tree2ba20802f0358cdc4269f78a6405985fc0d15093
parent90cf2463aa3a087b4a621627f05191468eac5897
arch: Convert the static constexpr SIZE in vec_reg to a function.

When defining a static constexpr variable in C++11, it is still
required to have a separate definition someplace, something that can
be particularly problematic in template classes. C++17 fixes this
problem by adding inline variables which don't, but in the mean time
having a static constexpr value with no backing store will, if the
compiler decides to not fold away the storage location, cause linking
errors.

This happened to me when trying to build the debug build of ARM just
now.

By turning these expressions into static inline functions, then they
no longer need definitions elsewhere, still fold away to nothing, and
are compliant with C++11 which is currently the standard gem5 expects
to be using.

Change-Id: I647d7cf4a1e8de98251ee9ef116f007e08eac1f3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24964
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chun-Chen TK Hsu <chunchenhsu@google.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
src/arch/arm/fastmodel/iris/thread_context.cc
src/arch/generic/vec_reg.hh