diff options
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index fe47939359..649038b532 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -2752,6 +2752,20 @@ class HPhi : public HInstruction { bool IsDead() const { return !is_live_; } bool IsLive() const { return is_live_; } + // Returns the next equivalent phi (starting from the current one) or null if there is none. + // An equivalent phi is a phi having the same dex register and type. + // It assumes that phis with the same dex register are adjacent. + HPhi* GetNextEquivalentPhiWithSameType() { + HInstruction* next = GetNext(); + while (next != nullptr && next->AsPhi()->GetRegNumber() == reg_number_) { + if (next->GetType() == GetType()) { + return next->AsPhi(); + } + next = next->GetNext(); + } + return nullptr; + } + DECLARE_INSTRUCTION(Phi); protected: |