Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: src/ia32/assembler-ia32.h

Issue 284503002: Simplify DoubleRegister for the ia32 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/assembler-ia32.h
diff --git a/src/ia32/assembler-ia32.h b/src/ia32/assembler-ia32.h
index a46050888a783a11706807ea9969d8b537c3c44a..6b60c12bec842eb9ca0390f9b03d183d0becee30 100644
--- a/src/ia32/assembler-ia32.h
+++ b/src/ia32/assembler-ia32.h
@@ -141,71 +141,41 @@ inline Register Register::FromAllocationIndex(int index) {
}
-struct DoubleRegister {
- static const int kMaxNumRegisters = 8;
+struct XMMRegister {
static const int kMaxNumAllocatableRegisters = 7;
- static int NumAllocatableRegisters();
- static int NumRegisters();
- static const char* AllocationIndexToString(int index);
+ static const int kMaxNumRegisters = 8;
+ static int NumAllocatableRegisters() {
+ return kMaxNumAllocatableRegisters;
+ }
- static int ToAllocationIndex(DoubleRegister reg) {
+ static int ToAllocationIndex(XMMRegister reg) {
ASSERT(reg.code() != 0);
return reg.code() - 1;
}
- static DoubleRegister FromAllocationIndex(int index) {
- ASSERT(index >= 0 && index < NumAllocatableRegisters());
+ static XMMRegister FromAllocationIndex(int index) {
+ ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters);
return from_code(index + 1);
}
- static DoubleRegister from_code(int code) {
- DoubleRegister result = { code };
+ static XMMRegister from_code(int code) {
+ XMMRegister result = { code };
return result;
}
bool is_valid() const {
- return 0 <= code_ && code_ < NumRegisters();
+ return 0 <= code_ && code_ < kMaxNumRegisters;
}
+
int code() const {
ASSERT(is_valid());
return code_;
}
- int code_;
-};
-
-
-const DoubleRegister double_register_0 = { 0 };
-const DoubleRegister double_register_1 = { 1 };
-const DoubleRegister double_register_2 = { 2 };
-const DoubleRegister double_register_3 = { 3 };
-const DoubleRegister double_register_4 = { 4 };
-const DoubleRegister double_register_5 = { 5 };
-const DoubleRegister double_register_6 = { 6 };
-const DoubleRegister double_register_7 = { 7 };
-const DoubleRegister no_double_reg = { -1 };
-
-
-struct XMMRegister : DoubleRegister {
- static const int kNumAllocatableRegisters = 7;
- static const int kNumRegisters = 8;
-
- static XMMRegister from_code(int code) {
- STATIC_ASSERT(sizeof(XMMRegister) == sizeof(DoubleRegister));
- XMMRegister result;
- result.code_ = code;
- return result;
- }
-
bool is(XMMRegister reg) const { return code_ == reg.code_; }
- static XMMRegister FromAllocationIndex(int index) {
- ASSERT(index >= 0 && index < NumAllocatableRegisters());
- return from_code(index + 1);
- }
-
static const char* AllocationIndexToString(int index) {
- ASSERT(index >= 0 && index < kNumAllocatableRegisters);
+ ASSERT(index >= 0 && index < kMaxNumAllocatableRegisters);
const char* const names[] = {
"xmm1",
"xmm2",
@@ -217,18 +187,23 @@ struct XMMRegister : DoubleRegister {
};
return names[index];
}
+
+ int code_;
};
-#define xmm0 (static_cast<const XMMRegister&>(double_register_0))
-#define xmm1 (static_cast<const XMMRegister&>(double_register_1))
-#define xmm2 (static_cast<const XMMRegister&>(double_register_2))
-#define xmm3 (static_cast<const XMMRegister&>(double_register_3))
-#define xmm4 (static_cast<const XMMRegister&>(double_register_4))
-#define xmm5 (static_cast<const XMMRegister&>(double_register_5))
-#define xmm6 (static_cast<const XMMRegister&>(double_register_6))
-#define xmm7 (static_cast<const XMMRegister&>(double_register_7))
-#define no_xmm_reg (static_cast<const XMMRegister&>(no_double_reg))
+typedef XMMRegister DoubleRegister;
+
+
+const XMMRegister xmm0 = { 0 };
+const XMMRegister xmm1 = { 1 };
+const XMMRegister xmm2 = { 2 };
+const XMMRegister xmm3 = { 3 };
+const XMMRegister xmm4 = { 4 };
+const XMMRegister xmm5 = { 5 };
+const XMMRegister xmm6 = { 6 };
+const XMMRegister xmm7 = { 7 };
+const XMMRegister no_xmm_reg = { -1 };
enum Condition {
« no previous file with comments | « no previous file | src/ia32/assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698