diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-14 09:43:38 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-14 14:26:11 +0100 |
commit | f635e63318447ca04731b265a86a573c9ed1737c (patch) | |
tree | 47cab84a6ac47d8a4f5f281e3eabdf1780f220d0 /compiler/optimizing/nodes.h | |
parent | d115735fe5523ff72319f0968f773683323c7f79 (diff) | |
download | art-f635e63318447ca04731b265a86a573c9ed1737c.zip art-f635e63318447ca04731b265a86a573c9ed1737c.tar.gz art-f635e63318447ca04731b265a86a573c9ed1737c.tar.bz2 |
Add a compilation tracing mechanism to the new compiler.
Code mostly imported from: https://android-review.googlesource.com/#/c/81653/.
Change-Id: I150fe942be0fb270e03fabb19032180f7a065d13
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 081c2bd..27b87ca 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; } |