diff options
| author | 2014-03-05 15:42:50 +0000 | |
|---|---|---|
| committer | 2014-03-05 15:42:51 +0000 | |
| commit | 2fecd65be4ce930e15a9d20358d32a650a2442b9 (patch) | |
| tree | fbcd2e0d71b0b4577553ff93bb890f31bf2e8f42 /compiler/optimizing/nodes.h | |
| parent | 83f56a43d85dfdadb07cd6b057c03f4df45af647 (diff) | |
| parent | d4dd255db1d110ceb5551f6d95ff31fb57420994 (diff) | |
Merge "Add codegen support to the optimizing compiler."
Diffstat (limited to 'compiler/optimizing/nodes.h')
| -rw-r--r-- | compiler/optimizing/nodes.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 3d5d531cfe..46fe95e99f 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -43,6 +43,13 @@ class HGraph : public ArenaObject { ArenaAllocator* arena() const { return arena_; } const GrowableArray<HBasicBlock*>* blocks() const { return &blocks_; } + HBasicBlock* entry_block() const { return entry_block_; } + HBasicBlock* exit_block() const { return exit_block_; } + + void set_entry_block(HBasicBlock* block) { entry_block_ = block; } + void set_exit_block(HBasicBlock* block) { exit_block_ = block; } + + void AddBlock(HBasicBlock* block); void BuildDominatorTree(); @@ -57,8 +64,6 @@ class HGraph : public ArenaObject { ArenaBitVector* visiting) const; void RemoveDeadBlocks(const ArenaBitVector& visited) const; - HBasicBlock* GetEntryBlock() const { return blocks_.Get(0); } - ArenaAllocator* const arena_; // List of blocks in insertion order. @@ -67,6 +72,9 @@ class HGraph : public ArenaObject { // List of blocks to perform a pre-order dominator tree traversal. GrowableArray<HBasicBlock*> dominator_order_; + HBasicBlock* entry_block_; + HBasicBlock* exit_block_; + DISALLOW_COPY_AND_ASSIGN(HGraph); }; @@ -174,12 +182,15 @@ class HBasicBlock : public ArenaObject { class HInstruction : public ArenaObject { public: - HInstruction() : previous_(nullptr), next_(nullptr) { } + HInstruction() : previous_(nullptr), next_(nullptr), block_(nullptr) { } virtual ~HInstruction() { } HInstruction* next() const { return next_; } HInstruction* previous() const { return previous_; } + HBasicBlock* block() const { return block_; } + void set_block(HBasicBlock* block) { block_ = block; } + virtual intptr_t InputCount() const = 0; virtual HInstruction* InputAt(intptr_t i) const = 0; @@ -189,6 +200,7 @@ class HInstruction : public ArenaObject { private: HInstruction* previous_; HInstruction* next_; + HBasicBlock* block_; friend class HBasicBlock; @@ -304,6 +316,10 @@ class HGoto : public HTemplateInstruction<0> { public: HGoto() { } + HBasicBlock* GetSuccessor() const { + return block()->successors()->Get(0); + } + DECLARE_INSTRUCTION(Goto) private: @@ -333,6 +349,8 @@ class HGraphVisitor : public ValueObject { void VisitInsertionOrder(); + HGraph* graph() const { return graph_; } + // Visit functions for instruction classes. #define DECLARE_VISIT_INSTRUCTION(name) \ virtual void Visit##name(H##name* instr) { VisitInstruction(instr); } |