[regalloc] Cleanup use of kMaxFpRegisters
Minor refactoring to introduce kMaxRegisters instead of relying on the fact that kMaxGpRegisters <= kMaxFpRegisters. Bug: v8:8562 Change-Id: If8221a799199c62d5262cfad762489a5088351c7 Reviewed-on: https://chromium-review.googlesource.com/c/1403120 Reviewed-by: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Commit-Queue: Stephan Herhut <herhut@chromium.org> Cr-Commit-Position: refs/heads/master@{#58687}
This commit is contained in:
parent
d3f07e0018
commit
ba56d28251
@ -2806,10 +2806,6 @@ LinearScanAllocator::LinearScanAllocator(RegisterAllocationData* data,
|
|||||||
next_inactive_ranges_change_(LifetimePosition::Invalid()) {
|
next_inactive_ranges_change_(LifetimePosition::Invalid()) {
|
||||||
active_live_ranges().reserve(8);
|
active_live_ranges().reserve(8);
|
||||||
inactive_live_ranges().reserve(8);
|
inactive_live_ranges().reserve(8);
|
||||||
// TryAllocateFreeReg and AllocateBlockedReg assume this
|
|
||||||
// when allocating local arrays.
|
|
||||||
DCHECK_GE(RegisterConfiguration::kMaxFPRegisters,
|
|
||||||
this->data()->config()->num_general_registers());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinearScanAllocator::AllocateRegisters() {
|
void LinearScanAllocator::AllocateRegisters() {
|
||||||
@ -3121,9 +3117,8 @@ void LinearScanAllocator::FindFreeRegistersForRange(
|
|||||||
// - a phi. The same analysis as in the case of the input constraint applies.
|
// - a phi. The same analysis as in the case of the input constraint applies.
|
||||||
//
|
//
|
||||||
void LinearScanAllocator::ProcessCurrentRange(LiveRange* current) {
|
void LinearScanAllocator::ProcessCurrentRange(LiveRange* current) {
|
||||||
LifetimePosition free_until_pos_buff[RegisterConfiguration::kMaxFPRegisters];
|
EmbeddedVector<LifetimePosition, RegisterConfiguration::kMaxRegisters>
|
||||||
Vector<LifetimePosition> free_until_pos(
|
free_until_pos;
|
||||||
free_until_pos_buff, RegisterConfiguration::kMaxFPRegisters);
|
|
||||||
FindFreeRegistersForRange(current, free_until_pos);
|
FindFreeRegistersForRange(current, free_until_pos);
|
||||||
if (!TryAllocatePreferredReg(current, free_until_pos)) {
|
if (!TryAllocatePreferredReg(current, free_until_pos)) {
|
||||||
if (current->TopLevel()->IsSplinter()) {
|
if (current->TopLevel()->IsSplinter()) {
|
||||||
@ -3245,8 +3240,8 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
|
|||||||
// use_pos keeps track of positions a register/alias is used at.
|
// use_pos keeps track of positions a register/alias is used at.
|
||||||
// block_pos keeps track of positions where a register/alias is blocked
|
// block_pos keeps track of positions where a register/alias is blocked
|
||||||
// from.
|
// from.
|
||||||
LifetimePosition use_pos[RegisterConfiguration::kMaxFPRegisters];
|
LifetimePosition use_pos[RegisterConfiguration::kMaxRegisters];
|
||||||
LifetimePosition block_pos[RegisterConfiguration::kMaxFPRegisters];
|
LifetimePosition block_pos[RegisterConfiguration::kMaxRegisters];
|
||||||
for (int i = 0; i < num_regs; i++) {
|
for (int i = 0; i < num_regs; i++) {
|
||||||
use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
|
use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
|
||||||
}
|
}
|
||||||
|
@ -242,11 +242,7 @@ enum class UsePositionHintType : uint8_t {
|
|||||||
kUnresolved
|
kUnresolved
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int32_t kUnassignedRegister =
|
static const int32_t kUnassignedRegister = RegisterConfiguration::kMaxRegisters;
|
||||||
RegisterConfiguration::kMaxGeneralRegisters;
|
|
||||||
|
|
||||||
static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxFPRegisters,
|
|
||||||
"kUnassignedRegister too small");
|
|
||||||
|
|
||||||
// Representation of a use position.
|
// Representation of a use position.
|
||||||
class V8_EXPORT_PRIVATE UsePosition final
|
class V8_EXPORT_PRIVATE UsePosition final
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "src/globals.h"
|
#include "src/globals.h"
|
||||||
#include "src/machine-type.h"
|
#include "src/machine-type.h"
|
||||||
#include "src/reglist.h"
|
#include "src/reglist.h"
|
||||||
|
#include "src/utils.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -25,8 +26,10 @@ class V8_EXPORT_PRIVATE RegisterConfiguration {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Architecture independent maxes.
|
// Architecture independent maxes.
|
||||||
static const int kMaxGeneralRegisters = 32;
|
static constexpr int kMaxGeneralRegisters = 32;
|
||||||
static const int kMaxFPRegisters = 32;
|
static constexpr int kMaxFPRegisters = 32;
|
||||||
|
static constexpr int kMaxRegisters =
|
||||||
|
Max(kMaxFPRegisters, kMaxGeneralRegisters);
|
||||||
|
|
||||||
// Default RegisterConfigurations for the target architecture.
|
// Default RegisterConfigurations for the target architecture.
|
||||||
static const RegisterConfiguration* Default();
|
static const RegisterConfiguration* Default();
|
||||||
|
Loading…
Reference in New Issue
Block a user