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

Unified Diff: runtime/vm/locations.h

Issue 10559035: Implement a simple register allocator that tries to keep instruction results in registers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: runtime/vm/locations.h
diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h
index 6c84a59b09309dadaf575d98733d8ab56632b747..beba7973480d03c20127a891cd67859211d58403 100644
--- a/runtime/vm/locations.h
+++ b/runtime/vm/locations.h
@@ -12,8 +12,6 @@
namespace dart {
-class UnallocatedLocation;
-
// Location objects are used to connect register allocator and code generator.
// Instruction templates used by code generator have a corresponding
// LocationSummary object which specifies expected location for every input
@@ -102,10 +100,25 @@ class Location : public ValueObject {
// Specification of locations for inputs and output.
class LocationSummary : public ZoneAllocated {
public:
- LocationSummary(intptr_t input_count, intptr_t temp_count)
+ enum ContainsCall {
+ kNoCall,
+ kCall,
+ };
+
+ enum ContainsBranch {
+ kNoBranch,
+ kBranch
+ };
+
+ LocationSummary(intptr_t input_count,
+ intptr_t temp_count,
+ ContainsCall call = kNoCall,
srdjan 2012/06/18 16:33:20 I am not sure having default value for 'call' is g
Vyacheslav Egorov (Google) 2012/06/18 17:51:16 Having default value is definitely less safe than
+ ContainsBranch branch = kNoBranch)
: input_locations_(input_count),
temp_locations_(temp_count),
- output_location_() {
+ output_location_(),
+ is_call_(call == kCall),
+ is_branch_(branch == kBranch) {
for (intptr_t i = 0; i < input_count; i++) {
input_locations_.Add(Location());
}
@@ -146,16 +159,30 @@ class LocationSummary : public ZoneAllocated {
output_location_ = loc;
}
- // Perform a greedy local register allocation. Consider all register free.
- void AllocateRegisters();
+ bool is_call() const {
+ return is_call_;
+ }
+
+ // TODO(vegorov): this is a temporary solution. Once we will start removing
+ // comparison operations from the flow graph when they are fused with a branch
+ // we should eliminate this.
+ bool is_branch() const {
+ return is_branch_;
+ }
- static LocationSummary* Make(intptr_t input_count, Location out);
+ static LocationSummary* Make(intptr_t input_count,
+ Location out,
+ ContainsCall contains_call = kNoCall,
+ ContainsBranch contains_branch = kNoBranch);
private:
// TODO(vegorov): replace with ZoneArray.
GrowableArray<Location> input_locations_;
GrowableArray<Location> temp_locations_;
Location output_location_;
+
+ const bool is_call_;
+ const bool is_branch_;
};

Powered by Google App Engine
This is Rietveld 408576698