[liftoff] Minor fix to RegClass definition

It would be nice if unused {RegClass}es just equal {kNoReg} on all
platforms.
This CL adds the static asserts for that, and slightly modifies the
definition of the {RegClass} enum to fulfil that. Interestingly, this
only changes the values for the one configuration that is currently
unused :)

R=zhin@chromium.org

Change-Id: Ib1b2a663183ad34822f514d6168c65450c1d7f2e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1975753
Reviewed-by: Zhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65527}
This commit is contained in:
Clemens Backes 2019-12-19 12:23:32 +01:00 committed by Commit Bot
parent 5a2992753e
commit 36b6649878

View File

@ -22,15 +22,15 @@ static constexpr bool kNeedS128RegPair = !kSimpleFPAliasing;
enum RegClass : uint8_t {
kGpReg,
kFpReg,
kGpRegPair,
kFpRegPair = kGpRegPair + kNeedI64RegPair,
kGpRegPair = kFpReg + 1 + (kNeedS128RegPair && !kNeedI64RegPair),
kFpRegPair = kFpReg + 1 + kNeedI64RegPair,
kNoReg = kFpRegPair + kNeedS128RegPair,
// +------------------+-------------------------------+
// | | kNeedI64RegPair |
// +------------------+---------------+---------------+
// | kNeedS128RegPair | true | false |
// +------------------+---------------+---------------+
// | true | 0,1,2,3,4 (a) | 0,1,2,2,3 |
// | true | 0,1,2,3,4 (a) | 0,1,3,2,3 |
// | false | 0,1,2,3,3 (b) | 0,1,2,2,2 (c) |
// +------------------+---------------+---------------+
// (a) arm
@ -38,6 +38,11 @@ enum RegClass : uint8_t {
// (c) x64, arm64
};
static_assert(kNeedI64RegPair == (kGpRegPair != kNoReg),
"kGpRegPair equals kNoReg if unused");
static_assert(kNeedS128RegPair == (kFpRegPair != kNoReg),
"kFpRegPair equals kNoReg if unused");
enum RegPairHalf : uint8_t { kLowWord = 0, kHighWord = 1 };
static inline constexpr bool needs_reg_pair(ValueType type) {