Index: runtime/vm/locations.cc |
diff --git a/runtime/vm/locations.cc b/runtime/vm/locations.cc |
index 96e7a990d761917af534ba562ac36cfb904646de..7447760c5b180d9c02cd4e3dbc27b961adf6ebf5 100644 |
--- a/runtime/vm/locations.cc |
+++ b/runtime/vm/locations.cc |
@@ -5,100 +5,18 @@ |
#include "vm/locations.h" |
#include "vm/intermediate_language.h" |
+#include "vm/flow_graph_compiler.h" |
namespace dart { |
- |
-static Register AllocateFreeRegister( |
- EmbeddedArray<bool, kNumberOfCpuRegisters>* blocked_registers) { |
- for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) { |
- if (!blocked_registers->At(regno)) { |
- blocked_registers->SetAt(regno, true); |
- return static_cast<Register>(regno); |
- } |
- } |
- UNREACHABLE(); |
- return kNoRegister; |
-} |
- |
- |
-void LocationSummary::AllocateRegisters() { |
- EmbeddedArray<bool, kNumberOfCpuRegisters> blocked_registers; |
- |
- // Mark all available registers free. |
- for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) { |
- blocked_registers[i] = false; |
- } |
- |
- // Mark all fixed input, temp and output registers as used. |
- for (intptr_t i = 0; i < input_count(); i++) { |
- Location loc = in(i); |
- if (loc.kind() == Location::kRegister) { |
- ASSERT(!blocked_registers[loc.reg()]); |
- blocked_registers[loc.reg()] = true; |
- } |
- } |
- |
- for (intptr_t i = 0; i < temp_count(); i++) { |
- Location loc = temp(i); |
- if (loc.kind() == Location::kRegister) { |
- ASSERT(!blocked_registers[loc.reg()]); |
- blocked_registers[loc.reg()] = true; |
- } |
- } |
- |
- if (out().kind() == Location::kRegister) { |
- // Fixed output registers are allowed to overlap with |
- // temps and inputs. |
- blocked_registers[out().reg()] = true; |
- } |
- |
- // Do not allocate known registers. |
- blocked_registers[CTX] = true; |
- blocked_registers[SPREG] = true; |
- blocked_registers[FPREG] = true; |
- if (TMP != kNoRegister) { |
- blocked_registers[TMP] = true; |
- } |
- |
- // Allocate all unallocated input locations. |
- for (intptr_t i = 0; i < input_count(); i++) { |
- Location loc = in(i); |
- if (loc.kind() == Location::kUnallocated) { |
- ASSERT(loc.policy() == Location::kRequiresRegister); |
- set_in(i, Location::RegisterLocation( |
- AllocateFreeRegister(&blocked_registers))); |
- } |
- } |
- |
- // Allocate all unallocated temp locations. |
- for (intptr_t i = 0; i < temp_count(); i++) { |
- Location loc = temp(i); |
- if (loc.kind() == Location::kUnallocated) { |
- ASSERT(loc.policy() == Location::kRequiresRegister); |
- set_temp(i, Location::RegisterLocation( |
- AllocateFreeRegister(&blocked_registers))); |
- } |
- } |
- |
- Location result_location = out(); |
- if (result_location.kind() == Location::kUnallocated) { |
- switch (result_location.policy()) { |
- case Location::kRequiresRegister: |
- result_location = Location::RegisterLocation( |
- AllocateFreeRegister(&blocked_registers)); |
- break; |
- case Location::kSameAsFirstInput: |
- result_location = in(0); |
- break; |
- } |
- set_out(result_location); |
- } |
-} |
- |
- |
-LocationSummary* LocationSummary::Make(intptr_t input_count, Location out) { |
- LocationSummary* summary = new LocationSummary(input_count, 0); |
+LocationSummary* LocationSummary::Make(intptr_t input_count, |
+ Location out, |
+ ContainsCall contains_call, |
+ ContainsBranch contains_branch) { |
+ LocationSummary* summary = new LocationSummary(input_count, |
+ 0, |
+ contains_call, |
+ contains_branch); |
for (intptr_t i = 0; i < input_count; i++) { |
summary->set_in(i, Location::RequiresRegister()); |
} |