Commit d565ba8f authored by bbudge's avatar bbudge Committed by Commit bot

RegisterAllocator: Clean up before adding aliasing.

Remove some unused fields in RegisterAllocationData.
Move some DCHECKS about configuration constraints.
Rename kMaxDoubleRegisters -> kMaxFPRegisters

LOG=N
BUG=v8:4124

Review URL: https://codereview.chromium.org/1518573002

Cr-Commit-Position: refs/heads/master@{#35777}
parent 612368b8
......@@ -1400,10 +1400,6 @@ RegisterAllocationData::RegisterAllocationData(
debug_name_(debug_name),
config_(config),
phi_map_(allocation_zone()),
allocatable_codes_(this->config()->num_general_registers(), -1,
allocation_zone()),
allocatable_double_codes_(this->config()->num_double_registers(), -1,
allocation_zone()),
live_in_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()),
live_out_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()),
live_ranges_(code->VirtualRegisterCount() * 2, nullptr,
......@@ -1418,10 +1414,6 @@ RegisterAllocationData::RegisterAllocationData(
assigned_double_registers_(nullptr),
virtual_register_count_(code->VirtualRegisterCount()),
preassigned_slot_ranges_(zone) {
DCHECK(this->config()->num_general_registers() <=
RegisterConfiguration::kMaxGeneralRegisters);
DCHECK(this->config()->num_double_registers() <=
RegisterConfiguration::kMaxDoubleRegisters);
assigned_registers_ = new (code_zone())
BitVector(this->config()->num_general_registers(), code_zone());
assigned_double_registers_ = new (code_zone())
......@@ -2616,7 +2608,7 @@ LinearScanAllocator::LinearScanAllocator(RegisterAllocationData* data,
inactive_live_ranges().reserve(8);
// TryAllocateFreeReg and AllocateBlockedReg assume this
// when allocating local arrays.
DCHECK(RegisterConfiguration::kMaxDoubleRegisters >=
DCHECK(RegisterConfiguration::kMaxFPRegisters >=
this->data()->config()->num_general_registers());
}
......@@ -2813,7 +2805,7 @@ void LinearScanAllocator::InactiveToActive(LiveRange* range) {
bool LinearScanAllocator::TryAllocateFreeReg(LiveRange* current) {
LifetimePosition free_until_pos[RegisterConfiguration::kMaxDoubleRegisters];
LifetimePosition free_until_pos[RegisterConfiguration::kMaxFPRegisters];
for (int i = 0; i < num_registers(); i++) {
free_until_pos[i] = LifetimePosition::MaxPosition();
......@@ -2899,8 +2891,8 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
return;
}
LifetimePosition use_pos[RegisterConfiguration::kMaxDoubleRegisters];
LifetimePosition block_pos[RegisterConfiguration::kMaxDoubleRegisters];
LifetimePosition use_pos[RegisterConfiguration::kMaxFPRegisters];
LifetimePosition block_pos[RegisterConfiguration::kMaxFPRegisters];
for (int i = 0; i < num_registers(); i++) {
use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
......
......@@ -246,11 +246,9 @@ enum class UsePositionHintType : uint8_t {
static const int32_t kUnassignedRegister =
RegisterConfiguration::kMaxGeneralRegisters;
static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxDoubleRegisters,
static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxFPRegisters,
"kUnassignedRegister too small");
// Representation of a use position.
class UsePosition final : public ZoneObject {
public:
......@@ -859,8 +857,6 @@ class RegisterAllocationData final : public ZoneObject {
const char* const debug_name_;
const RegisterConfiguration* const config_;
PhiMap phi_map_;
ZoneVector<int> allocatable_codes_;
ZoneVector<int> allocatable_double_codes_;
ZoneVector<BitVector*> live_in_sets_;
ZoneVector<BitVector*> live_out_sets_;
ZoneVector<TopLevelLiveRange*> live_ranges_;
......
......@@ -41,7 +41,7 @@ static const char* const kDoubleRegisterNames[] = {
STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >=
Register::kNumRegisters);
STATIC_ASSERT(RegisterConfiguration::kMaxDoubleRegisters >=
STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >=
DoubleRegister::kMaxNumRegisters);
class ArchDefaultRegisterConfiguration : public RegisterConfiguration {
......@@ -152,6 +152,8 @@ RegisterConfiguration::RegisterConfiguration(
allocatable_double_codes_(allocatable_double_codes),
general_register_names_(general_register_names),
double_register_names_(double_register_names) {
DCHECK(num_general_registers_ <= RegisterConfiguration::kMaxGeneralRegisters);
DCHECK(num_double_registers_ <= RegisterConfiguration::kMaxFPRegisters);
for (int i = 0; i < num_allocatable_general_registers_; ++i) {
allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]);
}
......
......@@ -23,7 +23,7 @@ class RegisterConfiguration {
// Architecture independent maxes.
static const int kMaxGeneralRegisters = 32;
static const int kMaxDoubleRegisters = 32;
static const int kMaxFPRegisters = 32;
static const RegisterConfiguration* ArchDefault(CompilerSelector compiler);
......
......@@ -15,10 +15,9 @@ namespace compiler {
static const char*
general_register_names_[RegisterConfiguration::kMaxGeneralRegisters];
static const char*
double_register_names_[RegisterConfiguration::kMaxDoubleRegisters];
double_register_names_[RegisterConfiguration::kMaxFPRegisters];
static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters +
RegisterConfiguration::kMaxDoubleRegisters)];
RegisterConfiguration::kMaxFPRegisters)];
namespace {
static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = {
......@@ -35,7 +34,7 @@ static void InitializeRegisterNames() {
loc += base::OS::SNPrintF(loc, 100, "gp_%d", i);
*loc++ = 0;
}
for (int i = 0; i < RegisterConfiguration::kMaxDoubleRegisters; ++i) {
for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) {
double_register_names_[i] = loc;
loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1;
*loc++ = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment