diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/locations.cc | 11 | ||||
-rw-r--r-- | compiler/optimizing/locations.h | 19 |
2 files changed, 20 insertions, 10 deletions
diff --git a/compiler/optimizing/locations.cc b/compiler/optimizing/locations.cc index 4189bc4053..f419263f62 100644 --- a/compiler/optimizing/locations.cc +++ b/compiler/optimizing/locations.cc @@ -26,17 +26,24 @@ namespace art HIDDEN { // Verify that Location is trivially copyable. static_assert(std::is_trivially_copyable<Location>::value, "Location should be trivially copyable"); +static inline ArrayRef<Location> AllocateInputLocations(HInstruction* instruction, + ArenaAllocator* allocator) { + size_t input_count = instruction->InputCount(); + Location* array = allocator->AllocArray<Location>(input_count, kArenaAllocLocationSummary); + return {array, input_count}; +} + LocationSummary::LocationSummary(HInstruction* instruction, CallKind call_kind, bool intrinsified, ArenaAllocator* allocator) - : inputs_(instruction->InputCount(), allocator->Adapter(kArenaAllocLocationSummary)), + : inputs_(AllocateInputLocations(instruction, allocator)), temps_(allocator->Adapter(kArenaAllocLocationSummary)), + stack_mask_(nullptr), call_kind_(call_kind), intrinsified_(intrinsified), has_custom_slow_path_calling_convention_(false), output_overlaps_(Location::kOutputOverlap), - stack_mask_(nullptr), register_mask_(0), live_registers_(RegisterSet::Empty()), custom_slow_path_caller_saves_(RegisterSet::Empty()) { diff --git a/compiler/optimizing/locations.h b/compiler/optimizing/locations.h index 2209f05c0b..b8fe29c621 100644 --- a/compiler/optimizing/locations.h +++ b/compiler/optimizing/locations.h @@ -19,6 +19,7 @@ #include "base/arena_containers.h" #include "base/arena_object.h" +#include "base/array_ref.h" #include "base/bit_field.h" #include "base/bit_utils.h" #include "base/bit_vector.h" @@ -39,7 +40,7 @@ std::ostream& operator<<(std::ostream& os, const Location& location); */ class Location : public ValueObject { public: - enum OutputOverlap { + enum OutputOverlap : uint8_t { // The liveness of the output overlaps the liveness of one or // several input(s); the register allocator cannot reuse an // input's location for the output's location. @@ -534,7 +535,7 @@ static constexpr bool kIntrinsified = true; */ class LocationSummary : public ArenaObject<kArenaAllocLocationSummary> { public: - enum CallKind { + enum CallKind : uint8_t { kNoCall, kCallOnMainAndSlowPath, kCallOnSlowPath, @@ -713,8 +714,13 @@ class LocationSummary : public ArenaObject<kArenaAllocLocationSummary> { bool intrinsified, ArenaAllocator* allocator); - ArenaVector<Location> inputs_; + ArrayRef<Location> inputs_; ArenaVector<Location> temps_; + Location output_; + + // Mask of objects that live in the stack. + BitVector* stack_mask_; + const CallKind call_kind_; // Whether these are locations for an intrinsified call. const bool intrinsified_; @@ -723,10 +729,6 @@ class LocationSummary : public ArenaObject<kArenaAllocLocationSummary> { // Whether the output overlaps with any of the inputs. If it overlaps, then it cannot // share the same register as the inputs. Location::OutputOverlap output_overlaps_; - Location output_; - - // Mask of objects that live in the stack. - BitVector* stack_mask_; // Mask of objects that live in register. uint32_t register_mask_; @@ -734,7 +736,8 @@ class LocationSummary : public ArenaObject<kArenaAllocLocationSummary> { // Registers that are in use at this position. RegisterSet live_registers_; - // Custom slow path caller saves. Valid only if indicated by slow_path_calling_convention_. + // Custom slow path caller saves. Valid only if indicated by + // `has_custom_slow_path_calling_convention_`. RegisterSet custom_slow_path_caller_saves_; ART_FRIEND_TEST(RegisterAllocatorTest, ExpectedInRegisterHint); |