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