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

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

Issue 6201006: X64 Crankshaft: Ported lots of boilerplate code. (Closed)
Patch Set: Addressed review comments. Updated to match newest ia32 version. Created 9 years, 11 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 | « src/ia32/lithium-codegen-ia32.h ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/assembler-x64.h
diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h
index 7bcc7c56dd873786c6e86deb1c190a24303b9686..6822c1c3ad0304b8c3f04d18ca6d72eb1db6139d 100644
--- a/src/x64/assembler-x64.h
+++ b/src/x64/assembler-x64.h
@@ -98,6 +98,16 @@ struct Register {
static const int kNumRegisters = 16;
static const int kNumAllocatableRegisters = 10;
+ static int ToAllocationIndex(Register reg) {
+ return allocationIndexByRegisterCode[reg.code()];
+ }
+
+ static Register FromAllocationIndex(int index) {
+ ASSERT(index >= 0 && index < kNumAllocatableRegisters);
+ Register result = { registerCodeByAllocationIndex[index] };
+ return result;
+ }
+
static const char* AllocationIndexToString(int index) {
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
const char* const names[] = {
@@ -143,6 +153,9 @@ struct Register {
// Unfortunately we can't make this private in a struct when initializing
// by assignment.
int code_;
+ private:
+ static const int registerCodeByAllocationIndex[kNumAllocatableRegisters];
+ static const int allocationIndexByRegisterCode[kNumRegisters];
};
const Register rax = { 0 };
@@ -173,6 +186,12 @@ struct XMMRegister {
return reg.code() - 1;
}
+ static XMMRegister FromAllocationIndex(int index) {
+ ASSERT(0 <= index && index < kNumAllocatableRegisters);
+ XMMRegister result = { index + 1 };
+ return result;
+ }
+
static const char* AllocationIndexToString(int index) {
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
const char* const names[] = {
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698