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

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

Issue 341863002: ARM64: Give LR to the allocator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/arm64/deoptimizer-arm64.cc » ('j') | src/arm64/deoptimizer-arm64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/assembler-arm64.h
diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h
index c0ad4d053b184141221b70363592a6ee104dde01..540938c3a532583fff8f473007f7d7ebabbf31ed 100644
--- a/src/arm64/assembler-arm64.h
+++ b/src/arm64/assembler-arm64.h
@@ -135,6 +135,7 @@ struct Register : public CPURegister {
// - x0 to x15
// - x18 to x24
// - x27 (also context)
+ // - x30 (also lr)
//
// TODO(all): Register x25 is currently free and could be available for
// crankshaft, but we don't use it as we might use it as a per function
@@ -150,6 +151,14 @@ struct Register : public CPURegister {
static const unsigned kAllocatableHighRangeBegin = 18;
static const unsigned kAllocatableHighRangeEnd = 24;
static const unsigned kAllocatableContext = 27;
+ static const unsigned kAllocatableLR = 30;
+
+ static const RegList kAllocatableRegisters =
+ ((1 << (kAllocatableLowRangeEnd + 1)) -
+ (1 << kAllocatableLowRangeBegin)) |
+ ((1 << (kAllocatableHighRangeEnd + 1)) -
+ (1 << kAllocatableHighRangeBegin)) |
+ (1 << kAllocatableLR) | (1 << kAllocatableContext);
// Gap between low and high ranges.
static const int kAllocatableRangeGapSize =
@@ -157,12 +166,13 @@ struct Register : public CPURegister {
static const int kMaxNumAllocatableRegisters =
(kAllocatableLowRangeEnd - kAllocatableLowRangeBegin + 1) +
- (kAllocatableHighRangeEnd - kAllocatableHighRangeBegin + 1) + 1; // cp
+ (kAllocatableHighRangeEnd - kAllocatableHighRangeBegin + 1) + 2; // cp/lr
static int NumAllocatableRegisters() { return kMaxNumAllocatableRegisters; }
// Return true if the register is one that crankshaft can allocate.
bool IsAllocatable() const {
return ((reg_code == kAllocatableContext) ||
+ (reg_code == kAllocatableLR) ||
(reg_code <= kAllocatableLowRangeEnd) ||
((reg_code >= kAllocatableHighRangeBegin) &&
(reg_code <= kAllocatableHighRangeEnd)));
@@ -170,8 +180,12 @@ struct Register : public CPURegister {
static Register FromAllocationIndex(unsigned index) {
ASSERT(index < static_cast<unsigned>(NumAllocatableRegisters()));
- // cp is the last allocatable register.
+ // lr is the last allocatable register.
if (index == (static_cast<unsigned>(NumAllocatableRegisters() - 1))) {
+ return from_code(kAllocatableLR);
+ }
+ // cp is the second-last allocatable register.
+ if (index == (static_cast<unsigned>(NumAllocatableRegisters() - 2))) {
return from_code(kAllocatableContext);
}
@@ -183,17 +197,18 @@ struct Register : public CPURegister {
static const char* AllocationIndexToString(int index) {
ASSERT((index >= 0) && (index < NumAllocatableRegisters()));
- ASSERT((kAllocatableLowRangeBegin == 0) &&
- (kAllocatableLowRangeEnd == 15) &&
- (kAllocatableHighRangeBegin == 18) &&
- (kAllocatableHighRangeEnd == 24) &&
- (kAllocatableContext == 27));
+ STATIC_ASSERT((kAllocatableLowRangeBegin == 0) &&
+ (kAllocatableLowRangeEnd == 15) &&
+ (kAllocatableHighRangeBegin == 18) &&
+ (kAllocatableHighRangeEnd == 24) &&
+ (kAllocatableContext == 27) &&
+ (kAllocatableLR == 30));
const char* const names[] = {
"x0", "x1", "x2", "x3", "x4",
"x5", "x6", "x7", "x8", "x9",
"x10", "x11", "x12", "x13", "x14",
"x15", "x18", "x19", "x20", "x21",
- "x22", "x23", "x24", "x27",
+ "x22", "x23", "x24", "x27", "lr"
};
return names[index];
}
@@ -201,9 +216,12 @@ struct Register : public CPURegister {
static int ToAllocationIndex(Register reg) {
ASSERT(reg.IsAllocatable());
unsigned code = reg.code();
- if (code == kAllocatableContext) {
+ if (code == kAllocatableLR) {
return NumAllocatableRegisters() - 1;
}
+ if (code == kAllocatableContext) {
+ return NumAllocatableRegisters() - 2;
+ }
return (code <= kAllocatableLowRangeEnd)
? code
@@ -265,7 +283,11 @@ struct FPRegister : public CPURegister {
static const unsigned kAllocatableHighRangeBegin = 16;
static const unsigned kAllocatableHighRangeEnd = 28;
- static const RegList kAllocatableFPRegisters = 0x1fff7fff;
+ static const RegList kAllocatableFPRegisters =
+ ((1 << (kAllocatableLowRangeEnd + 1)) -
+ (1 << kAllocatableLowRangeBegin)) |
+ ((1 << (kAllocatableHighRangeEnd + 1)) -
+ (1 << kAllocatableHighRangeBegin));
// Gap between low and high ranges.
static const int kAllocatableRangeGapSize =
« no previous file with comments | « no previous file | src/arm64/deoptimizer-arm64.cc » ('j') | src/arm64/deoptimizer-arm64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698