| Index: src/a64/assembler-a64.h
|
| diff --git a/src/a64/assembler-a64.h b/src/a64/assembler-a64.h
|
| index 09a8a72014d9c7885266576e35094c6b60926e23..bf115b446648368d1e5398cdb0914719837db381 100644
|
| --- a/src/a64/assembler-a64.h
|
| +++ b/src/a64/assembler-a64.h
|
| @@ -264,36 +264,60 @@ struct FPRegister : public CPURegister {
|
| static const int kMaxNumRegisters = kNumberOfFPRegisters;
|
|
|
| // Crankshaft can use all the FP registers except:
|
| - // - d29 which is used in crankshaft as a double scratch register
|
| - // - d30 which is used to keep the 0 double value
|
| + // - d15 which is used to keep the 0 double value
|
| + // - d30 which is used in crankshaft as a double scratch register
|
| // - d31 which is used in the MacroAssembler as a double scratch register
|
| - static const int kNumReservedRegisters = 3;
|
| + static const unsigned kAllocatableLowRangeBegin = 0;
|
| + static const unsigned kAllocatableLowRangeEnd = 14;
|
| + static const unsigned kAllocatableHighRangeBegin = 16;
|
| + static const unsigned kAllocatableHighRangeEnd = 29;
|
| +
|
| + static const RegList kAllocatableFPRegisters = 0x3fff7fff;
|
| +
|
| + // Gap between low and high ranges.
|
| + static const int kAllocatableRangeGapSize =
|
| + (kAllocatableHighRangeBegin - kAllocatableLowRangeEnd) - 1;
|
| +
|
| static const int kMaxNumAllocatableRegisters =
|
| - kNumberOfFPRegisters - kNumReservedRegisters;
|
| + (kAllocatableLowRangeEnd - kAllocatableLowRangeBegin + 1) +
|
| + (kAllocatableHighRangeEnd - kAllocatableHighRangeBegin + 1);
|
| static int NumAllocatableRegisters() { return kMaxNumAllocatableRegisters; }
|
| - static const RegList kAllocatableFPRegisters =
|
| - (1 << kMaxNumAllocatableRegisters) - 1;
|
|
|
| - static FPRegister FromAllocationIndex(int index) {
|
| - ASSERT((index >= 0) && (index < NumAllocatableRegisters()));
|
| - return from_code(index);
|
| + // Return true if the register is one that crankshaft can allocate.
|
| + bool IsAllocatable() const {
|
| + return (Bit() & kAllocatableFPRegisters) != 0;
|
| + }
|
| +
|
| + static FPRegister FromAllocationIndex(unsigned int index) {
|
| + ASSERT(index < static_cast<unsigned>(NumAllocatableRegisters()));
|
| +
|
| + return (index <= kAllocatableLowRangeEnd)
|
| + ? from_code(index)
|
| + : from_code(index + kAllocatableRangeGapSize);
|
| }
|
|
|
| static const char* AllocationIndexToString(int index) {
|
| ASSERT((index >= 0) && (index < NumAllocatableRegisters()));
|
| + ASSERT((kAllocatableLowRangeBegin == 0) &&
|
| + (kAllocatableLowRangeEnd == 14) &&
|
| + (kAllocatableHighRangeBegin == 16) &&
|
| + (kAllocatableHighRangeEnd == 29));
|
| const char* const names[] = {
|
| "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
|
| - "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
|
| + "d8", "d9", "d10", "d11", "d12", "d13", "d14",
|
| "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
|
| - "d24", "d25", "d26", "d27", "d28",
|
| + "d24", "d25", "d26", "d27", "d28", "d29"
|
| };
|
| return names[index];
|
| }
|
|
|
| static int ToAllocationIndex(FPRegister reg) {
|
| - int code = reg.code();
|
| - ASSERT(code < NumAllocatableRegisters());
|
| - return code;
|
| + ASSERT(reg.IsAllocatable());
|
| + unsigned code = reg.code();
|
| +
|
| + return (code <= kAllocatableLowRangeEnd)
|
| + ? code
|
| + : code - kAllocatableRangeGapSize;
|
| }
|
|
|
| static FPRegister from_code(int code) {
|
| @@ -375,10 +399,10 @@ ALIAS_REGISTER(Register, lr, x30);
|
| ALIAS_REGISTER(Register, xzr, x31);
|
| ALIAS_REGISTER(Register, wzr, w31);
|
|
|
| -// Crankshaft double scratch register.
|
| -ALIAS_REGISTER(FPRegister, crankshaft_fp_scratch, d29);
|
| // Keeps the 0 double value.
|
| -ALIAS_REGISTER(FPRegister, fp_zero, d30);
|
| +ALIAS_REGISTER(FPRegister, fp_zero, d15);
|
| +// Crankshaft double scratch register.
|
| +ALIAS_REGISTER(FPRegister, crankshaft_fp_scratch, d30);
|
| // MacroAssembler double scratch register.
|
| ALIAS_REGISTER(FPRegister, fp_scratch, d31);
|
|
|
|
|