From b3e773eea39a156b3eacf915ba84e3af1a5c14fa Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 26 Jan 2016 11:28:37 +0000 Subject: ART: Implement support for instruction inlining Optimizing HIR contains 'non-materialized' instructions which are emitted at their use sites rather than their defining sites. This was not properly handled by the liveness analysis which did not adjust the use positions of the inputs of such instructions. Despite the analysis being incorrect, the current use cases never produce incorrect code. This patch generalizes the concept of inlined instructions and updates liveness analysis to set the compute use positions correctly. Change-Id: Id703c154b20ab861241ae5c715a150385d3ff621 --- compiler/optimizing/nodes.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 41c2f17cd9..922696bb5d 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1819,6 +1819,7 @@ class HInstruction : public ArenaObject { dex_pc_(dex_pc), id_(-1), ssa_index_(-1), + emitted_at_use_site_(false), environment_(nullptr), locations_(nullptr), live_interval_(nullptr), @@ -2081,6 +2082,9 @@ class HInstruction : public ArenaObject { // The caller must ensure that this is safe to do. void RemoveEnvironmentUsers(); + bool IsEmittedAtUseSite() const { return emitted_at_use_site_; } + void MarkEmittedAtUseSite() { emitted_at_use_site_ = true; } + protected: virtual const HUserRecord InputRecordAt(size_t i) const = 0; virtual void SetRawInputRecordAt(size_t index, const HUserRecord& input) = 0; @@ -2102,6 +2106,10 @@ class HInstruction : public ArenaObject { // When doing liveness analysis, instructions that have uses get an SSA index. int ssa_index_; + // If set, the machine code for this instruction is assumed to be generated by + // its users. Used by liveness analysis to compute use positions accordingly. + bool emitted_at_use_site_; + // List of instructions that have this instruction as input. HUseList uses_; @@ -2711,12 +2719,8 @@ class HCondition : public HBinaryOperation { public: HCondition(HInstruction* first, HInstruction* second, uint32_t dex_pc = kNoDexPc) : HBinaryOperation(Primitive::kPrimBoolean, first, second, SideEffects::None(), dex_pc), - needs_materialization_(true), bias_(ComparisonBias::kNoBias) {} - bool NeedsMaterialization() const { return needs_materialization_; } - void ClearNeedsMaterialization() { needs_materialization_ = false; } - // For code generation purposes, returns whether this instruction is just before // `instruction`, and disregard moves in between. bool IsBeforeWhenDisregardMoves(HInstruction* instruction) const; @@ -2748,10 +2752,6 @@ class HCondition : public HBinaryOperation { } private: - // For register allocation purposes, returns whether this instruction needs to be - // materialized (that is, not just be in the processor flags). - bool needs_materialization_; - // Needed if we merge a HCompare into a HCondition. ComparisonBias bias_; -- cgit v1.2.3-59-g8ed1b