diff options
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r-- | compiler/optimizing/nodes.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 081c2bd08a..27b87ca0da 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -82,7 +82,7 @@ class HGraph : public ArenaObject { void SimplifyCFG(); // Find all natural loops in this graph. Aborts computation and returns false - // if one loop is not natural, that is the header does not dominated the back + // if one loop is not natural, that is the header does not dominate the back // edge. bool FindNaturalLoops() const; @@ -268,8 +268,8 @@ class HBasicBlock : public ArenaObject { HInstruction* GetFirstInstruction() const { return instructions_.first_instruction_; } HInstruction* GetLastInstruction() const { return instructions_.last_instruction_; } - HInstructionList const* GetInstructions() const { return &instructions_; } - HInstructionList const* GetPhis() const { return &phis_; } + const HInstructionList& GetInstructions() const { return instructions_; } + const HInstructionList& GetPhis() const { return phis_; } void AddSuccessor(HBasicBlock* block) { successors_.Add(block); @@ -444,6 +444,17 @@ class HInstruction : public ArenaObject { bool HasUses() const { return uses_ != nullptr || env_uses_ != nullptr; } + size_t NumberOfUses() const { + // TODO: Optimize this method if it is used outside of the HGraphTracer. + size_t result = 0; + HUseListNode<HInstruction>* current = uses_; + while (current != nullptr) { + current = current->GetTail(); + ++result; + } + return result; + } + int GetId() const { return id_; } void SetId(int id) { id_ = id; } |