Remove the notion of dies at entry.
- Instead, explicitly say that the output does not overlap.
- Inputs that must be in a fixed register do die at entry,
as we know they have a location that others can not take.
- There is also no need to differentiate between an input move
and a connecting sibling move - those can be put in the
same parallel move instruction.
Change-Id: I1b2b2827906601f822b59fb9d6a21d48e43bae27
diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h
index dcf70f2..11bcd78 100644
--- a/compiler/optimizing/locations.h
+++ b/compiler/optimizing/locations.h
@@ -34,7 +34,7 @@
*/
class Location : public ValueObject {
public:
- static constexpr bool kDiesAtEntry = true;
+ static constexpr bool kNoOutputOverlap = false;
enum Kind {
kInvalid = 0,
@@ -373,8 +373,7 @@
LocationSummary(HInstruction* instruction, CallKind call_kind = kNoCall);
- void SetInAt(uint32_t at, Location location, bool dies_at_entry = false) {
- dies_at_entry_.Put(at, dies_at_entry);
+ void SetInAt(uint32_t at, Location location) {
inputs_.Put(at, location);
}
@@ -386,7 +385,8 @@
return inputs_.Size();
}
- void SetOut(Location location) {
+ void SetOut(Location location, bool overlaps = true) {
+ output_overlaps_ = overlaps;
output_ = Location(location);
}
@@ -449,23 +449,30 @@
return &live_registers_;
}
- bool InputOverlapsWithOutputOrTemp(uint32_t input, bool is_environment) const {
+ bool InputOverlapsWithOutputOrTemp(uint32_t input_index, bool is_environment) const {
if (is_environment) return true;
- Location location = Out();
- if (input == 0 && location.IsUnallocated() && location.GetPolicy() == Location::kSameAsFirstInput) {
+ if ((input_index == 0)
+ && output_.IsUnallocated()
+ && (output_.GetPolicy() == Location::kSameAsFirstInput)) {
return false;
}
- if (dies_at_entry_.Get(input)) {
+ if (inputs_.Get(input_index).IsRegister() || inputs_.Get(input_index).IsFpuRegister()) {
return false;
}
return true;
}
+ bool OutputOverlapsWithInputs() const {
+ return output_overlaps_;
+ }
+
private:
GrowableArray<Location> inputs_;
GrowableArray<Location> temps_;
GrowableArray<Location> environment_;
- GrowableArray<bool> dies_at_entry_;
+ // Whether the output overlaps with any of the inputs. If it overlaps, then it cannot
+ // share the same register as the inputs.
+ bool output_overlaps_;
Location output_;
const CallKind call_kind_;