Commit 5e28bf7b authored by bbudge's avatar bbudge Committed by Commit bot

Turbofan: Rename register allocator double phase.

The double register phase will eventually handle single, double, and
SIMD registers. Change enum and class names to reflect this.

LOG=N
BUG=v8:4124

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

Cr-Commit-Position: refs/heads/master@{#35801}
parent b1ec4cb6
...@@ -555,7 +555,7 @@ void GraphC1Visualizer::PrintLiveRange(const LiveRange* range, const char* type, ...@@ -555,7 +555,7 @@ void GraphC1Visualizer::PrintLiveRange(const LiveRange* range, const char* type,
<< "\""; << "\"";
} else { } else {
index = AllocatedOperand::cast(top->GetSpillOperand())->index(); index = AllocatedOperand::cast(top->GetSpillOperand())->index();
if (top->kind() == DOUBLE_REGISTERS) { if (top->kind() == FP_REGISTERS) {
os_ << " \"double_stack:" << index << "\""; os_ << " \"double_stack:" << index << "\"";
} else if (top->kind() == GENERAL_REGISTERS) { } else if (top->kind() == GENERAL_REGISTERS) {
os_ << " \"stack:" << index << "\""; os_ << " \"stack:" << index << "\"";
......
...@@ -971,13 +971,14 @@ struct AllocateGeneralRegistersPhase { ...@@ -971,13 +971,14 @@ struct AllocateGeneralRegistersPhase {
} }
}; };
template <typename RegAllocator> template <typename RegAllocator>
struct AllocateDoubleRegistersPhase { struct AllocateFPRegistersPhase {
static const char* phase_name() { return "allocate double registers"; } static const char* phase_name() {
return "allocate floating point registers";
}
void Run(PipelineData* data, Zone* temp_zone) { void Run(PipelineData* data, Zone* temp_zone) {
RegAllocator allocator(data->register_allocation_data(), DOUBLE_REGISTERS, RegAllocator allocator(data->register_allocation_data(), FP_REGISTERS,
temp_zone); temp_zone);
allocator.AllocateRegisters(); allocator.AllocateRegisters();
} }
...@@ -1559,10 +1560,10 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config, ...@@ -1559,10 +1560,10 @@ void Pipeline::AllocateRegisters(const RegisterConfiguration* config,
if (FLAG_turbo_greedy_regalloc) { if (FLAG_turbo_greedy_regalloc) {
Run<AllocateGeneralRegistersPhase<GreedyAllocator>>(); Run<AllocateGeneralRegistersPhase<GreedyAllocator>>();
Run<AllocateDoubleRegistersPhase<GreedyAllocator>>(); Run<AllocateFPRegistersPhase<GreedyAllocator>>();
} else { } else {
Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>(); Run<AllocateGeneralRegistersPhase<LinearScanAllocator>>();
Run<AllocateDoubleRegistersPhase<LinearScanAllocator>>(); Run<AllocateFPRegistersPhase<LinearScanAllocator>>();
} }
if (FLAG_turbo_preprocess_ranges) { if (FLAG_turbo_preprocess_ranges) {
......
...@@ -26,23 +26,22 @@ void RemoveElement(ZoneVector<LiveRange*>* v, LiveRange* range) { ...@@ -26,23 +26,22 @@ void RemoveElement(ZoneVector<LiveRange*>* v, LiveRange* range) {
} }
int GetRegisterCount(const RegisterConfiguration* cfg, RegisterKind kind) { int GetRegisterCount(const RegisterConfiguration* cfg, RegisterKind kind) {
return kind == DOUBLE_REGISTERS ? cfg->num_double_registers() return kind == FP_REGISTERS ? cfg->num_double_registers()
: cfg->num_general_registers(); : cfg->num_general_registers();
} }
int GetAllocatableRegisterCount(const RegisterConfiguration* cfg, int GetAllocatableRegisterCount(const RegisterConfiguration* cfg,
RegisterKind kind) { RegisterKind kind) {
return kind == DOUBLE_REGISTERS return kind == FP_REGISTERS ? cfg->num_allocatable_aliased_double_registers()
? cfg->num_allocatable_aliased_double_registers() : cfg->num_allocatable_general_registers();
: cfg->num_allocatable_general_registers();
} }
const int* GetAllocatableRegisterCodes(const RegisterConfiguration* cfg, const int* GetAllocatableRegisterCodes(const RegisterConfiguration* cfg,
RegisterKind kind) { RegisterKind kind) {
return kind == DOUBLE_REGISTERS ? cfg->allocatable_double_codes() return kind == FP_REGISTERS ? cfg->allocatable_double_codes()
: cfg->allocatable_general_codes(); : cfg->allocatable_general_codes();
} }
...@@ -489,8 +488,7 @@ void LiveRange::Spill() { ...@@ -489,8 +488,7 @@ void LiveRange::Spill() {
RegisterKind LiveRange::kind() const { RegisterKind LiveRange::kind() const {
return IsFloatingPoint(representation()) ? DOUBLE_REGISTERS return IsFloatingPoint(representation()) ? FP_REGISTERS : GENERAL_REGISTERS;
: GENERAL_REGISTERS;
} }
...@@ -1583,7 +1581,7 @@ SpillRange* RegisterAllocationData::CreateSpillRangeForLiveRange( ...@@ -1583,7 +1581,7 @@ SpillRange* RegisterAllocationData::CreateSpillRangeForLiveRange(
void RegisterAllocationData::MarkAllocated(RegisterKind kind, int index) { void RegisterAllocationData::MarkAllocated(RegisterKind kind, int index) {
if (kind == DOUBLE_REGISTERS) { if (kind == FP_REGISTERS) {
assigned_double_registers_->Add(index); assigned_double_registers_->Add(index);
} else { } else {
DCHECK(kind == GENERAL_REGISTERS); DCHECK(kind == GENERAL_REGISTERS);
...@@ -1934,7 +1932,7 @@ TopLevelLiveRange* LiveRangeBuilder::FixedDoubleLiveRangeFor(int index) { ...@@ -1934,7 +1932,7 @@ TopLevelLiveRange* LiveRangeBuilder::FixedDoubleLiveRangeFor(int index) {
MachineRepresentation::kFloat64); MachineRepresentation::kFloat64);
DCHECK(result->IsFixed()); DCHECK(result->IsFixed());
result->set_assigned_register(index); result->set_assigned_register(index);
data()->MarkAllocated(DOUBLE_REGISTERS, index); data()->MarkAllocated(FP_REGISTERS, index);
data()->fixed_double_live_ranges()[index] = result; data()->fixed_double_live_ranges()[index] = result;
} }
return result; return result;
...@@ -2582,8 +2580,8 @@ void RegisterAllocator::Spill(LiveRange* range) { ...@@ -2582,8 +2580,8 @@ void RegisterAllocator::Spill(LiveRange* range) {
const ZoneVector<TopLevelLiveRange*>& RegisterAllocator::GetFixedRegisters() const ZoneVector<TopLevelLiveRange*>& RegisterAllocator::GetFixedRegisters()
const { const {
return mode() == DOUBLE_REGISTERS ? data()->fixed_double_live_ranges() return mode() == FP_REGISTERS ? data()->fixed_double_live_ranges()
: data()->fixed_live_ranges(); : data()->fixed_live_ranges();
} }
......
...@@ -14,11 +14,7 @@ namespace v8 { ...@@ -14,11 +14,7 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
enum RegisterKind { enum RegisterKind { GENERAL_REGISTERS, FP_REGISTERS };
GENERAL_REGISTERS,
DOUBLE_REGISTERS
};
// This class represents a single point of a InstructionOperand's lifetime. For // This class represents a single point of a InstructionOperand's lifetime. For
// each instruction there are four lifetime positions: // each instruction there are four lifetime positions:
......
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