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( ...@@ -1400,10 +1400,6 @@ RegisterAllocationData::RegisterAllocationData(
debug_name_(debug_name), debug_name_(debug_name),
config_(config), config_(config),
phi_map_(allocation_zone()), 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_in_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()),
live_out_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()), live_out_sets_(code->InstructionBlockCount(), nullptr, allocation_zone()),
live_ranges_(code->VirtualRegisterCount() * 2, nullptr, live_ranges_(code->VirtualRegisterCount() * 2, nullptr,
...@@ -1418,10 +1414,6 @@ RegisterAllocationData::RegisterAllocationData( ...@@ -1418,10 +1414,6 @@ RegisterAllocationData::RegisterAllocationData(
assigned_double_registers_(nullptr), assigned_double_registers_(nullptr),
virtual_register_count_(code->VirtualRegisterCount()), virtual_register_count_(code->VirtualRegisterCount()),
preassigned_slot_ranges_(zone) { 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()) assigned_registers_ = new (code_zone())
BitVector(this->config()->num_general_registers(), code_zone()); BitVector(this->config()->num_general_registers(), code_zone());
assigned_double_registers_ = new (code_zone()) assigned_double_registers_ = new (code_zone())
...@@ -2616,7 +2608,7 @@ LinearScanAllocator::LinearScanAllocator(RegisterAllocationData* data, ...@@ -2616,7 +2608,7 @@ LinearScanAllocator::LinearScanAllocator(RegisterAllocationData* data,
inactive_live_ranges().reserve(8); inactive_live_ranges().reserve(8);
// TryAllocateFreeReg and AllocateBlockedReg assume this // TryAllocateFreeReg and AllocateBlockedReg assume this
// when allocating local arrays. // when allocating local arrays.
DCHECK(RegisterConfiguration::kMaxDoubleRegisters >= DCHECK(RegisterConfiguration::kMaxFPRegisters >=
this->data()->config()->num_general_registers()); this->data()->config()->num_general_registers());
} }
...@@ -2813,7 +2805,7 @@ void LinearScanAllocator::InactiveToActive(LiveRange* range) { ...@@ -2813,7 +2805,7 @@ void LinearScanAllocator::InactiveToActive(LiveRange* range) {
bool LinearScanAllocator::TryAllocateFreeReg(LiveRange* current) { 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++) { for (int i = 0; i < num_registers(); i++) {
free_until_pos[i] = LifetimePosition::MaxPosition(); free_until_pos[i] = LifetimePosition::MaxPosition();
...@@ -2899,8 +2891,8 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) { ...@@ -2899,8 +2891,8 @@ void LinearScanAllocator::AllocateBlockedReg(LiveRange* current) {
return; return;
} }
LifetimePosition use_pos[RegisterConfiguration::kMaxDoubleRegisters]; LifetimePosition use_pos[RegisterConfiguration::kMaxFPRegisters];
LifetimePosition block_pos[RegisterConfiguration::kMaxDoubleRegisters]; LifetimePosition block_pos[RegisterConfiguration::kMaxFPRegisters];
for (int i = 0; i < num_registers(); i++) { for (int i = 0; i < num_registers(); i++) {
use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition(); use_pos[i] = block_pos[i] = LifetimePosition::MaxPosition();
......
...@@ -246,11 +246,9 @@ enum class UsePositionHintType : uint8_t { ...@@ -246,11 +246,9 @@ enum class UsePositionHintType : uint8_t {
static const int32_t kUnassignedRegister = static const int32_t kUnassignedRegister =
RegisterConfiguration::kMaxGeneralRegisters; RegisterConfiguration::kMaxGeneralRegisters;
static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxFPRegisters,
static_assert(kUnassignedRegister <= RegisterConfiguration::kMaxDoubleRegisters,
"kUnassignedRegister too small"); "kUnassignedRegister too small");
// Representation of a use position. // Representation of a use position.
class UsePosition final : public ZoneObject { class UsePosition final : public ZoneObject {
public: public:
...@@ -859,8 +857,6 @@ class RegisterAllocationData final : public ZoneObject { ...@@ -859,8 +857,6 @@ class RegisterAllocationData final : public ZoneObject {
const char* const debug_name_; const char* const debug_name_;
const RegisterConfiguration* const config_; const RegisterConfiguration* const config_;
PhiMap phi_map_; PhiMap phi_map_;
ZoneVector<int> allocatable_codes_;
ZoneVector<int> allocatable_double_codes_;
ZoneVector<BitVector*> live_in_sets_; ZoneVector<BitVector*> live_in_sets_;
ZoneVector<BitVector*> live_out_sets_; ZoneVector<BitVector*> live_out_sets_;
ZoneVector<TopLevelLiveRange*> live_ranges_; ZoneVector<TopLevelLiveRange*> live_ranges_;
......
...@@ -41,7 +41,7 @@ static const char* const kDoubleRegisterNames[] = { ...@@ -41,7 +41,7 @@ static const char* const kDoubleRegisterNames[] = {
STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >= STATIC_ASSERT(RegisterConfiguration::kMaxGeneralRegisters >=
Register::kNumRegisters); Register::kNumRegisters);
STATIC_ASSERT(RegisterConfiguration::kMaxDoubleRegisters >= STATIC_ASSERT(RegisterConfiguration::kMaxFPRegisters >=
DoubleRegister::kMaxNumRegisters); DoubleRegister::kMaxNumRegisters);
class ArchDefaultRegisterConfiguration : public RegisterConfiguration { class ArchDefaultRegisterConfiguration : public RegisterConfiguration {
...@@ -152,6 +152,8 @@ RegisterConfiguration::RegisterConfiguration( ...@@ -152,6 +152,8 @@ RegisterConfiguration::RegisterConfiguration(
allocatable_double_codes_(allocatable_double_codes), allocatable_double_codes_(allocatable_double_codes),
general_register_names_(general_register_names), general_register_names_(general_register_names),
double_register_names_(double_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) { for (int i = 0; i < num_allocatable_general_registers_; ++i) {
allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]); allocatable_general_codes_mask_ |= (1 << allocatable_general_codes_[i]);
} }
......
...@@ -23,7 +23,7 @@ class RegisterConfiguration { ...@@ -23,7 +23,7 @@ class RegisterConfiguration {
// Architecture independent maxes. // Architecture independent maxes.
static const int kMaxGeneralRegisters = 32; static const int kMaxGeneralRegisters = 32;
static const int kMaxDoubleRegisters = 32; static const int kMaxFPRegisters = 32;
static const RegisterConfiguration* ArchDefault(CompilerSelector compiler); static const RegisterConfiguration* ArchDefault(CompilerSelector compiler);
......
...@@ -15,10 +15,9 @@ namespace compiler { ...@@ -15,10 +15,9 @@ namespace compiler {
static const char* static const char*
general_register_names_[RegisterConfiguration::kMaxGeneralRegisters]; general_register_names_[RegisterConfiguration::kMaxGeneralRegisters];
static const char* static const char*
double_register_names_[RegisterConfiguration::kMaxDoubleRegisters]; double_register_names_[RegisterConfiguration::kMaxFPRegisters];
static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters + static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters +
RegisterConfiguration::kMaxDoubleRegisters)]; RegisterConfiguration::kMaxFPRegisters)];
namespace { namespace {
static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = { static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = {
...@@ -35,7 +34,7 @@ static void InitializeRegisterNames() { ...@@ -35,7 +34,7 @@ static void InitializeRegisterNames() {
loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); loc += base::OS::SNPrintF(loc, 100, "gp_%d", i);
*loc++ = 0; *loc++ = 0;
} }
for (int i = 0; i < RegisterConfiguration::kMaxDoubleRegisters; ++i) { for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) {
double_register_names_[i] = loc; double_register_names_[i] = loc;
loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1;
*loc++ = 0; *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