Revision: 21168
Author:   [email protected]
Date:     Tue May  6 12:11:00 2014 UTC
Log: ARM64: Introduce TempDoubleRegister as a lithium operand constraint.

[email protected]

Review URL: https://codereview.chromium.org/261933002
http://code.google.com/p/v8/source/detail?r=21168

Modified:
 /branches/bleeding_edge/src/arm64/lithium-arm64.cc
 /branches/bleeding_edge/src/arm64/lithium-arm64.h
 /branches/bleeding_edge/src/lithium-allocator.cc
 /branches/bleeding_edge/src/lithium.cc
 /branches/bleeding_edge/src/lithium.h

=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.cc Tue May 6 11:00:28 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-arm64.cc Tue May 6 12:11:00 2014 UTC
@@ -518,6 +518,19 @@
   operand->set_virtual_register(vreg);
   return operand;
 }
+
+
+LUnallocated* LChunkBuilder::TempDoubleRegister() {
+  LUnallocated* operand =
+      new(zone()) LUnallocated(LUnallocated::MUST_HAVE_DOUBLE_REGISTER);
+  int vreg = allocator_->GetVirtualRegister();
+  if (!allocator_->AllocationOk()) {
+    Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister);
+    vreg = 0;
+  }
+  operand->set_virtual_register(vreg);
+  return operand;
+}


 int LPlatformChunk::GetNextSpillIndex() {
@@ -1102,7 +1115,8 @@
       } else {
         LOperand* value = UseRegister(val);
         LOperand* temp1 = TempRegister();
- LOperand* temp2 = instr->CanTruncateToInt32() ? NULL : FixedTemp(d24);
+        LOperand* temp2 = instr->CanTruncateToInt32()
+            ? NULL : TempDoubleRegister();
         LInstruction* result =
             DefineAsRegister(new(zone()) LTaggedToI(value, temp1, temp2));
if (!val->representation().IsSmi()) result = AssignEnvironment(result);
@@ -1219,7 +1233,7 @@
     return AssignEnvironment(
         DefineAsRegister(new(zone()) LClampTToUint8(reg,
                                                     TempRegister(),
-                                                    FixedTemp(d24))));
+ TempDoubleRegister())));
   }
 }

@@ -2562,8 +2576,7 @@
       ASSERT(instr->representation().IsDouble());
       ASSERT(instr->value()->representation().IsDouble());
       LOperand* input = UseRegister(instr->value());
-      // TODO(all): Implement TempFPRegister.
- LOperand* double_temp1 = FixedTemp(d24); // This was chosen arbitrarily.
+      LOperand* double_temp1 = TempDoubleRegister();
       LOperand* temp1 = TempRegister();
       LOperand* temp2 = TempRegister();
       LOperand* temp3 = TempRegister();
@@ -2600,7 +2613,8 @@
       ASSERT(instr->value()->representation().IsDouble());
       LOperand* input = UseRegister(instr->value());
       if (instr->representation().IsInteger32()) {
- LMathRoundI* result = new(zone()) LMathRoundI(input, FixedTemp(d24));
+        LOperand* temp = TempDoubleRegister();
+        LMathRoundI* result = new(zone()) LMathRoundI(input, temp);
         return AssignEnvironment(DefineAsRegister(result));
       } else {
         ASSERT(instr->representation().IsDouble());
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.h Tue May 6 11:00:28 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-arm64.h Tue May 6 12:11:00 2014 UTC
@@ -3089,6 +3089,9 @@
   // Temporary operand that must be in a register.
   MUST_USE_RESULT LUnallocated* TempRegister();

+  // Temporary operand that must be in a double register.
+  MUST_USE_RESULT LUnallocated* TempDoubleRegister();
+
   // Temporary operand that must be in a fixed double register.
   MUST_USE_RESULT LOperand* FixedTemp(DoubleRegister reg);

=======================================
--- /branches/bleeding_edge/src/lithium-allocator.cc Wed Apr 30 09:50:58 2014 UTC +++ /branches/bleeding_edge/src/lithium-allocator.cc Tue May 6 12:11:00 2014 UTC
@@ -46,7 +46,8 @@
       register_beneficial_(true) {
   if (operand_ != NULL && operand_->IsUnallocated()) {
     LUnallocated* unalloc = LUnallocated::cast(operand_);
-    requires_reg_ = unalloc->HasRegisterPolicy();
+    requires_reg_ = unalloc->HasRegisterPolicy() ||
+        unalloc->HasDoubleRegisterPolicy();
     register_beneficial_ = !unalloc->HasAnyPolicy();
   }
   ASSERT(pos_.IsValid());
@@ -1005,6 +1006,15 @@
           }
Use(block_start_position, curr_position.InstructionEnd(), temp, NULL);
           Define(curr_position, temp, NULL);
+
+          if (temp->IsUnallocated()) {
+            LUnallocated* temp_unalloc = LUnallocated::cast(temp);
+            if (temp_unalloc->HasDoubleRegisterPolicy()) {
+              double_artificial_registers_.Add(
+ temp_unalloc->virtual_register() - first_artificial_register_,
+                  zone());
+            }
+          }
         }
       }
     }
@@ -1095,7 +1105,6 @@

 void LAllocator::MeetRegisterConstraints() {
   LAllocatorPhase phase("L_Register constraints", this);
-  first_artificial_register_ = next_virtual_register_;
   const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
   for (int i = 0; i < blocks->length(); ++i) {
     HBasicBlock* block = blocks->at(i);
=======================================
--- /branches/bleeding_edge/src/lithium.cc      Mon May  5 11:03:14 2014 UTC
+++ /branches/bleeding_edge/src/lithium.cc      Tue May  6 12:11:00 2014 UTC
@@ -62,6 +62,9 @@
         case LUnallocated::MUST_HAVE_REGISTER:
           stream->Add("(R)");
           break;
+        case LUnallocated::MUST_HAVE_DOUBLE_REGISTER:
+          stream->Add("(D)");
+          break;
         case LUnallocated::WRITABLE_REGISTER:
           stream->Add("(WR)");
           break;
=======================================
--- /branches/bleeding_edge/src/lithium.h       Mon May  5 11:03:14 2014 UTC
+++ /branches/bleeding_edge/src/lithium.h       Tue May  6 12:11:00 2014 UTC
@@ -81,6 +81,7 @@
     FIXED_REGISTER,
     FIXED_DOUBLE_REGISTER,
     MUST_HAVE_REGISTER,
+    MUST_HAVE_DOUBLE_REGISTER,
     WRITABLE_REGISTER,
     SAME_AS_FIRST_INPUT
   };
@@ -190,6 +191,10 @@
         extended_policy() == WRITABLE_REGISTER ||
         extended_policy() == MUST_HAVE_REGISTER);
   }
+  bool HasDoubleRegisterPolicy() const {
+    return basic_policy() == EXTENDED_POLICY &&
+        extended_policy() == MUST_HAVE_DOUBLE_REGISTER;
+  }
   bool HasSameAsInputPolicy() const {
     return basic_policy() == EXTENDED_POLICY &&
         extended_policy() == SAME_AS_FIRST_INPUT;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to