cpu: Access src and dest reg indexes using a pointer to member.
authorGabe Black <gabe.black@gmail.com>
Sun, 1 Nov 2020 09:57:29 +0000 (01:57 -0800)
committerGabe Black <gabe.black@gmail.com>
Wed, 18 Nov 2020 11:52:24 +0000 (11:52 +0000)
commit9fc5344c0a82eb4f0cac3c06bfbd110759df6677
treefe9b795e4d585acf31272f54d69a4a92125f775a
parent95a8cf76a5e14fff3039cdd20bc76e8d1f81f833
cpu: Access src and dest reg indexes using a pointer to member.

This will eventually let subclasses provide their own appropriately
sized storage for these indexes. By using a pointer to member instead of
a regular pointer, we ensure that even if the StaticInst is copied/moved
somewhere, it will still find its indexes correctly, without any
additional performance overhead or maintenance.

Unfortunately C++ has decided that arrays with known bounds are not
convertible/compatible with arrays with unknown bounds. I've found at
least two standards proposals in various stages of acceptance which say
that that's dumb and they should change that (because it's dumb and they
should change that), but in the mean time we can get everything to
compile by using the reinterpret_cast hammer. While this is
*technically* undefined behavior, it's basically not and should be
pretty safe.

Change-Id: Id747b0cf68d1a0b4809ebb66a32472187110d7d8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/36876
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
src/cpu/static_inst.hh