Commit 6aa9b10f authored by bbudge's avatar bbudge Committed by Commit bot

Clean up ArchDefaultRegisterConfiguration.

Remove two unused fields.
Define register codes the same way register names are defined and eliminate static methods.
#error if target isn't defined.

LOG=N
BUG=v8:4124

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

Cr-Commit-Position: refs/heads/master@{#32467}
parent 7e8fa4b9
...@@ -17,6 +17,16 @@ static const int kMaxAllocatableGeneralRegisterCount = ...@@ -17,6 +17,16 @@ static const int kMaxAllocatableGeneralRegisterCount =
static const int kMaxAllocatableDoubleRegisterCount = static const int kMaxAllocatableDoubleRegisterCount =
ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_COUNT)0; ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_COUNT)0;
static const int kAllocatableGeneralCodes[] = {
#define REGISTER_CODE(R) Register::kCode_##R,
ALLOCATABLE_GENERAL_REGISTERS(REGISTER_CODE)};
#undef REGISTER_CODE
static const int kAllocatableDoubleCodes[] = {
#define REGISTER_CODE(R) DoubleRegister::kCode_##R,
ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)};
#undef REGISTER_CODE
static const char* const kGeneralRegisterNames[] = { static const char* const kGeneralRegisterNames[] = {
#define REGISTER_NAME(R) #R, #define REGISTER_NAME(R) #R,
GENERAL_REGISTERS(REGISTER_NAME) GENERAL_REGISTERS(REGISTER_NAME)
...@@ -37,71 +47,55 @@ STATIC_ASSERT(RegisterConfiguration::kMaxDoubleRegisters >= ...@@ -37,71 +47,55 @@ STATIC_ASSERT(RegisterConfiguration::kMaxDoubleRegisters >=
class ArchDefaultRegisterConfiguration : public RegisterConfiguration { class ArchDefaultRegisterConfiguration : public RegisterConfiguration {
public: public:
explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler) explicit ArchDefaultRegisterConfiguration(CompilerSelector compiler)
: RegisterConfiguration( : RegisterConfiguration(Register::kNumRegisters,
Register::kNumRegisters, DoubleRegister::kMaxNumRegisters, DoubleRegister::kMaxNumRegisters,
#if V8_TARGET_ARCH_IA32 #if V8_TARGET_ARCH_IA32
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_X87 #elif V8_TARGET_ARCH_X87
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount, compiler == TURBOFAN
compiler == TURBOFAN ? 1 : kMaxAllocatableDoubleRegisterCount, ? 1
: kMaxAllocatableDoubleRegisterCount,
compiler == TURBOFAN
? 1
: kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_X64 #elif V8_TARGET_ARCH_X64
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_ARM #elif V8_TARGET_ARCH_ARM
FLAG_enable_embedded_constant_pool FLAG_enable_embedded_constant_pool
? (kMaxAllocatableGeneralRegisterCount - 1) ? (kMaxAllocatableGeneralRegisterCount - 1)
: kMaxAllocatableGeneralRegisterCount, : kMaxAllocatableGeneralRegisterCount,
CpuFeatures::IsSupported(VFP32DREGS) CpuFeatures::IsSupported(VFP32DREGS)
? kMaxAllocatableDoubleRegisterCount ? kMaxAllocatableDoubleRegisterCount
: (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT)0), : (ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(
ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(REGISTER_COUNT)0, REGISTER_COUNT)0),
ALLOCATABLE_NO_VFP32_DOUBLE_REGISTERS(
REGISTER_COUNT)0,
#elif V8_TARGET_ARCH_ARM64 #elif V8_TARGET_ARCH_ARM64
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_MIPS #elif V8_TARGET_ARCH_MIPS
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_MIPS64 #elif V8_TARGET_ARCH_MIPS64
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#elif V8_TARGET_ARCH_PPC #elif V8_TARGET_ARCH_PPC
kMaxAllocatableGeneralRegisterCount, kMaxAllocatableGeneralRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
kMaxAllocatableDoubleRegisterCount, kMaxAllocatableDoubleRegisterCount,
#else #else
GetAllocatableGeneralRegisterCount(), #error Unsupported target architecture.
GetAllocatableDoubleRegisterCount(),
GetAllocatableAliasedDoubleRegisterCount(),
#endif #endif
GetAllocatableGeneralCodes(), GetAllocatableDoubleCodes(), kAllocatableGeneralCodes, kAllocatableDoubleCodes,
kGeneralRegisterNames, kDoubleRegisterNames) { kGeneralRegisterNames, kDoubleRegisterNames) {
}
const char* general_register_name_table_[Register::kNumRegisters];
const char* double_register_name_table_[DoubleRegister::kMaxNumRegisters];
private:
static const int* GetAllocatableGeneralCodes() {
#define REGISTER_CODE(R) Register::kCode_##R,
static const int general_codes[] = {
ALLOCATABLE_GENERAL_REGISTERS(REGISTER_CODE)};
#undef REGISTER_CODE
return general_codes;
}
static const int* GetAllocatableDoubleCodes() {
#define REGISTER_CODE(R) DoubleRegister::kCode_##R,
static const int double_codes[] = {
ALLOCATABLE_DOUBLE_REGISTERS(REGISTER_CODE)};
#undef REGISTER_CODE
return double_codes;
} }
}; };
......
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